Using docker images:
percona/pmm-server:2
percona/pmm-client:2
I’m running pmm-server on vm0 and I’m able to bring up the UI and see that the connection is secure.
Docker command:
docker run --detach --restart always
–publish 443:443
-v ${pmm_server_volume_name}:${pmm_server_volume_path}
-v ${MONGO_OPT_PATH}/certificates/pmm:/srv/nginx
–name pmm-server
${pmm_server_image}
Certificates mounted to /srv/nginx:
[root@2103881373c7 nginx]# ls -lrt
total 28
…
-rw-r-----. 1 root root 1679 Feb 15 20:39 certificate.key
-rw-r-----. 1 root root 2908 Feb 15 20:39 certificate.crt
-rw-r-----. 1 root root 3042 Feb 15 20:39 ca-certs.pem
-rw-r-----. 1 root root 245 Feb 15 20:39 dhparam.pem
On vm2, I’m running pmm-client and it is unclear from the docs on how I need to mount certificates. I’ve mounted the same KeyFactor certificate to /srv/nginx and I mounted a self-signed certificate used for TLS to percona mongodb in /certs.
docker run
–name pmm-client
-d
–rm
-e PMM_AGENT_SERVER_ADDRESS=${pmm_server_address}
-e PMM_AGENT_SERVER_USERNAME=${pmm_server_username}
-e PMM_AGENT_SERVER_PASSWORD=${pmm_server_password}
-e PMM_AGENT_SETUP=1
-e PMM_AGENT_CONFIG_FILE=config/pmm-agent.yaml
-v /opt/app/mongo/local/bin/certificates/pmm-client:/certs
-v /opt/app/mongo/local/bin/certificates/pmm:/srv/nginx
-v ${pmm_client_volume_name}:${pmm_client_volume_path}
${pmm_client_image}
pmm-client container exits almost immediately (6-7 seconds) with this in docker logs:
Checking local pmm-agent status…
pmm-agent is not running.
Registering pmm-agent on PMM Server…
Failed to register pmm-agent on PMM Server: Post “https://<dns_name>:443/v1/management/Node/Register”: x509: certificate signed by unknown authority.
When I run a curl command, I’m seeing “Peer’s Certificate issuer not recognized”:
curl -v https://admin:@<dns_name>
About to connect() to <dns_name> port 443 (#0)
Trying 10.0.1.8…
Connected to <dns_name> (10.0.1.8) port 443 (#0)
Initializing NSS with certpath: sql:/etc/pki/nssdb
Hi Denys, I have successfully tested pmm-server/pmm-client with the non-TLS flag before. I am specifically working on setting up a secure connection from pmm-client to pmm-server and pmm-client to percona mongodb.
theoretically you need to put it (serts) somewhere inside of system directory where all other certs are, so the lib would find it in a standard location.
So far I don’t have correct answer, where they should be and how.
Yeah that’s what I was thinking. The documentation provides a step-by-step solution to adding certs to /srv/nginx for pmm-server but not for pmm-client. Please let me know when your team has tested a successful solution or when you have an answer.
I tried, and it worked for me to mount cert on this location for the pmm-client container: -v ~/tmp/certs-pmm/certificate.crt:/etc/pki/tls/certs/ca-bundle.crt
Go looks for certificates in these locations:
Also, please make sure you have proper CN/SAN in you certs so connection wouldn’t be refused because of incorrect domain name: requested domain name does not match the server's certificate.
Hi Denys, thanks for the update. I tried your solution by mounting certificate.crt. Good news is that the x509: certificate signed by unknown authority error doesn’t show in the logs. On the other hand, I’m not sure why pmm-client didn’t start up. I included the docker logs but I’m not sure how else to debug this.
$ docker run --name pmm-server -d --publish 443:443 -v /tmp/certs:/srv/nginx percona/pmm-server:2
$ docker run --name pmm-client -d -e PMM_AGENT_SERVER_ADDRESS=172.18.0.1 -e PMM_AGENT_SERVER_USERNAME=*** -e PMM_AGENT_SERVER_PASSWORD=*** -e PMM_AGENT_SETUP=1 -e PMM_AGENT_CONFIG_FILE=config/pmm-agent.yaml -v /tmp/certs:/etc/pki/tls/certs percona/pmm-client:2
===================================================
INFO[2023-04-06T05:58:05.595+00:00] Updating PMM Server address from “172.18.0.1” to “172.18.0.1:443”. component=main
INFO[2023-04-06T05:58:05.600+00:00] Connected to 172.18.0.1:443. component=client
Regarding your particular setup it’s still unclear why pmm-agent exits, therefore please try either to use the steps above and/or enable debug for pmm-agent (PMM_AGENT_DEBUG, for more details pmm-agent - PMM Client agent - Percona Monitoring and Management) to check if any additional errors appear in logs