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

Unable to connect to MySQL 8.0.35 server over SSL #3816

Open
jmpalacios opened this issue Feb 5, 2024 · 4 comments
Open

Unable to connect to MySQL 8.0.35 server over SSL #3816

jmpalacios opened this issue Feb 5, 2024 · 4 comments

Comments

@jmpalacios
Copy link
Contributor

jmpalacios commented Feb 5, 2024

Describe Your Environment

  • Version of ZoneMinder: 1.36.33.
  • How you installed ZoneMinder: FreeBSD package.
  • Full name and version of OS: FreeBSD 13.2 (jail).
  • PHP version: 8.2.14

Describe the bug
Zoneminder's PHP code is unable to connect to a MySQL sever over SSL with a self-signed CA database server certificate, producing the error "SQLSTATE[HY000] [2002] Cannot connect to MySQL using SSL".

To Reproduce
Steps to reproduce the behavior:

  1. Configure Zoneminder's ZM_DB_SSL_CA_CERT, ZM_DB_SSL_CLIENT_KEY, & ZM_DB_SSL_CLIENT_CERT parameters, pointing them at the self-signed CA certificate, and client certificate and key files.
  2. Start Zoneminder's PHP-FPM server.
  3. Load Zoneminder in the browser.
  4. Confirm the error stated above.

Expected behavior
Zoneminder should be able to connect to a database server with a self-signed CA certificate.

The problem is rather trivial to solve by editing the includes/database.php file and inserting the PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false PDO configuration option right below the PDO::MYSQL_ATTR_SSL_CERT option on line 57. Using that, Zoneminder can easily connect to the database server and the error goes away. So, perhaps the server CA certificate verification setting could be abstracted away behind a new ZM_DB_SSL_VERIFY_SERVER_CERT parameter, or something similar?

Please let me know if you'd like a merge request for something like this.

Than you!

Copy link

welcome bot commented Feb 5, 2024

Thanks for opening your first issue here! Just a reminder, this forum is for Bug Reports only. Be sure to follow the issue template!

@connortechnology
Copy link
Member

By all means, send a PR. Yup, let's add another ZM config for that.

@jmpalacios
Copy link
Contributor Author

By all means, send a PR. Yup, let's add another ZM config for that.

Sure thing, will do so ASAP!

@jmpalacios
Copy link
Contributor Author

I've submitted PR 3817 to take care of this issue. Please keep in mind that I'm far from familiar with the ZoneMinder source, so I took my best shot at covering what sifting through the code suggested was all the necessary bases.

Please let me know if I missed anything, thank you!

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

No branches or pull requests

2 participants