Puppet Server and Agent: Certificates, CSR Signing, Autosign and Run Interval

Puppet Training Course 26 min min read Updated: Nov 17, 2026 Intermediate
Puppet Server and Agent: Certificates, CSR Signing, Autosign and Run Interval
Intermediate Topic 1 of 3

The Agent and Server Model

text Agent node Puppet Server (port 8140, HTTPS) ---------- -------------------------------- 1. Agent runs Facter, collects facts 2. Agent sends facts ───────────────────────► 3. Server compiles catalog for this node (code + Hiera + facts + ENC/site.pp) 5. Agent applies catalog ◄───────────────── 4. Server sends catalog 6. Agent sends report ──────────────────────► 7. Server stores report, sends to PuppetDB (default: every 30 minutes)

Every connection uses TLS with certificates. The server has a built-in Certificate Authority (CA). Each agent needs a certificate that the CA has signed. After that both sides authenticate each other.

Install Puppet Server and Agent

Package names: Open-source Puppet 7 reached end of life in April 2025. For new setups use a supported release line: Puppet Core 8 (maintained by Perforce) or the community build OpenVox. Package and repository names differ by distribution, so use the current official installation page for your choice. The commands below use the common Puppet package layout, and OpenVox uses openvox-server and openvox-agent names with the same directories and commands.
bash # Server (example for Puppet packages) sudo dnf install -y puppetserver # or apt install puppetserver sudo systemctl enable --now puppetserver sudo ss -tlnp | grep 8140 # Make the commands available echo 'export PATH=/opt/puppetlabs/bin:$PATH' | sudo tee /etc/profile.d/puppet.sh # Agent sudo dnf install -y puppet-agent sudo /opt/puppetlabs/bin/puppet config set server puppet.example.com --section main sudo systemctl enable --now puppet puppet --versio
ItemLocation
Configuration/etc/puppetlabs/puppet/puppet.conf
Code/etc/puppetlabs/code/environments/
SSL files/etc/puppetlabs/puppet/ssl/ (agent) and /etc/puppetlabs/puppetserver/ca/ (server CA)
Server logs/var/log/puppetlabs/puppetserver/puppetserver.log
Agent logsjournalctl -u puppet and /var/log/puppetlabs/puppet/
Reports and state/opt/puppetlabs/puppet/cache/
JVM memory/etc/default/puppetserver or /etc/sysconfig/puppetserver (JAVA_ARGS)

Connect an Agent

bash # Make sure the agent can resolve and reach the server on 8140 ping puppet.example.com nc -zv puppet.example.com 8140 # First run: creates a key and certificate signing request (CSR) sudo puppet agent -t --server puppet.example.com --waitforcert 60 # Info: Creating a new SSL key for web01.example.com # Info: Caching certificate for ca # Info: csr_attributes file loading from ... # Info: Creating a new SSL certificate request for web01.example.com # Info: Certificate Request fingerprint (SHA256): 9B:F4:... # Info: Certificate for web01.example.com has not been signed yet
bash # On the SERVER: see requests, check fingerprint, sign sudo puppetserver ca list # pending requests sudo puppetserver ca list --all # all certificates sudo puppetserver ca sign --certname web01.example.com sudo puppetserver ca sign --all # Back on the agent: runs automatically and now gets a catalog sudo puppet agent -t
Verify before you sign: Compare the fingerprint printed by the agent with the one in puppetserver ca list. Only sign requests that you expect. Anyone who gets a signed certificate can request catalogs for that name.

Certificate Management Commands

CommandUse
puppetserver ca list [--all]Show requests, or all certificates
puppetserver ca sign --certname NAMEApprove a request
puppetserver ca revoke --certname NAMERevoke a certificate (adds it to the CRL)
puppetserver ca clean --certname NAMERevoke and delete. Use when removing a node
puppetserver ca generate --certname NAMECreate key and certificate on the server for a node
puppetserver ca importUse your own corporate CA
puppetserver ca setupCreate the CA on a fresh server

Re-enrolling a Node (Rebuilt Server)

bash # Server: remove the old certificate for the name sudo puppetserver ca clean --certname web01.example.com # Agent: remove the old SSL directory and request again sudo systemctl stop puppet sudo rm -rf /etc/puppetlabs/puppet/ssl sudo puppet agent -t --waitforcert 60 # Server: sign again sudo puppetserver ca sign --certname web01.example.com

Autosign: Sign Without Manual Work

For hundreds of cloud nodes, manual signing is too slow. Autosign lets the server approve requests that pass a check. Choose the safest method you can.

MethodSettingSecurity
Off (default)autosign = falseSafest, but manual
autosign.conf listautosign = /etc/puppetlabs/puppet/autosign.conf with names or *.example.comWeak. Anyone who can claim a name gets a certificate
autosign = trueSign everythingNever use outside a throwaway lab
Policy executableautosign = /usr/local/bin/policy-autosign.shGood: you decide using a challenge password or cloud data
bash #!/bin/bash # /usr/local/bin/policy-autosign.sh (chmod 755, owned by root) # Puppet Server calls it with the certname as $1 and the CSR on stdin. certname="$1" csr=$(cat) # Extract the challenge password from the CSR password=$(echo "$csr" | openssl req -noout -text 2>/dev/null | grep -A1 challengePassword | tail -1 | tr -d ' ') if [ "$password" = "$(cat /etc/puppetlabs/puppet/autosign-secret)" ] \ && [[ "$certname" =~ ^[a-z0-9-]+\.example\.com$ ]]; then exit 0 # sign fi exit 1 # do not sig
ini # /etc/puppetlabs/puppet/puppet.conf on the server [server] autosign = /usr/local/bin/policy-autosign.sh
yaml # On the new node BEFORE the first agent run: /etc/puppetlabs/puppet/csr_attributes.yaml --- custom_attributes: challengePassword: 'A-long-random-secret-set-by-your-provisioning-tool' extension_requests: pp_role: webserver pp_environment: productio
Provisioning flow: Terraform or cloud-init writes csr_attributes.yaml (with the one-time secret and role), installs the agent, and runs it. The server validates the secret and signs automatically. The role in the certificate becomes a trusted fact.

Important puppet.conf Settings

ini # Agent: /etc/puppetlabs/puppet/puppet.conf [main] server = puppet.example.com certname = web01.example.com environment = production [agent] runinterval = 30m # default splay = true # random delay to avoid all nodes hitting the server at once splaylimit = 10m noop = false # true = report only, change nothing report = true usecacheonfailure = true # use the last good catalog if the server is down daemonize = true
Agent commandMeaning
puppet agent -t--test: run once, in the foreground, verbose. Use for manual runs
puppet agent -t --noopShow what would change without changing
puppet agent -t --environment devRun a different environment once
puppet agent -t --tags webOnly resources with tag
puppet agent --disable 'maintenance'Pause runs, with a reason
puppet agent --enableResume
puppet config printShow all settings
puppet config print runintervalOne setting

Exit Codes from puppet agent -t

CodeMeaning
0Run succeeded, no changes
1Run failed or was disabled/locked
2Run succeeded, some resources changed
4Some resources failed
6Both changes and failures
In scripts: puppet agent -t returns 2 when changes were applied, which is normal. Use --detailed-exitcodes behaviour in CI knowing that 0 and 2 are good, and 4 or 6 are failures.

Firewall and Networking

bash sudo firewall-cmd --permanent --add-port=8140/tcp && sudo firewall-cmd --reload # RHEL family sudo ufw allow 8140/tcp # Ubuntu # Agents also need to resolve the server name: DNS record "puppet" or --server setting

Common SSL Errors

ErrorCauseFix
certificate verify failed ... (certificate not yet valid)Wrong clock on the agentFix time sync with NTP or chrony
Certificate request does not match/Retrieved certificate does not match private keyOld files from a previous installClean on both sides and re-enrol (see above)
hostname ... not match with the server certificateAgent connects with a name not in the server certificateUse server name that is in the cert, or add dns_alt_names when generating the server cert
Could not request certificate: Connection refusedServer down or firewall closedCheck service and port 8140
This node is waiting for a signed certificateRequest not signedpuppetserver ca sign
Could not retrieve catalog from remote server: Error 500Compile error on the serverRead puppetserver.log or run puppet agent -t in debug mode
Certificate is revokedNode was cleanedRemove ssl dir and re-enrol

Practice Tasks

  1. Build a lab with one server VM and one agent VM, then sign the agent certificate manually
  2. Break trust by deleting the agent ssl directory, then restore it by cleaning and re-signing
  3. Write a policy autosign script with a challenge password and test with csr_attributes.yaml
  4. Run puppet agent -t --noop and then a real run, and note exit codes 0, 2 and 4
  5. Change runinterval and splay and watch the report times on the server

Conclusion

Agents ask the server for a catalog over TLS. Sign certificates only after checking, use a policy autosign script with a secret for cloud nodes, set csr_attributes.yaml for trusted facts, and use puppet agent -t --noop before big changes.

Quick Summary: agent gets catalog over 8140; puppetserver ca sign/clean; policy autosign; csr_attributes; exit codes 0/2/4/6.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators