• Resolved chaplina

    (@chaplina)


    We recently configured our WordPress database connection to use SSL.

    We also configured the MySQL user to require ssl for connections.

    This breaks MailPoet as it does not recognize the MYSQL_CLIENT_FLAGS when establishing a database connection.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Thu P. a11n

    (@thup90)

    Hi there,

    How does this break MailPoet exactly? Do you see any error in specific?

    Thread Starter chaplina

    (@chaplina)

    MailPoet is unable to connect to the MySQL database when require ssl is configured for the user.

    Plugin Support Dani F. a11n

    (@danielinhou)

    Hi again @chaplina 👋🏽

    Do you have any error message, log, or screenshot that you can share with us? I would be glad to review this further with that info.

    Cheers

    Thread Starter chaplina

    (@chaplina)

    The error displayed in the site using MailPoet is the “Unable to connect to the database…” message.

    Since MailPoet does not use the wpdb API to connect to the database, it will need to somehow recognize the SSL config associated with the database connection for WordPress.

    The line in our wp-config.php that enforces SSL is:

    define(‘MYSQL_CLIENT_FLAGS’,MYSQLI_CLIENT_SSL|MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT);

    Hi there @chaplina,

    Thank you for your patience while we’ve been looking into this!

    I checked with our developers and confirmed that MailPoet doesn’t support SSL connections to the database.

    You can try the following workaround but this is not something we can help you with: https://www.simonjanvier.com/developpement/805-setup-mailpoet-with-a-remote-ssl-database-connexion.

    As a long-term goal, we plan to fully use the WordPress database connection but it will take some time to implement it. We have also logged your request as a suggested feature internally and we will evaluate the number of requests coming about it.

    I hope this clarifies a bit, but please let us know if you have any questions!

    Thread Starter chaplina

    (@chaplina)

    Thanks for the information.

    We can live with MailPoet not using SSL for the database connection (although that may change if our security audit makes certain recommendations).

    Modifying that file is not onerous but we’d have to check it after every plugin upgrade.

    It looks like the only lines needed would be:

    PDO::MYSQL_ATTR_SSL_CA => ‘/etc/pki/tls/cert.pem’,
    PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false

    I’ve added them in our test site, configured the mysql user to require ssl and mailpoet no longer reports any errors.

    Thanks to all who provided assistance and happy new year!

    Hi there @chaplina,

    I’m glad to hear that you found a workaround 🙂

    Happy New Year to you too!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘enforce ssl for database user breaks MailPoet’ is closed to new replies.