pgadmin VerifyCA 認證方法

#環境 :postgresql-10 centos7 win7 pgadmin4

#pgadmin "SSL mode" 選擇 "Verify-CA"

#生成私鑰server.key
openssl genrsa -des3 -out server.key 2048

#提取公鑰server.key
openssl rsa -in server.key -out server.key

#生成證書請求文件server.crt
openssl req -new -key server.key -days 3650 -out server.crt -x509 #Common Name 建議試用IP

#生成根證書
cp server.crt root.crt

#客戶端證書存入路徑C:\Users\Administrator\AppData\Roaming/postgresql
#客戶端證書 root.crt

#服務器證書路徑 /var/lib/pgsql/10/data
#服務器文件 root.crt、server.crt、server.key
#修改文件權限
chown postgres:postgres server.key
chown postgres:postgres server.crt
chown postgres:postgres root.crt
chmod 400 server.key
chmod 400 server.crt
chmod 400 root.crt

#vi /var/lib/pgsql/10/data/pg_hba.conf
hostssl all             all             IP/MASK       cert

#vi /var/lib/pgsql/10/data/postgresql.conf
ssl = on
ssl_ca_file = 'root.crt'

#重啓postgresql
systemctl restart postgresql-10

很粗糙 參考了不少資料  能跑通 歡迎討論

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章