Generating agent certificates manually v10.5

This page explains how to manually generate an agent certificate. This is necessary if you are using a local CA rather than sslutils, or if you are using sslutils but wish to transition to using a common agent certificate.

These instructions may also be useful if you are using an organizational or external CA that requires you to supply a certificate signing request (CSR). In this case, you need to replace steps 3 and 4 with the appropriate steps for your CA.

See Deciding on an SSL model for more detail on these different SSL models.

Generating an agent certificate and key

  1. On the host where the agent will run, generate an agent key:

    # Running as root
    openssl genrsa -out agent.key 4096 
  2. Generate a CSR for the agent:

    openssl req -new -key agent.key -out agent.csr -subj '/C=<country>/ST=<state>/L=<locality>/O=<organization>/CN=<agent_user>'

    Where -subj is completed appropriately for your organization, and <agent_user> is replaced with the Postgres username that the agent will use to connect to the PEM database.

  3. Copy the CSR to host where your CA is located.

  4. On the CA host, use the openssl x509 command to sign the CSR and generate an agent certificate:

    openssl x509 -req -days 365 -in agent.csr -CA ca_certificate.crt -CAkey ca_key.key -CAcreateserial -out agent.crt
  5. Copy agent.crt back to the agent host.

  6. On the agent host, change the permissions on the agent.crt and agent.key files:

    chmod 600 agent.crt agent.key

Configuring the agent to use the new certificate and key

The next step depends on whether this certificate and key are to be used by new agent, or an agent that is already registered.