[SERVER-24533] SSL mode does not seem to work with IPs instead of hostnames Created: 13/Jun/16 Updated: 14/Jul/16 Resolved: 13/Jun/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Admin, Security |
| Affects Version/s: | 3.2.7 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Michal Kralik | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Participants: |
| Description |
|
We're running v3.2.7 in three member replica configuration.
The config on one of the nodes is as following:
When trying to connect to this member via
We get the following error:
The certificate is configured as follows:
It appears that mongo client should connect without any issues since the CN=*, but mongo client throws an error about invalid hostname. |
| Comments |
| Comment by Michal Kralik [ 15/Jun/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
No problem. Thanks for the info. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andreas Nilsson [ 15/Jun/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, apologies it looks like you are right, SAN IP addresses are not supported n our current TLS stack. I have filed Thanks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michal Kralik [ 14/Jun/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The problem appears to be in SAN.
While this (CN=*.my.dev, SAN=127.0.0.1) does not work and throws invalid hostname error:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michal Kralik [ 14/Jun/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There seems to be an issue with the IPs being used instead of hostnames. I have tried the following two certificates:
Used this command to start MongoDB:
And this to connect:
But still get error about invalid hostname
Using --sslAllowInvalidHostnames with mongo client helps, but still shows a warning that the hostname does not match.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andreas Nilsson [ 13/Jun/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ok, you can also try to set another CN that technically valid according to the spec together with the IP address. Good luck! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michal Kralik [ 13/Jun/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you andreas.nilsson for your reply. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ramon Fernandez Marina [ 13/Jun/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ceecko@gmail.com, as per Andreas' explanation it seems there's no bug in the server, so I'm going to close this ticket since the SERVER project is for reporting bugs or feature suggestions for MongoDB. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag, where your question will reach a larger audience. A question like this involving more discussion would be best posted on the mongodb-user group. See also our Technical Support page for additional support resources. Thanks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andreas Nilsson [ 13/Jun/16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, Using a wildcard CN=* is not supported in SSL/TLS certificates per the standard, you will need to use *.mydomain.tld. If your organization doesn't care about hostname matching you can also start the server with the flag --sslAllowInvalidHostnames which is semantically equivalent to using CN=*. If you want to use IP addresses for hostname matching I would recommend adding them to the SAN field of the certificate. Kind regards, |