postgres數據庫中的證書配置

修改的配置文件:
    pg_hba.conf postgres.conf
    修改成能夠用ssl的。
    其中要想雙方認證在option中寫入 clientcert=1
創建ca機構:
    CA.sh -newca
    給cakey.pem的密碼去掉:
    openssl rsa -in demoCA/private/cakey.pem -out demoCA/private/cakey.pem
爲客戶端創建key文件和crt文件:
    CA.sh -newreq
    CA.sh -signCA 填入信息的時候,commonname 生產多個client證書時不要一致,不然生產失敗,想要一致的生成請修改demoCA/index.txt.attr文件 uniqsubname = no
    生成吊銷單:
        openssl ca -gencrl -out root.crl -days 3 吊銷單的失效日期
    吊銷證書:
        openssl ca -revoke oldcert.pem
配置pg的文件:
    cp demoCA/private/cakey.pem data/server.key
    cp demoCA/cacert.pem data/server.crt
    cp demoCA/cacert.pem data/root.crt
    到這裏就能夠用了,固然,也能夠配置一個吊銷單,管理CA
    cat index.txt > crlnumber
    CA.sh -gencrl -out root.crl -days 33
    cp root.crl data/root.crl
    chmod 0600 server* root.*post

相關文章
相關標籤/搜索