mysql_ssl_rsa_setup generates server-key.pem inacessible by mysqld

Bug #1828407 reported by ne1
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mysql-5.7 (Ubuntu)
Confirmed
Wishlist
Unassigned

Bug Description

 5.7.26-0ubuntu0.18.04.1
MySQL 5.7 should sort of automatically get around with SSL key generation.
The problem is that included mysql_ssl_rsa_setup script creates
/var/lib/mysql/server-key.pem with rw permissions for root
But it has to be readable by mysqld to be of any usefulness

say "chown :mysql" and "chmod g+r" solved it for me.
I wonder if this can be included in the script mentioned so that it works out of the box.
askubuntu etc is filled with 'advice' to go to mysql official doc which does not help, as the recommendations henerate limited permission files again.

By default:
[Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key

after mysql_ssl_rsa_setup:
[ERROR] SSL error: Unable to get private key from 'server-key.pem'

after chown fix:
[Warning] CA certificate ca.pem is self signed.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Config is in
/etc/mysql/mysql.conf.d/mysqld.cnf

default disabled:
/etc/mysql/mysql.conf.d/mysqld.cnf:103:# ssl-ca=/etc/mysql/cacert.pem
/etc/mysql/mysql.conf.d/mysqld.cnf:104:# ssl-cert=/etc/mysql/server-cert.pem
/etc/mysql/mysql.conf.d/mysqld.cnf:105:# ssl-key=/etc/mysql/server-key.pem

I confirm that the permissions keys are created are root only:
# ll /var/lib/mysql/server-key.pem
-rw------- 1 root root 1675 May 10 07:29 /var/lib/mysql/server-key.pem

Actually that is just the default of the tool as it comes from upstream
And it has parameters for all you need:

Adding --uid mysql would make it do what you want.

If the defaults of the upstream tool should be changed that would IMHO be an upstream bug.
Unfortunately the user set up to use is not part of the ./configure call so I'm not sure how it would know.

wishlist from Ubuntu perspective, if you happen to file an upstream bug to change the default pelse mention it here so it can be tracked.

Changed in mysql-5.7 (Ubuntu):
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
ne1 (brada4) wrote :

Default is enabled from mysql data directory
https://dev.mysql.com/doc/refman/5.7/en/creating-ssl-rsa-files-using-mysql.html
One can override that with parameters you mentioned (and use CA signed keys as opposed to default opportunistic attempt)

I will check with upstream and return if I have something.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.