Using an External Certificate Authority with Puppet Enterprise

The different parts of Puppet Enterprise (PE) use SSL certificates to communicate securely with each other, and PE uses its own certificate authority (CA) to generate and verify these credentials. However, you may already have your own CA in place and wish to use it instead of PE’s integrated CA.

The following tasks detail the procedures for replacing the PE CA with your own.

Replace the PE CA with an external CA

Setting up an external certificate authority to use with PE is beyond the scope of this document; in fact, we assume that you already have some knowledge of CA and security credential creation and have the ability to set up your own external CA. This document will lead you through the certs and security credentials you’ll need to replace in PE.

Before you begin, we recommend you familiarize yourself with the following docs:

We recommend that once you’ve set up your external CA and security credentials, you first replace the files for PE master/agent nodes and the PE console, then replace the files for PuppetDB, and then replace the PE MCollective files. Remember, naming the new certs and security credentials exactly as they’re named by PE will ensure the easiest path to success.

Replacing the PE Ca with an external CA involves the following tasks:

  1. Use your external CA to prepare the certificates and security credentials.
  2. Replace the PE Master and PE console certificates and security credentials.
  3. Replace the orchestration-services certificates and security credentials.
  4. Replace the console-services certificate and security credentials.
  5. Replace the Puppet Master certificate and security credentials in PostgreSQL.
  6. Replace the PuppetDB certificates and security credentials.
  7. Replace the MCollective certificates and security credentials.
  8. Edit puppet.conf, restart services, and run Puppet.
  9. Add agent nodes using your external CA.

Prepare the certificates and security credentials

The task is to use your external CA to prepare the certificates and security credentials. You will need the following:

  • The complete X.509 Certificate Authority certificate chain for the external party CA, in PEM format

  • An X.509 Certificate, signed by the external party CA, in PEM format, with matching private and public keys, for each PE service which uses a certificate

  • An X.509 Certificate, signed by the external party CA, in PEM format, with matching private and public keys, for each Puppet agent node

  1. On your Puppet master, inspect the inventory of certificates signed using PE’s built-in CA. You will need a cert, private key, and public key for each. Run puppet cert list --all.

    You will see results for the following:

    • Per-node certificates for the Puppet master (and any agent nodes)
    • pe-internal-puppet-console-mcollective-client
    • pe-internal-mcollective-servers
    • pe-internal-peadmin-mcollective-client
  2. Each of these need to be replaced with new certificates signed by your external CA. The tasks below will explain how to find and replace these credentials. For each certificate you create, you need to add the following information:

    • For the X.509 extension, Extended Key Usage, add serverAuth and clientAuth.
    • Comment out the entry, nsCertType=server.
    • Add any Puppet master DNS alt names to the cert. Note that the default alt name puppet is always included.

    Note: pe-orchestration-services and pe-console-services use the agent certificate for the node they run on.

    Tip: For ease of use, we recommend naming ALL of your certificate and security credential files exactly the same way they are named by PE and replace them as such on the Puppet master; for example, use the cp command to overwrite the file contents of the certs generated by the PE CA. This will ensure that PE will recognize the file names and not overwrite any files when you perform Puppet runs. In addition, this will prevent you from needing to touch various config files, and thus, limit the chances of problems arising.

    The remainder of this doc assumes you’ll use identical files names.

Replace the Puppet master certificates and security credentials

After you create the necessary certificates and security credentials with your external CA, you’re ready to replace the PE Master and PE console certificates and security credentials.

  1. On the Puppet master, clear the cached catalog.

    rm -f /opt/puppetlabs/puppet/cache/client_data/catalog/<PUPPET MASTER FQDN>.json
    
  2. In the console, click Nodes > Classification, and in the PE Infrastructure group, select the PE Certificate Authority group.
  3. On the Rules tab, in the row for the Puppet master, click Unpin, and commit changes.
  4. Click Classification, and in the PE Infrastructure group, select the PE Master group.
  5. On the Classes tab, in the puppet_enterprise::profile::master class, set the enable_ca_proxy parameter value to false.
  6. Click Add parameter, and commit changes.
  7. Run Puppet.
  8. Stop all PE services.

    puppet resource service puppet ensure=stopped
    puppet resource service pe-puppetserver ensure=stopped
    puppet resource service pe-activemq ensure=stopped
    puppet resource service mcollective ensure=stopped
    puppet resource service pe-puppetdb ensure=stopped
    puppet resource service pe-postgresql ensure=stopped
    puppet resource service pe-console-services ensure=stopped
    puppet resource service pe-nginx ensure=stopped
    puppet resource service pe-orchestration-services ensure=stopped
    
  9. Copy your new certs and security credentials for the Puppet master to the relevant locations.

    External CA Generated File Location on Host Name of File
    CA’s certificate /etc/puppetlabs/puppet/ssl/certs ca.pem
    CA’s CRL /etc/puppetlabs/puppet/ssl crl.pem
    CA’s CRL /etc/puppetlabs/puppet/ssl/ca ca_crl.pem
    Host’s Cert /etc/puppetlabs/puppet/ssl/certs <PUPPET MASTER FQDN>.pem
    Host’s Public Key etc/puppetlabs/puppet/ssl/public_keys <PUPPET MASTER FQDN>.pem
    Host’s Private Key etc/puppetlabs/puppet/ssl/private_keys <PUPPET MASTER FQDN>.pem


    cp <PATH TO NEW PUPPET MASTER FQDN>.cert /etc/puppetlabs/puppet/ssl/certs/<PUPPET MASTER FQDN>.pem
    cp <PATH TO NEW PUPPET MASTER FQDN>.private_key /etc/puppetlabs/puppet/ssl/private_keys/<PUPPET MASTER FQDN>.pem
    cp <PATH TO NEW PUPPET MASTER FQDN>.public_key /etc/puppetlabs/puppet/ssl/public_keys/<PUPPET MASTER FQDN>.pem
    cp <PATH TO NEW CA CRL>.pem /etc/puppetlabs/puppet/ssl/crl.pem
    cp <PATH TO NEW CA CRL>.pem /etc/puppetlabs/puppet/ssl/ca/ca_crl.pem
    cp <PATH TO NEW CA CRT>.pem /etc/puppetlabs/puppet/ssl/certs/ca.pem
    

Replace the pe-orchestration-services certificates and security credentials

After you replace the Puppet master certificates and security credentials, you’re ready to replace the pe-orchestration-services certificates and security credentials.

  1. In /etc/puppetlabs/orchestration-services/ssl/ add the new certs and security credentials for the Puppet master, and create the .pk8 cert.

    cp /etc/puppetlabs/puppet/ssl/certs/<PUPPET MASTER FQDN>.pem /etc/puppetlabs/orchestration-services/ssl/<PUPPET MASTER FQDN>.cert.pem
    cp /etc/puppetlabs/puppet/ssl/public_keys/<PUPPET MASTER FQDN>.pem /etc/puppetlabs/orchestration-services/ssl/<PUPPET MASTER FQDN>.public_key.pem
    cp /etc/puppetlabs/puppet/ssl/private_keys/<PUPPET MASTER FQDN>.pem /etc/puppetlabs/orchestration-services/ssl/<PUPPET MASTER FQDN>.private_key.pem
    openssl pkcs8 -topk8 -inform PEM -outform DER -in /etc/puppetlabs/orchestration-services/ssl/<PUPPET MASTER FQDN>.private_key.pem -out /etc/puppetlabs/orchestration-services/ssl/<PUPPET MASTER FQDN>.private_key.pk8 -nocrypt
    chown -R pe-orchestration-services:pe-orchestration-services /etc/puppetlabs/orchestration-services/ssl/
    
  2. Ensure pe-orchestration-services can access the new credentials

    chown -R pe-orchestration-services:pe-orchestration-services /etc/puppetlabs/orchestration-services/ssl/       
    

Replace the console and console-services certificate and security credentials

After you replace the pe-orchestration-services certificates and security credentials, you’re ready to replace the console and console-services certificate and security credentials.

  1. Replace the console’s certs and security credentials.

    Note: For a split install these are the Puppet agent certs, found in the following locations on the console server:

    • /etc/puppetlabs/puppet/ssl/certs/<AGENT FQDN>.pem
    • /etc/puppetlabs/puppet/ssl/private_keys/<AGENT FQDN>.pem
    • /etc/puppetlabs/puppet/ssl/public_keys/<AGENT FQDN>.pem


    External CA Generated File Location on Host Name of File Notes
    PE console cert /etc/puppetlabs/puppetdb/ssl /etc/puppetlabs/puppet/ssl/<PUPPET MASTER CERT>.pem On a monolithic install, copy the Puppet master’s agent cert to this location; on split install, copy the Puppet agent’s cert to this location
    PE console private key /etc/puppetlabs/puppet/ssl /etc/puppetlabs/puppet/ssl/<PUPPET MASTER PRIVATE KEY>.pem On a monolithic install, copy the Puppet master’s agent cert to this location; on split install, copy the Puppet agent’s cert to this location
    PE console public key /etc/puppetlabs/puppet/ssl /etc/puppetlabs/puppet/ssl/<PUPPET MASTER PUBLIC KEY>.pem On a monolithic install, copy the Puppet master’s agent cert to this location; on split install, copy the Puppet agent’s cert to this location


    cp /etc/puppetlabs/puppet/ssl/certs/<PUPPET MASTER FQDN>.pem /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER FQDN>.cert.pem
    cp /etc/puppetlabs/puppet/ssl/private_keys/<PUPPET MASTER FQDN>.pem /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER FQDN>.private_key.pem
    cp /etc/puppetlabs/puppet/ssl/public_keys/<PUPPET MASTER FQDN>.pem /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER FQDN>.public_key.pem
    openssl pkcs8 -topk8 -inform PEM -outform DER -in /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER FQDN>.private_key.pem -out /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER FQDN>.private_key.pk8 -nocrypt
    chown -R pe-puppetdb:pe-puppetdb /etc/puppetlabs/puppetdb/ssl
    
  2. In /opt/puppetlabs/server/data/console-services/certs/, add the new certs and security credentials for the Puppet master, and create the .pk8 cert.

    cp /etc/puppetlabs/puppet/ssl/certs/<PUPPET MASTER FQDN>.pem /opt/puppetlabs/server/data/console-services/certs/<PUPPET MASTER FQDN>.cert.pem
    cp /etc/puppetlabs/puppet/ssl/private_keys/<PUPPET MASTER FQDN>.pem /opt/puppetlabs/server/data/console-services/certs/<PUPPET MASTER FQDN>.private_key.pem
    cp /etc/puppetlabs/puppet/ssl/public_keys/<PUPPET MASTER FQDN>.pem /opt/puppetlabs/server/data/console-services/certs/<PUPPET MASTER FQDN>.public_key.pem
    openssl pkcs8 -topk8 -inform PEM -outform DER -in /opt/puppetlabs/server/data/console-services/certs/<PUPPET MASTER FQDN>.private_key.pem -out /opt/puppetlabs/server/data/console-services/certs/<PUPPET MASTER FQDN>.private_key.pk8 -nocrypt
    chown -R pe-console-services:pe-console-services /opt/puppetlabs/server/data/console-services/certs/
    
  3. Ensure the console can access the new credentials.

    chown -R pe-console-services:pe-console-services /opt/puppetlabs/server/data/console-services/certs
    

Replace the Puppet Master certificate and security credentials in PostgreSQL

You need to replace the Puppet Master certificate and security credentials in PostgreSQL.

  1. Add the Puppet master’s certificate and security credentials to the PostgreSQL certs directory, located at /opt/puppetlabs/server/data/postgresql/9.4/data/certs/.

    cp /etc/puppetlabs/puppet/ssl/certs/<PUPPET MASTER FQDN>.pem /opt/puppetlabs/server/data/postgresql/9.4/data/certs/<PUPPET MASTER FQDN>.cert.pem
    cp /etc/puppetlabs/puppet/ssl/private_keys/<PUPPET MASTER FQDN>.pem /opt/puppetlabs/server/data/postgresql/9.4/data/certs/<PUPPET MASTER FQDN>.private_key.pem
    cp /etc/puppetlabs/puppet/ssl/public_keys/<PUPPET MASTER FQDN>.pem /opt/puppetlabs/server/data/postgresql/9.4/data/certs/<PUPPET MASTER FQDN>.public_key.pem
    
  2. Ensure PostgreSQL can access the new credentials.

    chown pe-postgres:pe-postgres /opt/puppetlabs/server/data/postgresql/9.4/data/certs/*
    

Replace the PuppetDB certificates and security credentials

After you need to replace the Puppet Master certificate and security credentials in PostgreSQL, you Replace the PuppetDB certificates and security credentials.

  1. Replace PuppetDB’s certs and security credentials, and create the .pk8 cert.

    Note: For a split install these are the Puppet agent certs, found in the same locations as the Puppet master certs, i.e.,

    • /etc/puppetlabs/puppet/ssl/certs/<AGENT FQDN>.pem
    • /etc/puppetlabs/puppet/ssl/private_keys/<AGENT FQDN>.pem
    • /etc/puppetlabs/puppet/ssl/public_keys/<AGENT FQDN>.pem
    External CA Generated File Location on Host Name of File Notes
    PuppetDB cert /etc/puppetlabs/puppetdb/ssl /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER CERT>.pem On a monolithic install, copy the Puppet master’s agent cert to this location; on split install, copy the Puppet agent’s cert to this location
    PuppetDB private key /etc/puppetlabs/puppet/ssl /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER PRIVATE KEY>.pem On a monolithic install, copy the Puppet master’s agent cert to this location; on split install, copy the Puppet agent’s cert to this location
    PuppetDB public key /etc/puppetlabs/puppet/ssl /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER PUBLIC KEY>.pem On a monolithic install, copy the Puppet master’s agent cert to this location; on split install, copy the Puppet agent’s cert to this location


    cp /etc/puppetlabs/puppet/ssl/certs/<PUPPET MASTER FQDN>.pem /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER FQDN>.cert.pem
    cp /etc/puppetlabs/puppet/ssl/private_keys/<PUPPET MASTER FQDN>.pem /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER FQDN>.private_key.pem
    cp /etc/puppetlabs/puppet/ssl/public_keys/<PUPPET MASTER FQDN>.pem /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER FQDN>.public_key.pem
    openssl pkcs8 -topk8 -inform PEM -outform DER -in /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER FQDN>.private_key.pem -out /etc/puppetlabs/puppetdb/ssl/<PUPPET MASTER FQDN>.private_key.pk8 -nocrypt
    chown -R pe-puppetdb:pe-puppetdb /etc/puppetlabs/puppetdb/ssl
    
  2. Ensure PuppetDB can access the new credentials.

    chown -R pe-puppetdb:pe-puppetdb /etc/puppetlabs/puppetdb/ssl
    

Replace the MCollective certificates and security credentials

You need to replace the MCollective certificates and security credentials

  1. Generate new credentials for each McCollective cert, then replace the cert, private key, and public key for each of them.

    External CA Generated File Location on Host Name of File
    MCollective internal servers cert /etc/puppetlabs/puppet/ssl/certs pe-internal-mcollective-servers.pem
    MCollective internal servers priv key /etc/puppetlabs/puppet/ssl_private_keys pe-internal-mcollective-servers.pem
    MCollective internal servers pub key /etc/puppetlabs/puppet/ssl_public_keys pe-internal-mcollective-servers.pem
    MCollective client cert /etc/puppetlabs/puppet/ssl/certs pe-internal-peadmin-mcollective-client.pem
    MCollective client priv key /etc/puppetlabs/puppet/ssl_private_keys pe-internal-peadmin-mcollective-client.pem
    MCollective client pub key /etc/puppetlabs/puppet/ssl_public_keys pe-internal-peadmin-mcollective-client.pem
    MCollective internal console client cert /etc/puppetlabs/puppet/ssl/certs pe-internal-puppet-console-mcollective-client.pem
    MCollective internal console client priv key /etc/puppetlabs/puppet/ssl_private_keys pe-internal-puppet-console-mcollective-client.pem
    MCollective internal console client pub key /etc/puppetlabs/puppet/ssl_public_keys pe-internal-puppet-console-mcollective-client.pem


    cp <PATH TO NEW PE-INTERNAL-MCOLLECTIVE-SERVERS>.cert /etc/puppetlabs/puppet/ssl/certs/pe-internal-mcollective-servers.pem
    cp <PATH TO NEW PE-INTERNAL-MCOLLECTIVE-SERVERS>.private_key /etc/puppetlabs/puppet/ssl/private_keys/pe-internal-mcollective-servers.pem
    cp <PATH TO NEW PE-INTERNAL-MCOLLECTIVE-SERVERS>.public_key /etc/puppetlabs/puppet/ssl/public_keys/pe-internal-mcollective-servers.pem
    cp <PATH TO NEW PE-INTERNAL-MCOLLECTIVE-CLIENT>.cert /etc/puppetlabs/puppet/ssl/certs/pe-internal-peadmin-mcollective-client.pem
    cp <PATH TO NEW PE-INTERNAL-MCOLLECTIVE-CLIENT>.private_key /etc/puppetlabs/puppet/ssl/private_keys/pe-internal-peadmin-mcollective-client.pem
    cp <PATH TO NEW PE-INTERNAL-MCOLLECTIVE-CLIENT>.public_key /etc/puppetlabs/puppet/ssl/public_keys/pe-internal-peadmin-mcollective-client.pem
    cp <PATH TO NEW PE-INTERNAL-PUPPET-CONSOLE-MCOLLECTIVE-CLIENT>.cert /etc/puppetlabs/puppet/ssl/certs/pe-internal-puppet-console-mcollective-client.pem
    cp <PATH TO NEW PE-INTERNAL-PUPPET-CONSOLE-MCOLLECTIVE-CLIENT>.private_key /etc/puppetlabs/puppet/ssl/private_keys/pe-internal-puppet-console-mcollective-client.pem
    cp <PATH TO NEW PE-INTERNAL-PUPPET-CONSOLE-MCOLLECTIVE-CLIENT>.public_key /etc/puppetlabs/puppet/ssl/public_keys/pe-internal-puppet-console-mcollective-client.pem
    
  2. On the Puppet master, navigate to /etc/puppetlabs/activemq/.
  3. Remove the following two files: broker.ts and broker.ks.

Edit puppet.conf, restart services, and run Puppet

Finally, once all the certificates and security credentials are replaced, you need to ddit puppet.conf, restart services, and run Puppet

  1. On the Puppet master, navigate to /etc/puppetlabs/puppet/ and open puppet.conf.
  2. In the [agent] section add, certificate_revocation=false.

    At this point, you need to restart or start the various services that help control Puppet and then run Puppet so that the certs and security credentials can be properly distributed.

  3. Restart all PE services.

    puppet resource service puppet ensure=running
    puppet resource service pe-puppetserver ensure=running
    puppet resource service pe-activemq ensure=running
    puppet resource service mcollective ensure=running
    puppet resource service pe-puppetdb ensure=running
    puppet resource service pe-postgresql ensure=running
    puppet resource service pe-console-services ensure=running
    puppet resource service pe-nginx ensure=running
    puppet resource service pe-orchestration-services ensure=running
    
  4. From the Puppet master node, use the command line to kick off a Puppet run with puppet agent -t.

During this run, Puppet will copy the credentials you replaced into their final locations, regenerate the ActiveMQ truststore and keystore, and restart the pe-activemq and mcollective services.

To ensure the certs have been properly distributed, got so the Node Inventory page in the console and click the Puppet master node in the list. Then, on the Reports tab, review the information for the node.

Add agent nodes using your external CA

After you replace the PE CA with your external CA, you need to replace the agent certificates and security credentials on your managed nodes.

To determine the proper locations for the certificate and security credential files used by the Puppet agent, run the following commands:

  • Certificate: puppet agent --configprint hostcert
  • Private key: puppet agent --configprint hostprivkey
  • Public key: puppet agent --configprint hostpubkey
  • Certificate Revocation List: puppet agent --configprint hostcrl
  • Local copy of the CA’s certificate: puppet agent --configprint localcacert
  1. Install Puppet Enterprise on the node, if it isn’t already installed.
  2. Using the same external CA you used for the Puppet master, create a cert and private key for your agent node.
  3. Using the commands above, locate the files you will need to replace on the agent.
  4. Copy the agent’s certificate, private key, and public key into place. Do the same with the external CA’s CRL and CA certificate.
  5. On your agent, restart the puppet service.

Your node should now be able to do Puppet agent runs, and its reports will appear in the console. (You can accelerate this by letting Puppet run once, waiting a few minutes for the node to be added to the MCollective group in the console, and then running puppet agent -t.)

↑ Back to top