Kri*_*sti 1 mysql mariadb lets-encrypt
我在强迫 MariaDB 在 Debian 8 上使用我的 SSL 证书文件时遇到了麻烦。
Apache2 在 /etc/letsencrypt/* 中的当前文件权限下工作正常 唯一对当前证书有问题的服务是 MariaDB。
我尝试对 /etc/letsencrypt/live/domain/*.pem 中的文件使用 ACL:
setfacl -m "u:mysql:r--" /etc/letsencrypt/live/domain/*.pem
Run Code Online (Sandbox Code Playgroud)
它没有用。在以 mysql 用户身份运行 bash 后,我发现 mysql 用户无法访问 /etc/letsencrypt/live。所以我在实时和域目录上运行了 setfacl。
MariaDB 仍然无法访问这些证书。
所以......在将 .pem 文件复制到 /etc/mysql 并将它们的所有权更改为 mysql:mysql 后,它有点工作。现在我得到:
mysqld[4131]: 180211 0:27:54 [Warning] Failed to setup SSL
mysqld[4131]: 180211 0:27:54 [Warning] SSL error: Unable to get private key
mysqld[4131]: 180211 0:27:54 [Note] Server socket created on IP: 'x.x.x.x'.
mysqld[4131]: 180211 0:27:54 [Note] /usr/sbin/mysqld: ready for connections.
Run Code Online (Sandbox Code Playgroud)
效果如下:
mysql --ssl -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 137
Server version: 10.0.32-MariaDB-0+deb8u1 (Debian)
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> SHOW STATUS LIKE 'Ssl_cipher';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Ssl_cipher | |
+---------------+-------+
1 row in set (0.01 sec)
MariaDB [(none)]>
Run Code Online (Sandbox Code Playgroud)
我当前的 /etc/mysql/my.cnf 的 SSL 部分:
ssl-ca=/etc/mysql/chain.pem
ssl-cert=/etc/mysql/cert.pem
ssl-key=/etc/mysql/privkey.pem
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?我该怎么做才能让 MariaDB 使用那个 SSL?为什么其他服务在默认权限下完全没有问题?
根据此评论的建议:MariaDB SSL configuration - using Let's Encrypt certificate
我的密钥格式错误,我试图用 openssl 将此密钥转换为不同的格式。
openssl rsa -in ./privkey.pem -out ./privkeyrsa.pem
Run Code Online (Sandbox Code Playgroud)
在调整权限 (0400) 和该文件的所有权 (mysql:mysql) 后,SSL 开始按预期工作。(当然还有配置行指向正确的证书)
我仍然不知道 SSL 证书的权限是否应该保持原样,或者我应该更改它们并可能解决 /etc/letsencrypt/live 无法通过 mysql 访问而其他所有内容都无法访问(即使使用正确的 ACL)的问题对于 mysql 用户)。
但是如果它有效并且只有 mysql 可以访问这些文件,一切都应该没问题。
| 归档时间: |
|
| 查看次数: |
4518 次 |
| 最近记录: |