Debian 12 上的 MariaDB 11.5.2。

我已经为我的服务器创建了证书,位于/etc/acme模式 644(所有者 root,组 mysql)

/etc/mysql/mariadb.conf.d $ cat 99-bsz.cnf 

[mysqld]

bind-address            = 0.0.0.0
ssl-ca = /etc/ssl/certs/sectigo-ca.pem
ssl-cert = /etc/acme/hostname-fullchain.pem
ssl-key = /etc/acme/hostname-key.pem
#require-secure-transport = on # played with this oiption, nothing helps
character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci
#innodb_buffer_pool_size = 8G

cat 50-client.cnf 

[client-mariadb]
ssl
ssl-verify-server-cert

但它不起作用

$ mariadb -p -u root
Enter password: 
ERROR 2026 (HY000): TLS/SSL error: Hostname verification failed

当我设置

cat 50-client.cnf
[client-mariadb]
host= hostname.tld

mariadb -p有效。因此,它需要有效的 FQDN,localhost或者127.0.0.1还不够。然后我可以检查我的连接是否启用了 TLS,并且status显示SSL: Cipher in use is TLS_AES_256_GCM_SHA384, cert is OK但未REQUIRE SSL设置root

> SELECT user,host FROM mysql.user WHERE ssl_type <> '';
+------------+----------------+
| User       | Host           |
+------------+----------------+
| user1      | X.Y.Z.W        |
| user2      | X.Y.Z.W        |
| user3      | X.Y.Z.W        |
+------------+----------------+

这些都是需要 SSL 的远程用户。但为什么root也强制使用 SSL?

3

  • 1
    有几件事:在 Unix 主机上运行 MySQL 及其衍生产品时, localhost有一个特殊含义“使用 Unix 套接字文件连接”,而不是“通过 IP 地址为 127.0.0.1 的 TCP/IP 连接”。dev.mysql.com/doc/refman/8.4/en/ 事实上,在错误消息中,IP 地址在反向 DNS 查找后显示(即 127.0.0.1 显示为 localhost),这无助于故障排除。因此,对于您的第二条错误消息:检查您的 GRANT 表,看看是否已为用户“root”@“127.0.0.1”设置了访问权限,而不仅仅是“root”@“localhost”。


    – 


  • 已添加此内容,但如果不指定 localhosat 的 FQDN,仍然无法连接。需要知道如何禁用来自 localhost/127.0.0.1 的连接的 SSL。


    – 

  • 添加了更多详细信息。主机名是必需的,因为 TLS 也是从本地主机强制执行的。


    – 

0