I'm trying to add SSL to my MariaDB server. I followed the instructions at https://www.cyberciti.biz/faq/how-to-setup-mariadb-ssl-and-secure-connections-from-clients/ and enabled SSL on the database server. And I alter an existing user with REQUIRE SSL so that the user is supposed to be working only under SSL connection.

I tried to connect to the server with the user without any SSL files supplied and the connection failed as supposed. Then I put the SSL files required for client use (ca, client-cert, client-key) on the client side, and specify them in ~/.my.cnf, the connection worked as supposed.

To test the connection further, I wrote a minimal C++ program that uses libmysqlcient. At first, no SSL options were specified (as introduced at https://dev.mysql.com/doc/refman/5.7/en/mysql-ssl-set.html). However, it successfully connected to the database server without any SSL files supplied (SSL files all removed) even though the user REQUIRE SSL. If I specify MYSQL_OPT_SSL_KEY, MYSQL_OPT_SSL_CERT, MYSQL_OPT_SSL_CA, then the files must be valid to make the connection work.

The same thing also happens with a newly created user with REQUIRE SSL.

I'm not sure if anything is missing during the setup of the server?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.