Postgres connection rejected with sslMode=full in DATABASE_URL, and empty DATABASE_CACERTFILE #4955
Open
2 tasks done
Labels
self-hosting
Anything self-hosted
Past Issues Searched
Issue is a Bug Report
Using official Plausible Cloud hosting or self-hosting?
Self-hosting
Describe the bug
I'm supplying a
DATABASE_URL=postgres://username:[email protected]:5432/prod_plausible?sslmode=full
to my postgres server which indicates that SSL should be used (sslmode=full
). However the connection is blocked by postgres, reason: encryption. The only way to get it to work is to include theDATABASE_CACERTFILE=/app/DigiCert-Global-Root-CA.pem
environment variable and copy over root certificate used to sign the postgresql instance. I don't want to do this, since Azure has changed the root CA certificate in the past for postgresql, and I don't want to update these manually.I looked at the code and notice that if
DATABASE_CACERTFILE
is set, a ssl flag is set here:analytics/config/runtime.exs
Lines 470 to 478 in 50eef62
I think that this ssl flag should probably be set if the
DATABASE_CACERTFILE
is NOT supplied, but theDATABASE_URL
has ssl in the connection string?I am however not familiar with the plausible source code or the language used here.
Expected behavior
DATABASE_URL
postgres connectionstring indicates that SSL should be used, I expect it to be usedScreenshots
No response
Environment
The text was updated successfully, but these errors were encountered: