My company operates its own internal CA for internal services, and I need to access hook up Ansible AWX [python] to talk to one of our internal services which uses a cert signed by this CA. Basically:
- AWX spins up a container
awx_task
with/etc/pki/ca-trust/source/anchors
mounted in, which contains the root CA cert. [double-checked] update-ca-trust
is run, bundling the CA cert into various things, including/etc/pki/tls/certs/ca-bundle.crt
. [double-checked]requests
should use this bundle. There are no CA-related environment variables that I can find inside the container or on the host that would override this.
However when I trigger a test run of an Ansible play which runs inside of awx_task
I get the error:
requests.exceptions.SSLError: HTTPSConnectionPool(host='vault.example.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),))
On the host machine I can run
import requests
requests.get("https://vault.example.com")
and get a 200
response, and if I strace
the process I can see it reading /etc/pki/tls/certs/ca-bundle.crt
. But from inside awx_task
I get the same requests.exceptions.SSLError
as above. Unfortunately Docker won't let me run strace inside the container so I can't see what it's trying to read.
But if I modify the code to:
import requests
requests.get("https://vault.example.com", verify="/etc/pki/tls/certs/ca-bundle.crt")
I get a 200
response from inside the container.
What am I missing here?