PostgreSQL SSL 连接
2017-08-29 本文已影响0人
青鱼之鱼
-
general private key
openssl genrsa -des3 -out server.key 1024
-
Remove password
openssl rsa -in server.key -out server.key chmod 400 server.key
-
General server certificate
openssl req -new -key server.key -days 3650 -out server.crt -x509
-
General root certificate
cp server.crt root.crt
-
Move certificate files to pgdata
mv server.* apps/postgresql/9.6.1/data mv root.crt apps/postgresql/9.6.1/data
-
PostgreSQL settings
-
postgresql.conf
ssl = on ssl_ca_file = 'root.crt'
-
pg_hba.conf
# 全部连接 ssl 加密 hostssl all all 0.0.0.0/0 md5
-
-
Restart PostgreSQL
docker restart postgres
-
Connect to server
SSL Connection