Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup default CA path if not provided #1206

Merged
merged 2 commits into from
Sep 6, 2021

Conversation

dbussink
Copy link
Collaborator

This adds setup of a default CA path if there's no path provided by the user. This enables easier configuration of system level CA validation if the MySQL server has a certificate signed by a system root.

On more and more cloud based MySQL platforms system signed CA certificates are used and this hides the issue of selecting the appropriate path from the user.

The real longer term answer here is that this is a default that changes in libmysqlclient itself. The current situation here is mixed. When using MariaDB (including the changes in #1205), the default system roots are already loaded and used if no CA is provided.

On MySQL itself on the other hand, a CA path is required today. I have also opened a PR to improve that, see
mysql/mysql-server#358 & https://bugs.mysql.com/bug.php?id=104649.

"/etc/ssl/certs/ca-certificates.crt",
"/etc/pki/tls/certs/ca-bundle.crt",
"/etc/ssl/ca-bundle.pem",
"/etc/ssl/cert.pem",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list matches all common used paths as mentioned also at https://docs.planetscale.com/reference/secure-connections#ca-root-configuration.

https://github.com/golang/go/blob/master/src/crypto/x509/root_linux.go#L7-L14 has a somewhat similar list, but a number of those are not needed since those platforms then provide a symlink already in this list.

@dbussink dbussink force-pushed the dbussink/handle-default-ca-paths branch from 33c29bf to 78a44da Compare August 27, 2021 09:34
This adds setup of a default CA path if there's no path provided by the
user. This enables easier configuration of system level CA validation if
the MySQL server has a certificate signed by a system root.

On more and more cloud based MySQL platforms system signed CA
certificates are used and this hides the issue of selecting the
appropriate path from the user.

The real longer term answer here is that this is a default that changes
in libmysqlclient itself. The current situation here is mixed. When
using MariaDB (including the changes in #1205), the default system roots
are already loaded and used if no CA is provided.

On MySQL itself on the other hand, a CA path is required today. I have
also opened a PR to improve that, see
mysql/mysql-server#358 &
https://bugs.mysql.com/bug.php?id=104649.
@dbussink dbussink force-pushed the dbussink/handle-default-ca-paths branch from 9a28614 to 6ae1d9a Compare August 27, 2021 09:36
@sodabrew
Copy link
Collaborator

sodabrew commented Sep 6, 2021

This is excellent, thank you for the PR!

@sodabrew sodabrew merged commit 9307dd9 into master Sep 6, 2021
@sodabrew sodabrew deleted the dbussink/handle-default-ca-paths branch September 6, 2021 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants