Skip to content

Cannot to connect to MariaDB using TLS #981

@lapo-luchini

Description

@lapo-luchini

I have a mariadb server configured to accept TLS connections, but they are only mandatory for some specific users.

[mariadb]
ssl_cert = <file>.cer
ssl_key = <file>.key
ssl_ca = <ca>.cer
tls_version = TLSv1.2,TLSv1.3
require_secure_transport = yes

The protocol use is thus starttls, to connect in cleartext and upgrade later.
It can be succesfully tested using:
openssl s_client -starttls mysql -connect <host>:3306 -showcerts
Using this exporter, I can either connect in cleartext (mysql_global_status_ssl_verify_depth 0) but if I enable ssl-ca in .my.cnf or use --tls.insecure-skip-verify I get a Error opening connection to database" err="remote error: tls: handshake failure and on the server side I see a Oct 13 21:41:49 VT0CLDWTSDB01C mariadbd[1566]: 2025-10-13 21:41:49 2036401 [Warning] Aborted connection 2036401 to db: 'unconnected' user: 'unauthenticated' host: '<host>' (This connection closed normally without authentication).

How can I debug the connection furhter?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions