Clarify the usage of SSL Cert in the connection string with custom path
See original GitHub issueIt is not clear where the certificate should be:
postgresql://user:password@url:port/xxx?schema=xxx&sslcert=MYFILE.pem
MYFILE.pem
should be at the root? Or can we make a custom directory for it and pass as an argument?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
SSL and SSL Certificates Explained For Beginners
A complete beginners guide to SSLand SSL certificates. How they work and the different certificate types,encodings and uses.
Read more >Connection string error to postgres using SSL certificates in c# ...
I am trying to connect my .NET Web Api project to postgres database server using SSL connection and I am getting this error:....
Read more >One-Way SSL for JDBC Connections - Tableau Help
Embed a certificate; Install a certificate in the system trust store; Use custom driver properties. Embed a certificate. Some connectors support embedding the ......
Read more >SSL certificate - Metabase
You'll specify the certificate's path in your connection string. Metabase Cloud. You'll need to complete Step 3: Add your database first. Once you've...
Read more >6.3.1 Configuring MySQL to Use Encrypted Connections
ssl_cert : The path name of the server public key certificate file. This certificate can be sent to the client and authenticated against...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @paulogdm,
Let me explain what each parameter are and how you can get them. Also, there is an issue regarding where you need to place the certificate files https://github.com/prisma/prisma2/issues/1286
sslmode=(disable|prefer|require)
:sslcert=<PATH>
: This is the root certificate used by the database server to sign the client certificate. You need to provide this if the certificate doesn’t exist in the trusted certificate store of your system.sslidentity=<PATH>
: This is the SSL identity file in PKCS12 format which you will generate using the Client key and Client certificate. It will basically combine these two files in a single file and secure them via a password(see next parameter). You can create this file using your client key and client certificate by using the following command if you are using openssl:So after getting this file, you basically don’t need the client key and client cert file for connection although you want to keep that around in case you want to regenerate this file.
4.
sslpassword=<PASSWORD>
: Password that was used to secure the PKCS12 file. The openssl command listed in the last step will ask for a password while creating the PKCS12 file, you will need to provide that same exact password here.5.
sslaccept=(strict|accept_invalid_certs)
: If set to strict, any missing value in the certificate chain(ie any untrusted certificates) will lead to an error.accept_invalid_certs
will bypass this check. Defaults toaccept_invalid_certs
as most of the database clients prefer to skip this check.So, in the end, you basically need three things to create an SSL connection:
Your connection string will look like the following:
You can add the other parameters if you want.
Let me know if you need a specific clarification here.
Yes, this is issue that I have mentioned in my above comment, #1286. Right now you need them in both places but we would fix that bug in the coming weeks.
This information is available in the docs: https://github.com/prisma/prisma2/blob/754620fcf105788f09c31a3a2f461852ad432eea/docs/core/connectors/postgresql.md#configuring-an-ssl-connection. Maybe it is not as descriptive as I have written above on how to generate certain things. Also, #1286 makes the process more confusing.
I opened https://github.com/prisma/prisma2/issues/1463 to address this.