[MDEV-32641] Master_SSL_Verify_Server_Cert doesnt work for SSL replication Created: 2023-11-01 Updated: 2023-11-07 Resolved: 2023-11-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | SSL |
| Affects Version/s: | 10.4, 10.6 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Susmeet Khaire | Assignee: | Susmeet Khaire |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
I followed this blog to create SSL certificates and enable SSL replication. MariaDB Master config: master_server.cnf Certificate verification and common names
I enabled SSL replication using the following CHANGE MASTER TO command (1st without server cert verification).
Replication starts as expected and without any issues
But when I enable Master_SSL_Verify_Server_Cert, replication fails
With Master_SSL_Verify_Server_Cert being enabled by default from MariaDB 11, this could be a major issue. |
| Comments |
| Comment by Roel Van de Paar [ 2023-11-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In terms of self-certification, note that the CA's CN needs to be different. Certs creation script:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Susmeet Khaire [ 2023-11-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Roel Note that since the script was run on the same server and CN is the hostname, so the CN would be same for client & server certs.
Despite the CN being the same, the verification passes. Not sure how. And suprisingly, replication also works.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2023-11-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you for confirming. The CN for the CA (certificate authority) should be different from the CN's for the master/client certs, which is also what the issue was. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2023-11-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
i.e. CN=MYCA (CA) vs CN=mariadb-server2 (master/slave) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2023-11-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The actual verification problem seems to be that the server certificate has CN=mariadb-slave2 but the slave connects to mariadb-server2 and so gets a mismatch when having host name verification enabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2023-11-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes, CN mismatch is another potential issue as well. There seemed to be a similar issue in the support case (comment added). |