Puppet describes how your servers should look (packages, files, services, users, firewall rules) and keeps them that way. Every agent asks the Puppet server for its catalog every 30 minutes, applies it, and reports back what it changed. Write a setting once, and every machine of that kind gets it, today and on every machine you add next year.
This guide sets up a Puppet server on Debian 13 that’s secure from the start: a protected CA, a firewall, strict settings, secrets encrypted in Hiera, and autosigning that only signs machines from your domain, in your IP ranges, that know a secret. Then it explains the two things that confuse everyone at first, nodes.pp and Hiera, with a complete example of roles and profiles, and shows how to deploy the agent on a client.
What you’ll end up with:
- A Puppet server (OpenVox 9) on Debian 13, behind a firewall, with TLS 1.2+ only
- A certificate authority that never signs alternative names or anything it shouldn’t
- Policy-based autosigning: domain name, IP range (by DNS), reverse DNS and a challenge password
- A control repository with roles, profiles, a
nodes.ppthat classifies by role, and a Hiera 5 hierarchy - Encrypted secrets with hiera-eyaml
- Agents deployed with a pre-placed CA certificate, so even the very first connection is verified
Written for: Debian 13 (trixie) with OpenVox 9. The names are examples: the server is
puppet.mydomain.orgat 10.0.10.50, admins sit in 10.0.10.0/24, and agents live in 10.0.20.0/24 and 10.0.30.0/24.
Table of contents
- Puppet in 2026: Puppet, OpenVox or Debian’s packages?
- How the pieces fit together
- Install the server
- Secure server configuration
- Autosigning by domain and IP range
- The control repository layout
- Roles and profiles
- nodes.pp: deciding what a node is
- Hiera: where the settings come from
- Secrets with hiera-eyaml
- Deploy the agent on a client
- Daily work: testing, certificates, backups
- Troubleshooting
- Checklist
1. Puppet in 2026: Puppet, OpenVox or Debian’s packages?
At the end of 2024, Perforce (the owner of Puppet) stopped publishing open-source Puppet packages; new builds are only available as the commercial “Puppet Core”. The community answered with OpenVox, a fork maintained by Vox Pupuli, the group behind most of the popular Puppet modules. OpenVox uses the same commands (puppet, puppetserver), the same file paths (/etc/puppetlabs, /opt/puppetlabs) and the same language, so every Puppet guide and module still applies.
| OpenVox 9 | Debian 13’s own packages | Puppet Core | |
|---|---|---|---|
| Server / agent | openvox-server, openvox-agent | puppetserver 8.7, puppet-agent 8.10 | puppetserver, puppet-agent |
| Source | apt.voxpupuli.org | Debian archive | Perforce, with a license |
| Updates | Regular, current | Debian security fixes, version frozen for the release | Regular |
| Paths | /etc/puppetlabs, /opt/puppetlabs | Debian layout (/etc/puppet) | /etc/puppetlabs, /opt/puppetlabs |
This guide uses OpenVox 9. Debian’s own packages work too, but the paths differ, and Puppet and OpenVox can’t be installed on the same machine.
2. How the pieces fit together
- The server compiles catalogs. It’s also the certificate authority (CA): every agent has a certificate signed by it, and every connection on port 8140 is mutual TLS. The CA decides who belongs to your fleet, so it’s the most important thing to protect.
- Environments are versions of your code:
production, and test branches next to it. Each is a directory under/etc/puppetlabs/code/environments/. nodes.pp(the main manifest) decides what a node is: it gives each node exactly one role.- Roles (
role::webserver) say what a machine is, and only include profiles. - Profiles (
profile::nginx) say how one piece of technology is set up on your network, using resources or modules. - Hiera supplies the settings for those profiles, layered from general to specific: everybody, per OS, per role, per node.

3. Install the server
Requirements. 2 CPU cores and 4 GB RAM is enough for a few hundred agents. Correct time (chrony) and DNS are not optional: certificates depend on both. The server’s name must resolve forward and reverse.
hostnamectl set-hostname puppet.mydomain.org
hostname -f # must print puppet.mydomain.org
apt install -y chronyCode language: CSS (css)
Step 1. Install Java 21 (OpenVox doesn’t bundle Java) and the OpenVox 9 repository package, which brings the signing key and the apt source:
apt install -y openjdk-21-jre-headless wget
wget -O /tmp/openvox9-release.deb https://apt.voxpupuli.org/openvox9-release-debian13.deb
dpkg -i /tmp/openvox9-release.deb
apt update
apt install -y openvox-serverCode language: JavaScript (javascript)
The commands live in /opt/puppetlabs/bin, which is added to PATH at your next login. For this session: source /etc/profile.d/puppet-agent.sh.
Step 2. Set the server’s identity before the first start, because the CA and the server certificate are created from it. dns_alt_names is the only place in your whole setup where alternative names belong: on the server’s own certificate.
puppet config set --section main certname puppet.mydomain.org
puppet config set --section main server puppet.mydomain.org
puppet config set --section main dns_alt_names puppet,puppet.mydomain.orgCode language: CSS (css)
Step 3. Memory for the JVM. The default is 2 GB; with 4 GB RAM, leave it. On a bigger server, raise both values in /etc/default/puppetserver:
sed -i 's/-Xms[0-9]*[gm]/-Xms3g/; s/-Xmx[0-9]*[gm]/-Xmx3g/' /etc/default/puppetserver
grep JAVA_ARGS /etc/default/puppetserverCode language: JavaScript (javascript)
Step 4. Create the CA and start:
puppetserver ca setup
systemctl enable --now puppetserver
puppetserver ca list --allCode language: PHP (php)
ca list --all shows one signed certificate: the server’s own, with its alternative names.
4. Secure server configuration
Strict compilation
puppet config set --section server strict_variables true
puppet config set --section server strict errorCode language: JavaScript (javascript)
Code that uses an unknown variable or a deprecated construct then fails instead of quietly doing something else. Better a failed catalog than a server configured with an empty value.
The CA never signs alternative names
Check /etc/puppetlabs/puppetserver/conf.d/ca.conf. Both settings must be false (the default); with true, an agent could request a certificate that’s also valid for, say, puppet.mydomain.org and impersonate your server:
certificate-authority: {
allow-subject-alt-names: false
allow-authorization-extensions: false
}Code language: CSS (css)
TLS 1.2 and 1.3 only
In /etc/puppetlabs/puppetserver/conf.d/webserver.conf, add one line to the webserver block:
webserver: {
# ... the existing settings stay ...
ssl-protocols: [TLSv1.3, TLSv1.2]
}Code language: PHP (php)
Firewall
Agents need port 8140, admins need SSH, nobody needs anything else:
#!/usr/sbin/nft -f
# /etc/nftables.conf -- on puppet
flush ruleset
table inet filter {
set admin_nets { type ipv4_addr; flags interval; elements = { 10.0.10.0/24 } }
set agent_nets { type ipv4_addr; flags interval; elements = { 10.0.10.0/24, 10.0.20.0/24, 10.0.30.0/24 } }
chain input {
type filter hook input priority 0; policy drop;
ct state established,related accept
ct state invalid drop
iif lo accept
meta l4proto { icmp, ipv6-icmp } accept
tcp dport 22 ip saddr @admin_nets accept
tcp dport 8140 ip saddr @agent_nets accept
}
chain forward { type filter hook forward priority 0; policy drop; }
chain output { type filter hook output priority 0; policy accept; }
}Code language: PHP (php)
nft -c -f /etc/nftables.conf
systemd-run --on-active=5min --unit=nft-rollback nft flush ruleset
nft -f /etc/nftables.conf
systemctl stop nft-rollback.timer # still connected? keep the rules
systemctl enable nftables
systemctl restart puppetserverCode language: PHP (php)
Who may change code
The code in /etc/puppetlabs/code decides what runs as root on every machine. Only root (or your deploy user) may write it; the puppet user only reads it. Treat SSH access to this server like domain admin rights: few people, keys only.
5. Autosigning by domain and IP range
When a new agent starts, it sends a certificate signing request (CSR) and waits until the CA signs it. You have three choices:
| Method | How | Security |
|---|---|---|
| By hand | puppetserver ca list, then puppetserver ca sign --certname web03.mydomain.org | Best: you look at every request |
autosign.conf | A list of names or globs, like *.mydomain.org | Weak: anyone who reaches port 8140 can claim any name that matches |
| Policy script | A script you write decides per request | As strong as your checks |
autosign.conf only matches names, and the name in a CSR is whatever the requester typed. It can’t match an IP range either: the CSR doesn’t contain the requester’s address, and the CA doesn’t pass it on. So for “only my domain, only my IP ranges”, you need a policy script. It gets the certname as its argument and the CSR on standard input; exit code 0 means sign.
This script signs only when all of these are true:
- The certname is a host in
mydomain.org - That name resolves in your DNS to an address in one of your agent networks
- The reverse DNS of that address points back to the same name
- The CSR carries the challenge password that only your provisioning knows
#!/bin/bash
# /etc/puppetlabs/puppet/autosign-policy
# Called by the CA: $1 = certname, CSR (PEM) on stdin. Exit 0 = sign.
set -uo pipefail
CERTNAME="$1"
CSR="$(cat)"
DOMAIN_RE='^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.mydomain\.org$'
ALLOWED_NETS=("10.0.20.0/24" "10.0.30.0/24")
SECRET_FILE=/etc/puppetlabs/puppet/autosign.secret
log() { logger -t puppet-autosign -- "$CERTNAME: $*"; }
reject() { log "REJECTED: $*"; exit 1; }
ip2int() { local IFS=.; read -r a b c d <<< "$1"; echo $(( (a<<24) + (b<<16) + (c<<8) + d )); }
in_net() {
local ip net bits mask
ip=$(ip2int "$1"); net=$(ip2int "${2%/*}"); bits=${2#*/}
mask=$(( bits == 0 ? 0 : (0xFFFFFFFF << (32 - bits)) & 0xFFFFFFFF ))
(( (ip & mask) == (net & mask) ))
}
# 1. Name inside our domain
[[ "$CERTNAME" =~ $DOMAIN_RE ]] || reject "name outside mydomain.org"
# 2. Forward DNS inside our agent networks
IP=$(timeout 5 getent ahostsv4 "$CERTNAME" | awk 'NR==1 {print $1}')
[[ -n "$IP" ]] || reject "no DNS record"
OK=no
for NET in "${ALLOWED_NETS[@]}"; do in_net "$IP" "$NET" && OK=yes; done
[[ "$OK" == yes ]] || reject "$IP is not in an allowed network"
# 3. Reverse DNS points back to the same name
PTR=$(timeout 5 getent hosts "$IP" | awk '{print $2}')
[[ "$PTR" == "$CERTNAME" ]] || reject "reverse DNS of $IP is '$PTR'"
# 4. Challenge password from csr_attributes.yaml
WANT=$(cat "$SECRET_FILE")
GOT=$(printf '%s\n' "$CSR" | openssl req -noout -text 2>/dev/null \
| sed -n 's/^ *challengePassword *: *//p' | head -n1)
[[ -n "$GOT" && "$GOT" == "$WANT" ]] || reject "wrong or missing challenge password"
log "signed ($IP)"
exit 0Code language: PHP (php)
Install it and the secret so that only root and the server process can read them, and switch the CA to the script:
openssl rand -base64 32 | tr -d '\n' > /etc/puppetlabs/puppet/autosign.secret
chown root:puppet /etc/puppetlabs/puppet/autosign-policy /etc/puppetlabs/puppet/autosign.secret
chmod 750 /etc/puppetlabs/puppet/autosign-policy
chmod 640 /etc/puppetlabs/puppet/autosign.secret
puppet config set --section server autosign /etc/puppetlabs/puppet/autosign-policy
systemctl restart puppetserverCode language: JavaScript (javascript)
Every decision ends up in the journal: journalctl -t puppet-autosign. Test the script by hand with a CSR from a test agent, or just watch the log while the first real agent connects.
What this does and doesn’t prove. DNS tells you the name belongs to a machine in your network, but the request could still come from another machine that read the name somewhere. The challenge password closes that gap: only machines you provisioned know it. Keep it out of Git, rotate it now and then (old agents don’t need it once they’re signed), and remove it from the agent after signing (the profile::puppet_agent in section 7 does that automatically).
Roles in the certificate. An agent also chooses its own pp_role (section 11), and this script doesn’t check it. So a provisioned machine could ask for any role. Keep secrets that only one kind of server may have at the node level in Hiera, or sign those servers by hand.
6. The control repository layout
Keep all Puppet code in one Git repository, the control repository. Each branch becomes an environment; production is the main branch. On the server it ends up in /etc/puppetlabs/code/environments/production:
production/
environment.conf
hiera.yaml the hierarchy (section 9)
manifests/
nodes.pp classification (section 8)
data/ Hiera data
common.yaml
common.eyaml
os/Debian/13.yaml
roles/webserver.yaml
nodes/web01.mydomain.org.yaml
site-modules/ your own code
role/manifests/{base,webserver,database}.pp
profile/manifests/{base,puppet_agent,nftables,nginx}.pp
profile/templates/nftables.conf.epp
modules/ modules from the Forge, installed by r10k
Puppetfile which Forge modules, in which versionCode language: JavaScript (javascript)
# environment.conf
modulepath = site-modules:modules:$basemodulepath
manifest = manifests/Code language: PHP (php)
Deploy it with r10k (apt install r10k): it checks out every branch as an environment and installs the modules listed in the Puppetfile, so the server never has code that isn’t in Git. Until you set that up, a git clone into the environment directory works fine.
7. Roles and profiles
The pattern is simple and strict:
- A profile configures one technology the way you want it:
profile::nginx,profile::base. It takes its settings as parameters (from Hiera) and may use any resource or module. - A role is what a machine is for. It only includes profiles, has no parameters and no resources.
- A node gets exactly one role.
That way, “what’s on a web server?” has one answer (role::webserver), and “how do we set up nginx?” has one answer (profile::nginx).
Profiles
# site-modules/profile/manifests/base.pp
# Everything every Debian machine gets.
class profile::base (
Array[String[1]] $ntp_servers,
Array[String[1]] $packages = ['vim', 'curl', 'htop'],
) {
package { $packages:
ensure => installed,
}
package { ['chrony', 'unattended-upgrades']:
ensure => installed,
}
file { '/etc/chrony/sources.d/puppet.sources':
ensure => file,
content => $ntp_servers.map |$s| { "server ${s} iburst\n" }.join(''),
require => Package['chrony'],
notify => Service['chrony'],
}
service { 'chrony':
ensure => running,
enable => true,
}
# SSH: keys only, never a root password
file { '/etc/ssh/sshd_config.d/10-puppet.conf':
ensure => file,
mode => '0644',
content => "PasswordAuthentication no\nPermitRootLogin prohibit-password\nX11Forwarding no\n",
validate_cmd => '/usr/sbin/sshd -t -f %',
notify => Service['ssh'],
}
service { 'ssh':
ensure => running,
enable => true,
}
}
# site-modules/profile/manifests/puppet_agent.pp
class profile::puppet_agent {
# The challenge password is only needed for the first certificate
file { '/etc/puppetlabs/puppet/csr_attributes.yaml':
ensure => absent,
}
service { 'puppet':
ensure => running,
enable => true,
}
}
# site-modules/profile/manifests/nftables.pp
# Default-deny firewall; open ports come from Hiera and add up across levels.
class profile::nftables (
Array[String[1]] $admin_nets,
Array[Integer[1, 65535]] $tcp_ports = [],
) {
package { 'nftables':
ensure => installed,
}
file { '/etc/nftables.conf':
ensure => file,
mode => '0600',
content => epp('profile/nftables.conf.epp', {
'admin_nets' => $admin_nets,
'tcp_ports' => $tcp_ports,
}),
validate_cmd => '/usr/sbin/nft -c -f %',
require => Package['nftables'],
notify => Service['nftables'],
}
service { 'nftables':
ensure => running,
enable => true,
}
}
<%# site-modules/profile/templates/nftables.conf.epp -%>
<%- | Array[String[1]] $admin_nets, Array[Integer] $tcp_ports | -%>
#!/usr/sbin/nft -f
# Managed by Puppet (profile::nftables) - local changes are overwritten
flush ruleset
table inet filter {
chain input {
type filter hook input priority 0; policy drop;
ct state established,related accept
ct state invalid drop
iif lo accept
meta l4proto { icmp, ipv6-icmp } accept
tcp dport 22 ip saddr { <%= $admin_nets.join(', ') %> } accept
<% unless $tcp_ports.empty { -%>
tcp dport { <%= $tcp_ports.join(', ') %> } accept
<% } -%>
}
chain forward { type filter hook forward priority 0; policy drop; }
chain output { type filter hook output priority 0; policy accept; }
}Code language: PHP (php)
# site-modules/profile/manifests/nginx.pp
class profile::nginx (
String[1] $server_name,
String[1] $docroot = '/var/www/html',
) {
package { 'nginx':
ensure => installed,
}
file { '/etc/nginx/sites-available/default':
ensure => file,
content => @("CONF"),
# Managed by Puppet (profile::nginx)
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name ${server_name};
root ${docroot};
server_tokens off;
}
| CONF
require => Package['nginx'],
notify => Service['nginx'],
}
service { 'nginx':
ensure => running,
enable => true,
}
}
Roles
# site-modules/role/manifests/base.pp
class role::base {
include profile::base
include profile::puppet_agent
include profile::nftables
}
# site-modules/role/manifests/webserver.pp
class role::webserver {
include profile::base
include profile::puppet_agent
include profile::nftables
include profile::nginx
}
A role::database looks the same with profile::postgresql instead of profile::nginx. Notice there’s not a single setting in the roles: every value comes from Hiera.
One warning about profile::nftables: its flush ruleset also removes the rules Docker and libvirt create. Leave it out of roles for container and VM hosts, or give those a profile of their own.
8. nodes.pp: deciding what a node is
manifests/nodes.pp is read for every catalog. For each agent, Puppet picks one node block: an exact name first, then the first matching regular expression, otherwise default. Everything that block includes ends up in that node’s catalog.
# manifests/nodes.pp
# Roles a certificate may ask for. Anything else gets the base role.
$allowed_roles = ['base', 'webserver', 'database']
# The normal case: the role comes from the node's certificate (pp_role).
node default {
$role = $trusted['extensions']['pp_role']
if $role =~ String[1] and $role in $allowed_roles {
include "role::${role}"
} else {
include role::base
}
}
# Exceptions by name, for machines enrolled before roles were in their certificate.
node 'legacy-web.mydomain.org' {
include role::webserver
}
node /^db\d+\.mydomain\.org$/ {
include role::database
}Code language: PHP (php)
Some rules that keep nodes.pp from becoming a mess:
- Only roles in node blocks. No resources, no profiles, no variables for other code. If you’re tempted to add something for one node, it belongs in Hiera at the
nodes/level. - Classify by trusted data.
$trusted['certname']and$trusted['extensions']come from the signed certificate; a node can’t change them later.$facts['hostname']is whatever the node reports, so never decide on a role or a secret by a fact. - Explicit names don’t fill the role level in Hiera. The
roles/level below usespp_rolefrom the certificate. Machines classified by name get their data fromnodes/andcommononly, which is one more reason to give new machines app_role.
9. Hiera: where the settings come from
Every class parameter (profile::base::ntp_servers) is looked up in Hiera automatically: you never write lookup() in a role. Hiera searches the levels from top to bottom and, by default, the first level that has the key wins.
# hiera.yaml (in the environment)
---
version: 5
defaults:
datadir: data
data_hash: yaml_data
hierarchy:
- name: "Encrypted secrets"
lookup_key: eyaml_lookup_key
paths:
- "nodes/%{trusted.certname}.eyaml"
- "common.eyaml"
options:
pkcs7_private_key: /etc/puppetlabs/puppet/eyaml/private_key.pkcs7.pem
pkcs7_public_key: /etc/puppetlabs/puppet/eyaml/public_key.pkcs7.pem
- name: "Per node"
path: "nodes/%{trusted.certname}.yaml"
- name: "Per role"
path: "roles/%{trusted.extensions.pp_role}.yaml"
- name: "Per OS version"
path: "os/%{facts.os.name}/%{facts.os.release.major}.yaml"
- name: "Common"
path: "common.yaml"Code language: PHP (php)
The data for the example:
# data/common.yaml
---
profile::base::ntp_servers:
- ntp1.mydomain.org
- ntp2.mydomain.org
profile::nftables::admin_nets:
- 10.0.10.0/24
profile::nftables::tcp_ports: []
lookup_options:
profile::nftables::tcp_ports:
merge: uniqueCode language: PHP (php)
# data/os/Debian/13.yaml
---
profile::base::packages:
- vim
- curl
- htop
- needrestartCode language: PHP (php)
# data/roles/webserver.yaml
---
profile::nftables::tcp_ports:
- 80
- 443
profile::nginx::server_name: www.mydomain.orgCode language: PHP (php)
# data/nodes/web01.mydomain.org.yaml
---
profile::nginx::server_name: intranet.mydomain.org
profile::nftables::tcp_ports:
- 8443Code language: PHP (php)
What web01.mydomain.org (role webserver, Debian 13) gets:
| Parameter | Value | Why |
|---|---|---|
profile::nginx::server_name | intranet.mydomain.org | The node level wins over the role level |
profile::base::packages | vim, curl, htop, needrestart | Only the OS level has it |
profile::base::ntp_servers | ntp1, ntp2 | Only common has it |
profile::nftables::tcp_ports | 8443, 80, 443 | lookup_options says merge: unique, so all levels add up |
That last row is the key to Hiera: by default the most specific level wins, but with lookup_options you can make lists (unique) or hashes (hash or deep) combine across levels. Use it for firewall ports, users and packages; leave single values like a server name on “first wins”.
Ask Hiera directly on the server, to see what a node gets and why:
puppet lookup profile::nftables::tcp_ports --node web01.mydomain.org --explainCode language: CSS (css)
--explain shows every level it searched and what it found. Run it whenever a value isn’t what you expected.
Why the hierarchy uses trusted for nodes and roles. A level built on a fact (like %{facts.networking.fqdn}) would let any machine claim to be another one and receive its data, including secrets. Facts are fine for the OS level: if a machine lies about its Debian version, it only hurts itself.
10. Secrets with hiera-eyaml
Passwords and keys don’t belong in Git in clear text. hiera-eyaml encrypts single values with a key pair; only the Puppet server has the private key, so only it can decrypt. Anyone with the public key (your admins) can add new secrets.
Step 1. Install the backend for the server and the command-line tool:
puppetserver gem install hiera-eyaml
apt install -y hiera-eyaml
Step 2. Create the keys, readable only by the server:
install -d -m 500 -o puppet -g puppet /etc/puppetlabs/puppet/eyaml
cd /etc/puppetlabs/puppet/eyaml
eyaml createkeys --pkcs7-private-key=private_key.pkcs7.pem --pkcs7-public-key=public_key.pkcs7.pem
chown puppet:puppet *.pem
chmod 400 private_key.pkcs7.pem
chmod 444 public_key.pkcs7.pem
systemctl restart puppetserverCode language: PHP (php)
Back up the private key somewhere safe and offline. Without it, every encrypted value in your repository is lost.
Step 3. Encrypt a value. -p asks for it, so it doesn’t end up in your shell history:
eyaml encrypt -p -l profile::postgresql::admin_password \
--pkcs7-public-key=/etc/puppetlabs/puppet/eyaml/public_key.pkcs7.pemCode language: PHP (php)
Paste the output into data/common.eyaml (or a node’s .eyaml file). It looks like this, and it’s safe to commit:
# data/common.eyaml
---
profile::postgresql::admin_password: >
ENC[PKCS7,MIIBiQYJKoZIhvcNAQcDoIIBejCCAXYCAQAxggEhMIIBHQIBADAFMAACAQEw...]Code language: PHP (php)
Declare such parameters as Sensitive[String] in the profile, and tell Hiera to hand the value over as Sensitive, in common.yaml:
lookup_options:
profile::postgresql::admin_password:
convert_to: "Sensitive"Code language: PHP (php)
Puppet then keeps the value out of reports, logs and --noop diffs. Use the value in the profile with $admin_password.unwrap only where it’s really needed, like in a file’s content, and mark that file show_diff => false.
11. Deploy the agent on a client
The client needs a proper FQDN with forward and reverse DNS (otherwise the autosign policy says no), correct time, and access to port 8140 on the server.
Step 1. Install the agent from the same repository:
hostname -f # e.g. web03.mydomain.org, must match DNS
wget -O /tmp/openvox9-release.deb https://apt.voxpupuli.org/openvox9-release-debian13.deb
dpkg -i /tmp/openvox9-release.deb
apt update
apt install -y openvox-agent
source /etc/profile.d/puppet-agent.shCode language: PHP (php)
Step 2. Put the CA certificate in place before the first connection. Otherwise the agent downloads it over a connection it can’t verify yet, and trusts whatever answers on the first try. Copy it from the server through your normal provisioning (or scp as an admin) and compare the fingerprint with the one on the server:
# on the server:
openssl x509 -noout -fingerprint -sha256 -in /etc/puppetlabs/puppet/ssl/certs/ca.pem
# on the client:
install -d -m 755 /etc/puppetlabs/puppet/ssl/certs
install -m 644 ca.pem /etc/puppetlabs/puppet/ssl/certs/ca.pem
openssl x509 -noout -fingerprint -sha256 -in /etc/puppetlabs/puppet/ssl/certs/ca.pemCode language: PHP (php)
Step 3. Point the agent at the server and give it its role and the challenge password. The file is only readable by root and disappears after the first Puppet run:
puppet config set --section main server puppet.mydomain.org
puppet config set --section agent runinterval 30m
install -m 600 /dev/null /etc/puppetlabs/puppet/csr_attributes.yaml
cat > /etc/puppetlabs/puppet/csr_attributes.yaml <<'EOF'
custom_attributes:
1.2.840.113549.1.9.7: "paste-the-autosign-secret"
extension_requests:
pp_role: webserver
EOFCode language: PHP (php)
Step 4. Request the certificate and wait for it. With the policy script, it’s signed within seconds; without autosigning, sign it on the server with puppetserver ca sign --certname web03.mydomain.org:
puppet ssl bootstrap --waitforcert 60
Step 5. First a dry run that shows what would change, then the real run, then the service:
puppet agent -t --noop
puppet agent -t
systemctl enable --now puppet
profile::puppet_agent keeps the service running and removes csr_attributes.yaml from then on.
Rebuilding a machine with the same name: clean its old certificate on the server first (puppetserver ca clean --certname web03.mydomain.org), or the new CSR is refused because a certificate for that name already exists.
12. Daily work: testing, certificates, backups
Before you push code, check it. These run on any machine with the agent installed:
puppet parser validate site-modules/ manifests/
puppet epp validate site-modules/profile/templates/
Test a change on one machine first: a Git branch becomes its own environment with r10k, and puppet agent -t --noop --environment my_branch shows what it would do on that machine without touching it.
Certificates.
puppetserver ca list # waiting requests
puppetserver ca list --all # everything signed
puppetserver ca clean --certname old01.mydomain.org # decommissioned: revoke and deleteCode language: PHP (php)
Clean a certificate the day a machine is decommissioned. A certificate that’s still valid can still fetch that machine’s catalog, including its secrets.
Backups. Three things you can’t recreate:
/etc/puppetlabs/puppetserver/ca: the CA. If you lose it, every agent needs a new certificate./etc/puppetlabs/puppet/eyaml: the eyaml keys. If you lose them, every secret in Git is lost./etc/puppetlabs/puppet/autosign.secretandpuppet.conf
The code itself is in Git. Copy these three off the server, encrypted, after every change and at least weekly.
Reports pile up under /opt/puppetlabs/server/data/puppetserver/reports. A daily cleanup keeps two weeks:
find /opt/puppetlabs/server/data/puppetserver/reports -type f -name '*.yaml' -mtime +14 -deleteCode language: JavaScript (javascript)
13. Troubleshooting
| Symptom | Cause and fix |
|---|---|
Agent: certificate verify failed on the first run | The pre-placed ca.pem isn’t from this server, or the agent connects by a name that isn’t in the server’s dns_alt_names. |
| Agent waits forever for its certificate | The policy said no. journalctl -t puppet-autosign on the server tells you which check failed. |
REJECTED: reverse DNS ... | The PTR record is missing or points to another name. Fix DNS. The policy only looks at a request once, so then either sign it by hand, or remove the request (below) and let the agent send a new one. |
REJECTED: wrong or missing challenge password | csr_attributes.yaml was missing or wrong when the request was made. Remove the request (below), fix the file, and request again. |
| Removing a rejected request | On the server: delete /etc/puppetlabs/puppetserver/ca/requests/<certname>.pem. On the agent: puppet ssl clean, then puppet ssl bootstrap --waitforcert 60. |
Server: certificate ... already exists | A machine was rebuilt with the same name. puppetserver ca clean --certname it. |
Evaluation Error: Unknown variable | strict_variables caught a typo or a missing fact. Fix the code; this setting is doing its job. |
Class[Profile::Base]: expects a value for parameter 'ntp_servers' | The key isn’t in Hiera at any level for this node. puppet lookup ... --explain. |
| A value from the role level is ignored | The node has no pp_role in its certificate (classified by name), so the roles/ level doesn’t exist for it. |
eyaml_lookup_key errors | hiera-eyaml isn’t installed in the server (puppetserver gem list), or the key paths or permissions are wrong. |
| Every agent run is slow | Too little JVM memory for the number of agents, or a huge Puppetfile. Raise -Xmx, watch journalctl -u puppetserver. |
14. Checklist
- ☐ Server FQDN with forward and reverse DNS, time in sync
- ☐ OpenVox 9 from apt.voxpupuli.org; Java 21
- ☐
certnameanddns_alt_namesset beforepuppetserver ca setup - ☐
allow-subject-alt-namesandallow-authorization-extensionsfalse - ☐ TLS 1.2+ only; nftables: 8140 from agent networks, 22 from admins
- ☐
strict_variablesandstrict = error - ☐ Autosign policy: domain, IP range, reverse DNS, challenge password; secret root:puppet 640
- ☐ Control repository in Git; roles only include profiles; one role per node
- ☐
nodes.ppclassifies by$trusted, never by facts - ☐ Hiera levels for nodes and roles use
trusted;lookup_optionsfor lists that add up - ☐ Secrets only as eyaml, parameters typed
Sensitive; private key backed up offline - ☐ Agents: CA pre-placed,
csr_attributes.yamlremoved after signing - ☐ Decommissioned machines cleaned from the CA
- ☐ CA, eyaml keys and autosign secret backed up off the server