vscode-postgres icon indicating copy to clipboard operation
vscode-postgres copied to clipboard

how can i set my ssl certificate file and key file

Open 313256906su opened this issue 5 years ago • 7 comments

I want to connect to my postgesql database with ssl mode, i have a .crt file and .key file, but i don't konw how to put these two files in the settings. Could someone help please?

313256906su avatar May 10 '19 01:05 313256906su

I have found that there are two ways of connecting to servers securely - and both are considered SSL.

  1. Connecting to a postgres server over ssl - works similar to a browser on https, you just have to tell the connection to be secure (this method is currently supported).
  2. Using Certificates for authentication - best guess also happens over ssl, and I originally tried to implement this, but it only ended up working like method 1. Probably due to a misunderstanding trying to figure out the node-postgres docs on SSL/TLS. (this method is not currently supported - the limited form I tried was removed in v1.1.9)

Borvik avatar May 10 '19 10:05 Borvik

I have the same problem. Its impossible to me to connect to my server because i must have valid certificate.

screen_vscode_pg

I enter the connection's parameters, and when I press enter in step 6, i have this message... It would be nice if we could add .crt and .key files

Dionyzos73 avatar Jun 20 '19 16:06 Dionyzos73

Has anyone been able to solve the issue displayed on @Dionyzos73 issue screenshot?

Makabata avatar Mar 02 '20 08:03 Makabata

Same problem, would be nice to be able to point to your certificates

STguerin avatar Mar 07 '20 22:03 STguerin

Looks like certPath is a possible property of the connection configuration. See here:
https://github.com/Borvik/vscode-postgres/blob/master/src/common/database.ts#L76

nazrhyn avatar Jun 30 '20 14:06 nazrhyn

Thanks, for Azure Postgres Servers I needed to specify an ssl certificate (MS Docs)

{
  "label": "myLabel",
  "host": "some.postgres.database.azure.com",
  "user": "admin@some",
  "port": 5432,
  "ssl": true,
  "certPath": "/the/path/to/BaltimoreCyberTrustRoot.crt.pem",
  "database": "",
  "password": "mostSecurePlainTextPassword"
}

elliott-fwdsec avatar Mar 29 '21 15:03 elliott-fwdsec

The SQLTools extension has the ability to specify the ca, key, and cert when setting up a database connection, however unless I missed it, I don't see a way to do that here.

image

bdtoole avatar Oct 31 '23 22:10 bdtoole