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

很粗糙 参考了不少资料  能跑通 欢迎讨论

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