Following a rotation of the Concourse ATC CA certificate, credhub-interpolate tasks begin to fail with an error similar to the following:
Get "https://CONCOURSEDOMAIN:8844/info": x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "atcCA")
The above error occurs in Concourse deployments with a colocated Credhub/UAA when the CA certificate used in the credhub-interpolate
task is not properly trusted. This typically occurs following a rotation of the atc_ca
certificate, either manual or as part of a full CA rotation procedure of the Ops Manager hosting the deployment. In the aforementioned colocated Credhub/UAA configuration, the Credhub and UAA deployments both utilize the atc_tls
certificate used by the web instance which is signed by the atc_ca
certificate. The atc_tls
certificate is rotated as part of the atc_ca
certificate rotation procedure. If the atc_ca
certificate is not then exported from the BOSH director Credhub and appropriately configured in the task, or added to the BOSH Director trusted certificates, then the interpolate tasks may fail.
To resolve this, you will first have to determine how the certificate is being trusted by the credhub-interpolate
task. The following three scenarios outline how this CA certificate can be passed to the task:
CREDHUB_CA_CERT
parameter set to multiline text containing the PEM encoded certificateCREDHUB_CA_CERT
parameter set a variable (e.g ((credhub_ca))
)CREDHUB_CA_CERT
parameter will not be setPlease Note: There is one additional scenario that will not be explicitly covered in this article. That scenario involves the credhub-interpolate
task pointing to a Credhub instance external to the Concourse deployment. In this scenario, the below instructions should still prove useful for determining how to resolve the issue. Additionally, as this article assumes a colocated Credhub it also assumes that the credential manager configured for Concourse is also Credhub. If the deployment is utilizing Vault, please refer to the documentation for that product to determine the appropriate instructions for replacing the certificate.
For every scenario, we will first need to extract the new certificate from the BOSH Director Credhub. Below are the instructions for this process:
export BOSH_CLIENT=ops_manager BOSH_CLIENT_SECRET=SECRET BOSH_CA_CERT=/var/tempest/workspaces/default/root_ca_certificate BOSH_ENVIRONMENT=255.255.255.255 bosh
export CREDHUB_SERVER="$BOSH_ENVIRONMENT:8844" CREDHUB_CLIENT="$BOSH_CLIENT" CREDHUB_SECRET="$BOSH_CLIENT_SECRET" CREDHUB_CA_CERT="$BOSH_CA_CERT"
atc_ca
certificate to a file named atc_ca_certificate.pem
(Please note that CONCOURSEDEPLOYMENT
should be replaced with the name of Concourse BOSH deployment)credhub get -n /p-bosh/CONCOURSEDEPLOYMENT/atc_ca -k certificate > atc_ca_certificate.pem
atc_ca_certificate.pem
file for later use
Now that we have the new atc_ca
certificate exported, we can move on to resolving the issue. Below are the instructions for each scenario outlined earlier:
Scenario 1 - Plain text via the task configuration:
credhub-interpolate
taskCREDHUB_CA_CERT
parameter for the taskatc_ca_certificate.pem
file, making sure to properly format the spacing
Scenario 2 - Using an interpolated value:
This scenario will require the use of the Credhub CLI located on a system with access to the Credhub server configured in the credhub-interpolate
task as well at the atc_ca_certificate.pem
file that was previously exported.
credhub-interpolate
task in the pipeline configuration file to determine the name of the value being interpolated. For the purposes of this article, we will assume a name of credhub_ca
bosh -d CONCOURSEDEPLOYMENT ssh web/0 'sudo grep CREDHUB /var/vcap/jobs/web/config/bpm.yml'
# Sample output
% bosh -d CONCOURSEDEPLOYMENT ssh web/0 'sudo grep CREDHUB /var/vcap/jobs/web/config/bpm.yml'
Using environment '255.255.255.255' as client 'ops_manager'
Using deployment 'CONCOURSEDEPLOYMENT'
Task 4710. Done
web/12345678-1234-1234-1234-123456789012: stderr | Unauthorized use is strictly prohibited. All access and activity
web/12345678-1234-1234-1234-123456789012: stderr | is subject to logging and monitoring.
web/12345678-1234-1234-1234-123456789012: stdout | CONCOURSE_CREDHUB_CLIENT_ID: "concourse_to_credhub_client"
web/12345678-1234-1234-1234-123456789012: stdout | CONCOURSE_CREDHUB_CLIENT_SECRET: "SECRET"
web/12345678-1234-1234-1234-123456789012: stdout | CONCOURSE_CREDHUB_PATH_PREFIX: "/concourse"
web/12345678-1234-1234-1234-123456789012: stdout | CONCOURSE_CREDHUB_CA_CERT: "/var/vcap/jobs/web/config/env/CONCOURSE_CREDHUB_CA_CERT"
web/12345678-1234-1234-1234-123456789012: stdout | CONCOURSE_CREDHUB_INSECURE_SKIP_VERIFY: "false"
web/12345678-1234-1234-1234-123456789012: stdout | CONCOURSE_CREDHUB_URL: "https://255.255.255.254:8844"
web/12345678-1234-1234-1234-123456789012: stderr | Connection to 255.255.255.254 closed.
Succeeded
CONCOURSE_CREDHUB_CLIENT_ID
, CONCOURSE_CREDHUB_CLIENT_SECRET
, and CONCOURSE_CREDHUB_URL
.export CREDHUB_CLIENT=CONCOURSE_CREDHUB_CLIENT_ID CREDHUB_SECRET=CONCOURSE_CREDHUB_CLIENT_SECRET CREDHUB_SERVER=CONCOURSE_CREDHUB_URL CREDHUB_CA_CERT=/path/to/atc_ca_certificate.pem
credhub find -n credhub_ca
Please Note: This command may return several results. Concourse will search for variables in the configured prefix (By default: /concourse
), followed by the team name and the pipeline name. If it is unable to locate the variable at this path, it will then look in the prefix and team name. This allows for variables to be scoped either at the pipeline or team level. For example, you may see both /concourse/main/credhub_ca
for a variable scoped for the main
team, and /concourse/main/foundation_management/credhub_ca
for one scoped for the foundation_management
pipeline in the main
team. For the purposes of this article we will assume that it is team scope to avoid unnecessary ambiguity, but please keep this information in mind when following these instructions.
atc_ca
certificate:credhub set -n /concourse/main/credhub_ca -t certificate -c /path/to/atc_ca_certificate.pem
Scenario 3 - Via the BOSH Director trusted certificates:
The worker nodes in the Concourse deployment are able to consume certificates that are configured to be trusted by the BOSH Director. In this scenario, there will be no CREDHUB_CA_CERT
parameter set because the certificate is implicitly trusted by the worker. When the atc_ca
certificate is rotated, the new version will need to be added to the BOSH Trusted Certificates.
atc_ca_certificate.pem
file into the Trusted Certificates section below all existing certificatesbosh -d CONCOURSEDEPLOYMENT manifest > concourse_manifest.yml
bosh -d CONCOURSEDEPLOYMENT deploy concourse_manifest.yml
Please see the following for additional information: