# PMM Server/Client Docker SSL Issue

**URL:** <https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126>\
**Category:** PMM 2.x\
**Created:** [February 15, 2023, 9:47pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126 "2023-02-15T21:47:26Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbl1](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jbl1](https://forums.percona.com/u/jbl1)\
**Post date:** [February 15, 2023, 9:47pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/1 "2023-02-15T21:47:26Z")

</div>

Following using the docs: [Secure - Percona Monitoring and Management](https://docs.percona.com/percona-monitoring-and-management/how-to/secure.html)

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](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
- CAfile: /etc/pki/tls/certs/ca-bundle.crt  
CApath: none
- Server certificate:
- 

```
  subject: CN=<redacted>

```

- 

```
  start date: Feb 15 00:00:00 2023 GMT

```

- 

```
  expire date: Feb 13 23:59:59 2024 GMT

```

- 

```
  common name: <redacted>

```

- 

```
  issuer: CN=DigiCert TLS RSA SHA256 2020 CA1,O=DigiCert Inc,C=US

```

- NSS error -8179 (SEC\_ERROR\_UNKNOWN\_ISSUER)
- Peer’s Certificate issuer is not recognized.
- Closing connection 0  
curl: (60) Peer’s Certificate issuer is not recognized.

echo “Getting KeyFactor intermediary chain and certificate authority”  
openssl pkcs12 -in ${MONGO\_OPT\_PATH}/certificates/pmm/${cert\_name}.pfx -password pass: -passout pass:${cert\_password} -clcerts -nokeys | sed -ne ‘/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p’ \> ${MONGO\_OPT\_PATH}/certificates/pmm/ca-certs.pem  
openssl pkcs12 -in ${MONGO\_OPT\_PATH}/certificates/pmm/${cert\_name}.pfx -password pass: -passout pass:${cert\_password} -cacerts -nokeys -chain | sed -ne ‘/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p’ \> ${MONGO\_OPT\_PATH}/certificates/pmm/ca-certs.pem

Am I generating the ca-certs.pem file correctly or any ideas of what the issue is?

---

<div class="post-metadata">

**Author:** ![Denys\_Kondratenko](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/denys_kondratenko/32/2798_2.png) [@Denys\_Kondratenko](https://forums.percona.com/u/Denys_Kondratenko)\
**Post date:** [February 20, 2023, 2:31pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/3 "2023-02-20T14:31:18Z")

</div>

Hi jbl1,

You could set PMM\_AGENT\_SERVER\_INSECURE\_TLS=1 to skip tls cert verfication until we have a proper answer.

---

<div class="post-metadata">

**Author:** ![jbl1](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jbl1](https://forums.percona.com/u/jbl1)\
**Post date:** [February 21, 2023, 2:08pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/4 "2023-02-21T14:08:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Denys\_Kondratenko](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/denys_kondratenko/32/2798_2.png) [@Denys\_Kondratenko](https://forums.percona.com/u/Denys_Kondratenko)\
**Post date:** [February 21, 2023, 2:16pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/5 "2023-02-21T14:16:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jbl1](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jbl1](https://forums.percona.com/u/jbl1)\
**Post date:** [February 21, 2023, 2:42pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/6 "2023-02-21T14:42:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jbl1](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jbl1](https://forums.percona.com/u/jbl1)\
**Post date:** [February 23, 2023, 6:58pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/7 "2023-02-23T18:58:10Z")

</div>

Hi Denys, any solution to this yet?

---

<div class="post-metadata">

**Author:** ![Denys\_Kondratenko](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/denys_kondratenko/32/2798_2.png) [@Denys\_Kondratenko](https://forums.percona.com/u/Denys_Kondratenko)\
**Post date:** [February 24, 2023, 1:20pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/8 "2023-02-24T13:20:24Z")

</div>

Hi @jbl1,

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:

> <https://github.com/golang/go/blob/master/src/crypto/x509/root_linux.go>

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`.

Please check [Automate the SSL Certificate Lifecycle of your Percona Monitoring and Management Server - Percona Database Performance Blog](https://www.percona.com/blog/automate-the-ssl-certificate-lifecycle-percona-monitoring-and-management-server/) as well.

Thanks,  
Denys

---

<div class="post-metadata">

**Author:** ![jbl1](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jbl1](https://forums.percona.com/u/jbl1)\
**Post date:** [February 24, 2023, 4:13pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/9 "2023-02-24T16:13:52Z")

</div>

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.

```auto
-v /opt/app/mongo/local/bin/certificates/pmm/certificate.crt:/etc/pki/tls/certs/ca-bundle.crt

```

```auto
INFO[2023-02-24T14:59:42.459+00:00] Loading configuration file /usr/local/percona/pmm2/config/pmm-agent.yaml. component=local-server
INFO[2023-02-24T14:59:42.461+00:00] Using /usr/local/percona/pmm2/exporters/node_exporter component=local-server
INFO[2023-02-24T14:59:42.463+00:00] Using /usr/local/percona/pmm2/exporters/mysqld_exporter component=local-server
INFO[2023-02-24T14:59:42.463+00:00] Using /usr/local/percona/pmm2/exporters/mongodb_exporter component=local-server
INFO[2023-02-24T14:59:42.463+00:00] Using /usr/local/percona/pmm2/exporters/postgres_exporter component=local-server
INFO[2023-02-24T14:59:42.463+00:00] Using /usr/local/percona/pmm2/exporters/proxysql_exporter component=local-server
INFO[2023-02-24T14:59:42.463+00:00] Using /usr/local/percona/pmm2/exporters/rds_exporter component=local-server
INFO[2023-02-24T14:59:42.463+00:00] Using /usr/local/percona/pmm2/exporters/azure_exporter component=local-server
INFO[2023-02-24T14:59:42.463+00:00] Using /usr/local/percona/pmm2/exporters/vmagent component=local-server
INFO[2023-02-24T14:59:42.463+00:00] Updating PMM Server address from "<dns_name>" to "<dns_name>:443". component=local-server
INFO[2023-02-24T14:59:42.465+00:00] Stopped. component=local-server/JSON
INFO[2023-02-24T14:59:42.465+00:00] Done. component=local-server
INFO[2023-02-24T14:59:42.465+00:00] Process: context canceled. agentID=/agent_id/6facb169-6027-4ef9-839c-135064a40d1f component=agent-process type=vm_agent
INFO[2023-02-24T14:59:42.465+00:00] Sending status: STOPPING (port 42001). agentID=/agent_id/6facb169-6027-4ef9-839c-135064a40d1f component=agent-process type=vm_agent
INFO[2023-02-24T14:59:42.466+00:00] Starting 0, restarting 0, and stopping 2 agent processes. component=supervisor
INFO[2023-02-24T14:59:42.466+00:00] Supervisor Changes() channel drained. component=client
INFO[2023-02-24T14:59:42.466+00:00] Supervisor QANRequests() channel drained. component=client
INFO[2023-02-24T14:59:42.466+00:00] Connection closed. component=client
INFO[2023-02-24T14:59:42.481+00:00] Jobs runner Messages() channel drained. component=client
INFO[2023-02-24T14:59:42.481+00:00] Actions runner Results() channel drained. component=client
INFO[2023-02-24T14:59:42.481+00:00] Process: context canceled. agentID=/agent_id/22fb7102-e716-458f-801a-ca5b0fcfad34 component=agent-process type=node_exporter
INFO[2023-02-24T14:59:42.481+00:00] Sending status: STOPPING (port 42000). agentID=/agent_id/22fb7102-e716-458f-801a-ca5b0fcfad34 component=agent-process type=node_exporter
INFO[2023-02-24T14:59:42.481+00:00] Done. component=client

```

---

<div class="post-metadata">

**Author:** ![Denys\_Kondratenko](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/denys_kondratenko/32/2798_2.png) [@Denys\_Kondratenko](https://forums.percona.com/u/Denys_Kondratenko)\
**Post date:** [February 24, 2023, 6:49pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/10 "2023-02-24T18:49:21Z")

</div>

@jbl1 that needs investigation, probably some other bug with SSL client-server connection. Could you please open a bug in [jira.percona.com](http://jira.percona.com) ?

---

<div class="post-metadata">

**Author:** ![jbl1](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jbl1](https://forums.percona.com/u/jbl1)\
**Post date:** [March 6, 2023, 8:00pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/11 "2023-03-06T20:00:17Z")

</div>

Hi @Denys_Kondratenko, I was on vacation. I have opened a ticket here: [[PMM-11767] PMM Server/Client Docker SSL - Percona JIRA](https://jira.percona.com/browse/PMM-11767).

---

<div class="post-metadata">

**Author:** ![jbl1](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jbl1](https://forums.percona.com/u/jbl1)\
**Post date:** [March 16, 2023, 5:49pm UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/12 "2023-03-16T17:49:58Z")

</div>

Hi @Denys_Kondratenko, any idea when this ticket will at least be assigned? Created it 10 days ago.

---

<div class="post-metadata">

**Author:** ![Sandra\_Romanchenko](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sandra_romanchenko/32/84_2.png) [@Sandra\_Romanchenko](https://forums.percona.com/u/Sandra_Romanchenko)\
**Post date:** [April 6, 2023, 6:08am UTC](https://forums.percona.com/t/pmm-server-client-docker-ssl-issue/20126/13 "2023-04-06T06:08:53Z")

</div>

Hi @jbl1,

I’ve tried to run PMM server + client with self-signed certificates, scenario seems to work fine. Please find steps on how to set this up below:

1. Generate certificates (I’ve used [GitHub - OpenVPN/easy-rsa: easy-rsa - Simple shell based CA utility](https://github.com/OpenVPN/easy-rsa.git) for convenience):

> $ ./easyrsa init-pki  
> $ ./easyrsa --req-cn=Percona --batch build-ca nopass  
> $ ./easyrsa --req-ou=server --subject-alt-name=DNS:pmm-server,IP:172.18.0.1 --batch build-server-full pmm-server nopass  
> $ cp pki/ca.crt /tmp/certs/ca-certs.pem  
> $ cp pki/private/pmm-server.key /tmp/certs/certificate.key  
> $ cp pki/issued/pmm-server.crt /tmp/certs/certificate.crt  
> $ openssl dhparam -out /tmp/certs/dhparam.pem 2048  
> $ ls -lah /tmp/certs/  
> -r–r–r–. 1 root root 1,2K Apr 6 08:46 ca-certs.pem  
> -r–r–r–. 1 root root 4,6K Apr 6 08:47 certificate.crt  
> -r–r–r–. 1 root root 1,7K Apr 6 08:47 certificate.key  
> -r–r–r–. 1 root root 424 Apr 6 08:47 dhparam.pem

1. Run PMM server and client:

> $ 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](https://docs.percona.com/percona-monitoring-and-management/details/commands/pmm-agent.html#options-and-environment)) to check if any additional errors appear in logs
