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

Allow basic SSL connections to mysql using PDO #1342

Closed
icsy7867 opened this issue Jan 18, 2022 · 3 comments
Closed

Allow basic SSL connections to mysql using PDO #1342

icsy7867 opened this issue Jan 18, 2022 · 3 comments
Labels

Comments

@icsy7867
Copy link

Summary

Running the latest shlink in docker. My organization requies the use of SSL connection. On the command link this is really easy to facilitate, simply include --ssl in the line and everything works.

With PHP and the PDO driver, the SQL connection tries to verify the SSL CA Cert by default. You should be able to allow SSL encryption, and not verify the certificates fairly easily using these PDO options:
PDO::MYSQL_ATTR_SSL_CA => false,PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,

I THINK this could be added here:
https://github.com/shlinkio/shlink/blob/8cfb14198b523575cc3093bed2171a1bde4c7b67/module/Core/functions/functions.php

But I am still testing.

If you want to do it the more "Secure" way, you should be able to also add the capability to specify a CA cert for verification:
PDO::MYSQL_ATTR_SSL_CA=> "/path/to/cert"

You should be able to do a faily simple:
if "ca.crt" exists, use this PDO string, else use this. However I am currently trying to build and test to experiement.

@acelaya
Copy link
Member

acelaya commented Jan 18, 2022

Duplicates #1167

See comments there

@acelaya acelaya closed this as completed Jan 18, 2022
@icsy7867
Copy link
Author

I believe Doctrine does support this:
doctrine/dbal#4013

@acelaya
Copy link
Member

acelaya commented Jan 18, 2022

Only with mysqli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants