前提: 編輯 pg_hba.conf 設定權限存取
vi pg_hba.conf
host all all 192.168.1.12/32 md5 # md5加密
# 雖然 password用了md5加密過,在作select等動作並未加密
host all all 192.168.1.12/32 password # 明碼
host all all 192.168.1.12/32 trust # 不用密碼
pg_ctl reload
server端
[1.] vi postgresql.conf
ssl = true
[2.] cd /var/lib/pgsql/data
openssl req -new -text -out server.req
openssl rsa -in privkey.pem -out server.key
rm privkey.pem
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod og-rwx server.key
cp server.crt root.crt
[3.] pg_ctl restart
client端
複製server端的server.key及server.crt到自已家目錄的".postgresql"裡
scp server.key ~/.postgresql/postgresql.key
scp server.crt ~/.postgresql/postgresql.crt
留言