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 required for connection #25

Closed
vacquah opened this issue Apr 20, 2020 · 7 comments
Closed

SSL required for connection #25

vacquah opened this issue Apr 20, 2020 · 7 comments

Comments

@vacquah
Copy link

vacquah commented Apr 20, 2020

How do you handle when ssl is required for DBInterface.connect ? I am getting an access denied message when trying to connect to a mysql database. I am able to connect to the same database with my database client (datagrip) by setting useSSL = "TRUE" in the clients configuration. Not sure how to set the same here ...

@quinnj
Copy link
Member

quinnj commented Apr 21, 2020

See the documentation for DBInterface.connect for MySQL connections: https://juliadatabases.github.io/MySQL.jl/dev/#DBInterface.connect.

@quinnj quinnj closed this as completed Apr 21, 2020
@vacquah
Copy link
Author

vacquah commented Apr 21, 2020

My apologies @quinnj. I read through that documentation and didnt quite understand it. There are no examples of how to specify ssl enforcement - it simply says ssl_enforce:::bool. I tried ssl_enforce = true, and it didnt work. I am quite new at all this so hoping you'd point me to an example code.

@vacquah
Copy link
Author

vacquah commented Apr 21, 2020

if I do ssl_enforce == true, I get:

MethodError: no method matching pointer(::Bool)
Closest candidates are:
  pointer(!Matched::String) at strings/string.jl:81
  pointer(!Matched::String, !Matched::Integer) at strings/string.jl:82
  pointer(!Matched::SubString{String}) at strings/substring.jl:113
  ...

@quinnj
Copy link
Member

quinnj commented Apr 22, 2020

I'm not super familiar w/ how SSL works for MySQL client-side, but you can checkout the documentation here: https://dev.mysql.com/doc/refman/8.0/en/mysql-options.html for my info. In particular, checkout the MYSQL_OPT_SSL_* options; I think you probably need to pass your private key ssl file and that should do it?

@vacquah
Copy link
Author

vacquah commented Apr 22, 2020

I actually just need to set ssl_enforce, I think. When using a regular desktop client to connect to the same db, I dont need to pass the private key. I just set sslmode=require.

I see you have ssl_enforce as part of the parameters I can pass in the connection string but I am not sure how that should be set . I have tried all values and still not working.

quinnj added a commit to JuliaDatabases/MySQL.jl that referenced this issue Apr 22, 2020
Reported
[here](JuliaDatabases/DBInterface.jl#25). The
issue here was our `ssl_enforce` C enum value wasn't in the "boolean"
options list, so it was attempting to treat it as a string which
obviously failed.
@quinnj
Copy link
Member

quinnj commented Apr 22, 2020

Ah, thanks for telling me about the error; I've pushed a fix for that here: JuliaDatabases/MySQL.jl@340a4f1. If you pull master of MySQL, then you should be able to try ssl_enforce=true. You can pull master by doing ] add MySQL#master

@vacquah
Copy link
Author

vacquah commented Apr 22, 2020

@quinnj happy to report its working! your timely help is much appreciated! There seems to be the same issue with the LibPQ package when connecting to a postgres db.

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