Configuring observer job security

You can configure observer jobs using plain text passwords. However, some observer jobs require additional authentication credentials such as certificates, keystores, or both. This topic describes such configuration tasks for OCP and on-prem versions of Agile Service Manager, and also describes how to post an observer job using Swagger (or cURL).

The following steps are described:
  • Obtain an authentication certificate
  • Store that certificate as a secret
  • Post an observer job

To acquire an SSL certificate and copy the certificate to the security folder (on-prem)

  1. Use the following Cisco ACI Observer example to acquire an SSL certificate.
    In the following example, you use OpenSSL to connect to Cisco APIC over port 443, and extract a SSL Certificate from Cisco APIC to a <certificate_file_name>.crt file.
    echo -n | openssl s_client -connect {Cisco APIC IpAddress}:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ./{certificate_file_name}.crt
  2. Copy the certificate file <certificate_file_name>.crt to the $ASM_HOME/security directory to complete the SSL setup.

Managing authentication certificates and storing them as secrets (OCP)

  1. Obtain the authentication certificate using OpenSSL.
    echo -n | openssl s_client -connect {ipAddress}:{port} | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | base64 -w 0 > target_system.crt
    Where target_system.crt contains the encoded certificate, and {ipAddress} could be the IP address of any of the following target systems:
    • Bigfix Inventory
    • Ciena Blue Planet
    • Cisco ACI
    • Juniper CSO
    • Kubernetes master node
    • OpenStack
    • Rancher
    • VMware NSX
    • VMware vCenter
    • Zabbix
    Example target_system.crt:
    [root@localhost ~]# cat target_system.crt
    LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN3RENDQWFnQ0NRRGRuMENqU3BXZXhUQU5CZ2txaGtpRzl3MEJBUVVGQURBaU1RMHdDd1lEVlFRRERBUkIKVUVsRE1SRXdEd1lKS29aSWh2Y05BUWtCRmdKVlV6QWVGdzB4TmpBeE1qRXdOekV5TWpWYUZ3MHlOakF4TVRndwpOekV5TWpWYU1DSXhEVEFMQmdOVkJBTU1CRUZRU1VNeEVUQVBCZ2txaGtpRzl3MEJDUUVXQWxWVE1JSUJJakFOCkJna3Foa2lHOXcw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
  2. For the GoogleCloud Observer, encrypt the contents of the service account key file using base64.
    For example:
    cat {project_id_file_name}.json | base64 -w 0 > googlecloud.json

    Where googlecloud.json contains the encoded service account key file, and {project_id_file_name}.json is the service account key file downloaded from 'Credentials' under 'API & Services' in the Google Cloud Platform dashboard.

    Next, store the encoded service account key file as a secret.
  3. Store a certificate as a secret.
    Each installed Agile Service Manager release has a single special secrets file. Data added to that is made available to the appropriate observer containers. Run the following command, assuming <release-name>-topology is the Helm release name for Agile Service Manager when installed with NOI.
    $ kubectl edit secret <release-name>-topology-custom-secrets
    Paste in the encoded certificate generated in the previous step.
    1. Find the correct secrets file using the following command:
      $ kubectl get secrets -l app=<release-name>-topology-custom-secrets
      NAME TYPE DATA AGE
      asm-custom-secrets Opaque 2 29d
    2. Edit the appropriate file for your release.
      $ kubectl edit secret <release-name>-topology-custom-secrets
    3. Add a name and value pair to the data section.
      The value is the certificate generated earlier. The name is what you enter as the certificate file name to run the observer job.
      data:
      {name}:{value}
      
      Example of expected content in the secret file after adding vcenter.crt is as follows (where the data section is between the 'apiVersion' and 'kind' sections).
      Note: This VMware vCenter Observer example registers the vcenter.crt SSL certificate in OCP Secret, and vcenter.crt is the job parameter value for the VMware vCenter Observer. Define a new {name} parameter in the same file for other observers that require SSL certificates. You provide the certificate in OCP Secret and the settings you provide for truststore/truststore password will be used to generate a new truststore automatically.
      apiVersion: v1
      data:
      vcenter.crt:LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN3RENDQWFnQ0NRRGRuMENqU3BXZXhUQU5CZ2txaGtpRzl3MEJBUVVGQURBaU1RMHdDd1lEVlFRRERBUkIKVUVsRE1SRXdEd1lKS29aSWh2Y05BUWtCRmdKVlV6QWVGdzB4TmpBeE1qRXdOekV5TWpWYUZ3MHlOakF4TVRndwpOekV5TWpWYU1DSXhEVEFMQmdOVkJBTU1CRUZRU1VNeEVUQVBCZ2txaGtpRzl3MEJDUUVXQWxWVE1JSUJJakFOCkJna3Foa2l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      
    If the edit is successful, the following message will be displayed:
    secret "<release-name>-topology-custom-secrets" edited
  4. In the OCP GUI, you can view the configured secret under the Menu > Workload > Secrets option, where the Name is 'asm-custom-secrets'. Within asm-custom-secrets, all data configured earlier is displayed.

Posting a job

  1. Post the job via the Swagger UI or cURL.
    Note: The default value for the password_ssl_truststore_file property is password and can be encrypted if required.
    • For an encrypted password, use one of the following sample formats:
      "password_ssl_truststore_file": "IxcQ9w==",
      or
      "password_ssl_truststore_file": { "hiddenString":"IxcQ9w==", "encrypted": true},
    • For an unencrypted (that is, plain text) password, use the following sample format:
      "password_ssl_truststore_file": { "hiddenString":"password", "encrypted": false},
    Example cURL command (encrypted password):
    curl --location --insecure  --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-TenantID: cfd95b7e-3bc7-4006-a4a8-a73a79c71255' -d '{
      "unique_id": "my job",
      "type": "query",
      "parameters": {
        "data_center": "LondonDC1",
        "vcenter_username": "admin",
        "vcenter_password": "RW+w==",
        "vcenter_api_url": "https://localhost/rest",
        "vcenter_certificate": "vcenter.crt",
        "ssl_truststore_file": "localhost.jks",
        "password_ssl_truststore_file": "IxcQ9w==",
        "connect_read_timeout_ms": 5000
      }
    }' 'https://<master-ip address>/1.0/vmvcenter-observer/jobs/restapi'
    Note: When using cURL, you may need to add --location so that it will follow redirects, and --insecure as the proxy server is using HTTPS.
For a repeating job, you can wrap the cURL in a script and use a normal cron job.