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
Enable connection to MySQL with SSL/TLS #10784
Comments
Hi @Bettelstab, Thanks for your report. Best regards, Khouloud |
@Bettelstab For the moment you can try to change doctrine configuration in your config.yml file and add these options (do not remove the current configuration). # Doctrine Configuration
doctrine:
dbal:
options:
MYSQL_ATTR_SSL_CA : %ca_cert%
MYSQL_ATTR_SSL_KEY : %private_key%
MYSQL_ATTR_SSL_CERT : %public_cert% |
@PierreRambaud |
I was struggling for two days to connect prestashop to my ssl secured remote database. I added PDO::MYSQL_ATTR_SSL_KEY, PDO::MYSQL_ATTR_SSL_CERT and MYSQL_ATTR_SSL_CA as suggested in opening post and it works now. Thanks @Bettelstab ! So it could be great if this can be configured in config files without hacking prestashop core. Edit: Solution from @PierreRambaud doesn't work here either. I tried to add the config to default connection options too, without success. I tried with const names and values (1009, 1008, 1007) without luck. |
Hi, Any findings? @maxtorete , you when you said it Works, you mean the website but not the /admin site, true? any findings? Regards, |
I finished that project long time ago, and finally as we didn't want to hack with PrestaShop core we moved to local database. So I'm sorry but I can't remember if /admin was working or not, but I far as I can remember, I think both were working fine with @Bettelstab hack. I think I didn't make any changes to /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php, only /classes/db/DbPDO.php was hacked. Regards, |
I see, thanks @maxtorete for your reply. |
@evmimagina Could you tell us more about the PrestaShop bug? :) |
Hello, Thank you |
@PierreRambaud do you have a guide on how to connect to DB with SSL ? |
@florine2623 why is this closed ? |
@thbl it's written:
No news for more than 30 days -> ticket is closed. Here there was no news for 6 months. We cannot keep open tickets where author does not provide informations. |
I renamed this issue for a better title, this is a request for improvement. We have no guide on how to connect to DB with SSL. If you find that this improvement is critical for you, and it's important to have it built ASAP, then you can invest into having it done. PrestaShop is an open source, community project. You can hire a developer or sysadmin to find how to do this, or if you are a developer yourself, you can try doing it on your own. The most important thing is to share that fix with everyone by submitting a Pull Request to devdocs or an improvement to the codebase -- that's what the open source spirit is all about. |
I recently moved my database to an external server and I wanted to use TLS encryption for the database connection. If I remember correctly, I got an SSL connection error in prestashop because there were no SSL options specified. In my case, the only option I needed was MYSQL_ATTR_SSL_CA. At the end, I added it manually in /classes/db/DbPDO.php, line 81:
I also had to add it manually in /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php. There is an $options parameter, but I couldn't get it to work.
I suggest to make the following options configurable:
PDO::MYSQL_ATTR_SSL_KEY, PDO::MYSQL_ATTR_SSL_CERT and MYSQL_ATTR_SSL_CA.
The text was updated successfully, but these errors were encountered: