/opsmgr/bosh_dns/tls_ca
/opsmgr/bosh_dns/tls_ca
that is signing the Bosh dns leaf certificates, refer to the "Rotate a Single CA and Its Leaf Certificates" documentation
TKGI 1.9+
Bosh dns leaf certificates are not rotated in a timely manner.
Prerequisite: If you have a TKGI cluster where the certificate rotation has failed (tkgi rotate-certificates
), you should finish the certificate rotation on this specific TKGI cluster by re-running tkgi rotate-certificates command until it successfully completes. Then you can go ahead with the Bosh dns certificate rotation.
export BOSH_CLIENT=ops_manager BOSH_CLIENT_SECRET=<secret>
export BOSH_CA_CERT=/var/tempest/workspaces/default/root_ca_certificate BOSH_ENVIRONMENT=<IP>
export CREDHUB_SERVER="$BOSH_ENVIRONMENT:8844" CREDHUB_CLIENT="$BOSH_CLIENT"
export CREDHUB_SECRET="$BOSH_CLIENT_SECRET" CREDHUB_CA_CERT="$BOSH_CA_CERT"
credhub api https://$BOSH_ENVIRONMENT:8844 --ca-cert=/var/tempest/workspaces/default/root_ca_certificate
credhub login
maestro --json topology --name /opsmgr/bosh_dns/tls_ca | jq .topology[].signs[].name
"/bosh_dns_health_client_tls"
"/bosh_dns_health_server_tls"
"/dns_api_client_tls"
"/dns_api_server_tls"
maestro --json topology --name /opsmgr/bosh_dns/tls_ca | jq '.topology[].signs[] | "\(.name) \(.versions[].valid_until)"'
"/bosh_dns_health_client_tls 2021-12-18T02:30:06Z"
"/bosh_dns_health_server_tls 2021-12-18T02:30:06Z"
"/dns_api_client_tls 2021-12-18T02:30:07Z"
"/dns_api_server_tls 2021-12-18T02:30:07Z"
maestro --json topology --name /opsmgr/bosh_dns/tls_ca | jq '.topology[].signs[] | "\(.name) \(.versions[].deployment_names)"'
"/bosh_dns_health_client_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"]"
"/bosh_dns_health_server_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"]"
"/dns_api_client_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"]"
"/dns_api_server_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"]"
maestro regenerate leaf --signed-by /opsmgr/bosh_dns/tls_ca --dry-run
to_be_regenerated:
- name: /bosh_dns_health_client_tls
certificate_id: 0b402fa6-04a3-492f-849d-cde95f5cff88
- name: /bosh_dns_health_server_tls
certificate_id: b6e7b8f2-edb4-4c2e-a1a5-332cd9f28c37
- name: /dns_api_client_tls
certificate_id: 0ae32163-a76a-4d14-8fa8-79e5402b9511
- name: /dns_api_server_tls
certificate_id: 5ac68fdb-01ef-4d50-a9f3-92281e57a74c
maestro regenerate leaf --signed-by /opsmgr/bosh_dns/tls_ca
regenerated:
- name: /bosh_dns_health_client_tls
certificate_id: 0b402fa6-04a3-492f-849d-cde95f5cff88
- name: /bosh_dns_health_server_tls
certificate_id: b6e7b8f2-edb4-4c2e-a1a5-332cd9f28c37
- name: /dns_api_client_tls
certificate_id: 0ae32163-a76a-4d14-8fa8-79e5402b9511
- name: /dns_api_server_tls
certificate_id: 5ac68fdb-01ef-4d50-a9f3-92281e57a74c
maestro
, shows two copies([OLD] and [NEW]) of each certificate. This also confirms that a new certificate was added to credhub
. The old and new certificates can be identified using the deployment_names and timestamp as shown in the output belowmaestro --json topology --name /opsmgr/bosh_dns/tls_ca | jq '.topology[].signs[] | "\(.name) \(.versions[1].deployment_names) \(.versions[1].valid_until)"'
"/bosh_dns_health_client_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T02:30:06Z"
"/bosh_dns_health_server_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T02:30:06Z"
"/dns_api_client_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T02:30:07Z"
"/dns_api_server_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T02:30:07Z"
[NEW]maestro --json topology --name /opsmgr/bosh_dns/tls_ca | jq '.topology[].signs[] | "\(.name) \(.versions[0].deployment_names) \(.versions[0].valid_until)"'
"/bosh_dns_health_client_tls [] 2021-12-18T06:18:35Z"
"/bosh_dns_health_server_tls [] 2021-12-18T06:18:35Z"
"/dns_api_client_tls [] 2021-12-18T06:18:35Z"
"/dns_api_server_tls [] 2021-12-18T06:18:35Z"
Although these certificates have been regenerated and added to credhub, the new certificates are not deployed to the actual VMs yet. This is evident from the blank([ ]) deployment name assigned to the new certificates.bosh -d <service-instance-deployment> manifest > <service-instance-deployment>.yaml
bosh -d <service-instance-deployment> deploy <service-instance-deployment>.yaml --skip-drain --fix
bosh -d <service-instance-deployment> ssh worker -c 'sudo -i && monit unmonitor all'
bosh -d <service-instance-deployment> deploy <service-instance-deployment>.yaml --skip-drain --fix
maestro --json topology --name /opsmgr/bosh_dns/tls_ca | jq '.topology[].signs[] | "\(.name) \(.versions[1].deployment_names) \(.versions[1].valid_until)"'
"/bosh_dns_health_client_tls [] 2021-12-18T02:30:06Z"
"/bosh_dns_health_server_tls [] 2021-12-18T02:30:06Z"
"/dns_api_client_tls [] 2021-12-18T02:30:07Z"
"/dns_api_server_tls [] 2021-12-18T02:30:07Z"
maestro --json topology --name /opsmgr/bosh_dns/tls_ca | jq '.topology[].signs[] | "\(.name) \(.versions[0].deployment_names) \(.versions[0].valid_until)"'
"/bosh_dns_health_client_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T06:18:35Z"
"/bosh_dns_health_server_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T06:18:35Z"
"/dns_api_client_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T06:18:35Z"
"/dns_api_server_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T06:18:35Z"
--name
option which can be used to garbage collect a single certificate.maestro gc leaf --all
deleted:
- name: /dns_api_server_tls
certificate_id: 5ac68fdb-01ef-4d50-a9f3-92281e57a74c
version_ids:
- 377142ec-578d-4df7-8abe-1db375cd380a
- name: /bosh_dns_health_server_tls
certificate_id: b6e7b8f2-edb4-4c2e-a1a5-332cd9f28c37
version_ids:
- 529bad95-1fd0-4469-9fb5-990b40453a13
- name: /bosh_dns_health_client_tls
certificate_id: 0b402fa6-04a3-492f-849d-cde95f5cff88
version_ids:
- 0c93c743-0dd2-477a-8771-9773d8065198
- name: /dns_api_client_tls
certificate_id: 0ae32163-a76a-4d14-8fa8-79e5402b9511
version_ids:
- 8c995186-2f79-4c0a-ba40-02dc2805b32f
maestro --json topology --name /opsmgr/bosh_dns/tls_ca | jq '.topology[].signs[] | "\(.name) \(.versions[0].deployment_names) \(.versions[0].valid_until)"'
"/bosh_dns_health_client_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T06:18:35Z"
"/bosh_dns_health_server_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T06:18:35Z"
"/dns_api_client_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T06:18:35Z"
"/dns_api_server_tls [\"pivotal-container-service-3b9cfff74271c08d9e0d\",\"service-instance_16d9b7c4-c1fe-4be9-81c3-0aedda0ea6c0\"] 2021-12-18T06:18:35Z"