Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL/TLS Support #86

Closed
davisuga opened this issue Apr 25, 2022 · 7 comments
Closed

SSL/TLS Support #86

davisuga opened this issue Apr 25, 2022 · 7 comments

Comments

@davisuga
Copy link

davisuga commented Apr 25, 2022

I'm getting the following error while trying to connect to my mariadb server:
Failed to connect to : Error 1105, unknown error: Code: UNAVAILABLE\nserver does not allow insecure connections, client must use SSL/TLS\n.")

Does Caqti supports SSL/TLS? If yes, how do I configure it?

@paurkedal
Copy link
Owner

The MariaDB library will normally use TLS if available, however there are some TLS options which are currently not supported by Caqti. This involves the path to trusted CA certificates and ciphers, which are thus restricted to the defaults. I'm not sure what is the case, but if the server is using a self-signed or locally signed certificate, it may therefore need to be included in the system default CAs. Also libmariadb can be compiled without a TLS library, but that's unlikely if shipped by a distribution.

It would be good in any case to support the MariaDB TLS options (somehow, since it seems inappropriate to pass the CA path as an URL parameter, which is the only means currently of configuring a connection).

@davisuga
Copy link
Author

Got it, thanks for the response. I'm using PlanetScale for hosting, will check if there is a way to disable this option.

@davisuga
Copy link
Author

I ended up using ocaml-mariadb :/

@paurkedal
Copy link
Owner

Caqti is using ocaml-mariadb when talking to a MariaDB or MySQL server, so I assume you passed some options to make it work? It would be good to know which options you needed, so that I can add support for them.

@davisuga
Copy link
Author

davisuga commented Apr 28, 2022

Yes, I'm using ~options:[ Ssl_ca "/etc/ssl/certs/ca-certificates.crt" ]

@paurkedal
Copy link
Owner

That makes sense. Thanks!

@paurkedal
Copy link
Owner

I just pushed a change which makes Caqti load settings from the default MariaDB configuration file from a section [caqti] (by default, can be adjusted with an URL parameter). That should make it possible to set TLS parameters, as long as the options file can be used. I haven't planned the next release yet, but if this is useful I can make a release on request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants