SSL/TLS connection to MySQL #635
-
Hi, does sql_exporter version 0.5 support ssl/tls connections to MySQL server? I tried to configure this in "data_source_name" of sql_exporter.yml with additional parameters in DSN but haven't been successful so far. e.g.
The same behaviour or errors at using key_store file as an alternative: In Readme or sql_exporter help I cannot really find any hint about ssl/tls connections to MySQL database. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @kuerzingera, Just in case, the current and supported version of sql_exporter is v0.16. Please also check the documentation on the DSN string here. The connection string format you're using MySQL-driver specific, you need to use the format provided by xo/dburl (link is in the documentation). TLS/SSL should be supported, and I'm happy to help you with the issue, but let's start with the right configuration. 👍 |
Beta Was this translation helpful? Give feedback.
-
Hi @burningalchemist , Thank you so far. Regarding the different sql_exporter versions I realized that I must have been landed here in wrong github project? I'm sorry for confusion.
And documentation about DSN string in Readme we have is a little bit different from given in this project. Nevertheless we succeeded to establish first SSL connection from sql_exporter client to our MySQL server (Cloud SQL) by changing SSL mode of server (lower level) and defining this data_source_name template in sql_exporter.yml:
On MySQL server side (Cloud SQL) we basically can configure following optional SSL modes for connections: So far we have just been successful to establish SSL connection with above server side SSL mode number 2 (Connection with SSL/TLS encryption without verfying certificates). We also tried with server SSL mode 3 (including certificate verification) by passing more parameters like tls.key_store / tls.key_store_password in DSN.
But result at calling sql_exporter metrics is always: I ask myself if it possible at all for sql_exporter to establish ssl/tls connection to MySQL server with passing valid client certificates for verification? BR |
Beta Was this translation helpful? Give feedback.
Hi @kuerzingera, version v0.5 is unmaintained since 2019. It's the original project I used to contribute to (made by
free
), but I had to hard fork the project to continue maintenance, development, and security updates on my own.It's possible, that v0.5 contains the old MySQL driver, which might have issues. Also, there is no special code to handle database connection on the sql_exporter side. So I'd rather check driver repository, and maybe file an issue there.
It's also possible that MySQL Driver doesn't support passing path for TLS certificates at the moment - have a look here: go-sql-driver/mysql#926.
Also related discussion: go-sql-driver/mysql#908 (comment)
So it's likely what you …