-
Notifications
You must be signed in to change notification settings - Fork 275
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
Streamline SSL experience #677
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one comment about charlist and this is good to go. I tested it on DigitalOcean and it worked!
Mix.install([
{:postgrex, github: "elixir-ecto/postgrex", branch: "jv-add-ssl-verify-full"}
])
{:ok, pid} =
Postgrex.start_link(
hostname: System.fetch_env!("DO_HOST"),
port: 25060,
username: "doadmin",
password: System.fetch_env!("DO_PASSWORD"),
database: "defaultdb",
ssl: :verify_full,
ssl_opts: [
cacertfile: "/Users/wojtek/Downloads/ca-certificate.crt"
]
)
IO.inspect(Postgrex.query!(pid, "SELECT NOW()", []))
Co-authored-by: Wojtek Mach <[email protected]>
@voltone, please let me know if you have thoughts here, the goal is to mirror this in myxql as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few more places in the docs where ssl options are described, including for example the endpoints
list under "Failover with SSL support". I don't have time right now to trace the behavior of endpoints
and understand the implications to propose updates, sorry. Thought I'd give my feedback now before this gets merged. I might have time tonight...
Co-authored-by: Bram Verburg <[email protected]>
Co-authored-by: Bram Verburg <[email protected]>
Thank you @voltone, I believe I have addressed all of your concerns. However, there is one problem, we are always setting |
From some tests this does not seem to be an issue and, if it happens, folks can always set it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this on Supabase, CockroachDB, Neon, DigitalOcean PostgreSQL, and PlanetScale (which is MySQL, but same idea) and it works well! I'll work on similar change for MyXQL soon.
💚 💙 💜 💛 ❤️ |
👋 It seems like setting config :app, Repo,
url: "ecto://postgresql://your_username:[email protected]:25060/defaultdb?ssl=true",
ssl: [cacertfile: "/path/to/cacert.pem"] results in Postgrex.child_spec([repo: Repo, ssl: true, ...]) and a warning
I wonder if URL parsing logic should be updated to avoid overwriting |
Yes, we should probably fix it in Ecto. Maybe we ignore |
@chrismccord, let me know if this works. For now, this means you need to explicitly set
ssl: :verify_full
in your config file but we can support "ssl=verify_full" via query string too.