Regenerating the server SSL certificates v10.2
If the PEM backend database server certificates are near expiring, plan to regenerate the certificates and key files.
Important
PEM performs these steps by default when the certificates are nearing expiry. These instructions are provided for completeness in case you need to manually regenerate the PEM certificates and keys.
To replace the SSL certificates:
Stop all running PEM agents, first on the server host and then on any monitored host.
On Linux:
# Running as root systemctl stop pemagentOn Windows: Use the Services applet to stop the PEM agent. The PEM agent service is named Postgres Enterprise Manager Agent. In the Services dialog box, select the service name, and select Stop the service.
Back up the existing SSL certificates and keys:
cd /var/lib/edb/as<x>/data mkdir certs mv server.* root.* ca_* certs/
Use the
opensslcommand to generate theca_key.keyfile:openssl genrsa -out ca_key.key 4096
Move the
ca_key.keyfile to the data directory of the backend server, and change the permissions:mv ca_key.key /var/lib/edb/as<x>/data chmod 600 /var/lib/edb/as<x>/data/ca_key.key
Use
ca_key.keyto generate theca_certificate.crtfile:openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout ca_key.key -out ca_certificate.crt
Change the permissions of the
ca_certificate.crtfile:chmod 600 /var/lib/edb/as<x>/data/ca_certificate.crt
Reuse the
ca_certificate.crtfile as theroot.crtfile:cp /var/lib/edb/as<x>/data/ca_certificate.crt /var/lib/edb/as<x>/data/root.crt
Change the owner and permissions on the
root.crtfile:chown enterprisedb /var/lib/edb/as<x>/data/root.crt chmod 600 /var/lib/edb/as<x>/data/root.crt
Use the
openssl_rsa_generate_crl()function to create the certificate revocation listroot.crl:psql -U enterprisedb -d pem --no-psqlrc -t -A -c "SELECT openssl_rsa_generate_crl('/var/lib/edb/as<x>/data/ca_certificate.crt', '/var/lib/edb/as<x>/data/ca_key.key')" > /var/lib/edb/as<x>/data/root.crl
Change the ownership and permissions of the
root.crlfile:chown enterprisedb /var/lib/edb/as<x>/data/root.crl chmod 600 /var/lib/edb/as<x>/data/root.crl
Use the
opensslcommand to generate theserver.keyfile:openssl genrsa -out server.key 4096
Move
server.keyto the data directory of the backend server, and change the ownership and permissions:mv server.key /var/lib/edb/as<x>/data chown enterprisedb /var/lib/edb/as<x>/data/server.key chmod 600 /var/lib/edb/as<x>/data/server.key
Use the
openssl reqcommand to create the CSR:openssl req -new -key server.key -out server.csr -subj '/C=IN/ST=MH/L=Pune/O=EDB/CN=PEM'
Where
-subjis provided as per your requirements. You defineCNas the hostname/domain name of the PEM server host.Use the
openssl x509command to sign the CSR and generate a server certificate. Moveserver.crtto the data directory of the backend database server:openssl x509 -req -days 365 -in server.csr -CA ca_certificate.crt -CAkey ca_key.key -CAcreateserial -out server.crt mv server.crt /var/lib/edb/as<x>/data
Where
-reqindicates the input is a CSR. The-CAand-CAkeyoptions specify the root certificate and private key to use for signing the CSR.Change the owner and the permissions on the
server.crtfile:chown enterprisedb /var/lib/edb/as<x>/data/server.crt chmod 600 /var/lib/edb/as<x>/data/server.crt
Restart the PEM server:
systemctl restart edb-as-<x>
Restarting the backend database server restarts the PEM server.
Regenerate each PEM agent's SSL certificates. For more information, see Regenerating agent SSL certificates.