go-gorm/postgres

ssl connection

asbrodova opened this issue · 3 comments

How to establish ssl connection

In the documentation of GORM Postrges driver there is only variant with sslmode=disabled explained. Google search does not help as well. In my case I have a GCP Postgres and need to connect to the db via ssl connection. Could you advice the proper way to do this.

@jinzhu Could you please help regarding this?

@asbrodova @thevibhu I am in the similar situation as yours. Did you find any solution?

I guess the connector uses the basic Postgres arguments, so according to the Postgress documentation , the available options are :

sslmode Eavesdropping protection MITM protection Statement
disable No No I don't care about security, and I don't want to pay the overhead of encryption.
allow Maybe No I don't care about security, but I will pay the overhead of encryption if the server insists on it.
prefer Maybe No I don't care about encryption, but I wish to pay the overhead of encryption if the server supports it.
require Yes No I want my data to be encrypted, and I accept the overhead. I trust that the network will make sure I always connect to the server I want.
verify-ca Yes Depends on CA policy I want my data encrypted, and I accept the overhead. I want to be sure that I connect to a server that I trust.
verify-full Yes Yes I want my data encrypted, and I accept the overhead. I want to be sure that I connect to a server I trust, and that it's the one I specify.