/etc/my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[mysqld]
ssl
ssl-ca = /root/ca.pem
ssl-cert = /root/server-cert.pem
ssl-key = /root/server-key.pem
bind-address = 0.0.0.0
port = 3306
max_allowed_packet = 16M
[mysqldump]
max_allowed_packet = 16M
Я запустил mariadb командой:
systemctl start mysql
Затем я вхожу в систему mysql с вводом root status
показывает SSL Not in use
. Затем я набрал
show variables like '%ssl%';
И получается таблица:
+---------------------+---------------------------------+
| Variable_name | Value |
+---------------------+---------------------------------+
| have_openssl | YES |
| have_ssl | DISABLED |
| ssl_ca | /root/ca.pem |
| ssl_capath | |
| ssl_cert | /root/server-cert.pem |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_key | /root/server-key.pem |
| version_ssl_library | OpenSSL 1.0.1e-fips 11 Feb 2013 |
+---------------------+---------------------------------+
Наконец я даже попытался войти в систему с помощью ssl, и это явно не удалось.
ОБНОВИТЬ
Вот несколько предупреждающих сообщений в файле журнала ошибок:
[Warning] Failed to setup SSL
[Warning] SSL error: SSL_CTX_set_default_verify_paths failed
[Warning] SSL error: error:0200100D:system library:fopen:Permission denied
[Warning] SSL error: error:2006D002:BIO_new_file:system lib
[warning] SSL error: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
MariaDB не разрешен доступ к файлам в домашнем каталоге root /root
. Таким образом, файлы CA, сертификата и закрытого ключа не читаются.
Стандартные места для этих файлов в RHEL находятся в каталогах под /etc/pki
: /etc/pki/CA
, /etc/pki/tls/certs
и /etc/pki/tls/private
. если ты копировать их здесь и установите надлежащих владельцев и разрешения, чтобы MariaDB могла читать их, вы обнаружите, что это работает. Кроме того, вы можете поместить сертификаты и файл закрытого ключа в подкаталог /etc/mysql
.