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 using SSL #4013

Closed
evmimagina opened this issue May 18, 2020 · 4 comments
Closed

Unable to connect to MySQL using SSL #4013

evmimagina opened this issue May 18, 2020 · 4 comments

Comments

@evmimagina
Copy link

Support Question

Hi,

I'm trying to connect to a MySQL instance using SSL with the config bellow with no luck.

parameters:
    ca_cert: "/etc/ssl/certs/Baltimore_CyberTrust_Root.pem"

….

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver:   pdo_mysql
                host:     "%database_host%"
                port:     "%database_port%"
                dbname:   "%database_name%"
                user:     "%database_user%"
                password: "%database_password%"
                server_version: 5.1
                charset:  UTF8
                # if using pdo_sqlite as your database driver:
                #   1. add the path in parameters.yml
                #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
                #   2. Uncomment database_path in parameters.yml.dist
                #   3. Uncomment next line:
                #     path:     "%database_path%"
                mapping_types:
                    enum: string

                options:
                    1002: "SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))"
                    1009: "%ca_cert%"

And I keep receiving this message:

(3/3) DriverException
An exception occured in driver: SQLSTATE[HY000] [9002] SSL connection is required. Please specify SSL options and retry.

Somehow, searching everywhere there's the reference to use the ca_cert, client-cert and client-key BUT I don't see the need to set the other two variables as client certificate and private key, the server is not requesting client-side certificate.

Any help please?

Thanks in advance and best regards,

@dmaicher
Copy link
Contributor

dmaicher commented Jun 9, 2020

Not sure if it helps but I'm using this in my prod dbal config:

options:
        !php/const:PDO::MYSQL_ATTR_SSL_CA: ''
        !php/const:PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT: false

@morozov
Copy link
Member

morozov commented Jul 25, 2021

A working solution is documented in #4209.

@khusseini
Copy link

A working solution is documented in #4209.

I couldn't understand how to configure SSL properly using pdo_mysql and doctrine from what you posted.
I have been trying to get this to work on several servers on Azure and Linode without any luck. All I get is the same error

An exception occurred in driver: SQLSTATE[HY000] [3159] Connections using insecure transport are prohibited while --require_secure_transport=ON.

and I cannot seem to find any proper documentation on this topic, only a set of Stackoverflow entries which did not help either.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants