Securing Puppet Itself: Server, CA, Access Control, Code Review and Supply Chain

Puppet Training Course 22 min min read Updated: Nov 17, 2026 Advanced
Securing Puppet Itself: Server, CA, Access Control, Code Review and Supply Chain
Advanced Topic 2 of 2

The Puppet Server Is a Powerful Target

Puppet runs as root on every node. Whoever controls the Puppet code or the Puppet server can run commands as root on all servers. So protect it like your most sensitive system.

AssetWhat an attacker gains
CA private keyCan create valid certificates and impersonate any node or server
Puppet code repositoryCan change what runs as root everywhere
Puppet Server hostCan read all data in Hiera, decrypt eyaml, change catalogs
r10k or CI credentialsCan deploy any code to production
PuppetDBReads facts, inventory and report data about the whole estate

1. Harden the Server Host

  • Run only Puppet Server and its dependencies on that machine
  • Keep the OS patched and use the same hardening profile you apply to others
  • Limit SSH access to a few administrators, using keys and MFA or a bastion
  • Enable disk encryption, because the CA key and eyaml keys are on disk
  • Allow network access to port 8140 only from your server networks, and port 8081 (PuppetDB) only from the Puppet servers
  • Keep Puppet Server and its Java runtime on supported, updated versions
bash sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="8140" protocol="tcp" accept' sudo firewall-cmd --reload sudo ls -ld /etc/puppetlabs/puppetserver/ca /etc/puppetlabs/puppet/ssl/private_keys sudo ls -l /etc/puppetlabs/puppetserver/ca/ca_key.pem # should be readable only by the puppet user

2. Protect the CA

  • Back up the CA directory (/etc/puppetlabs/puppetserver/ca) encrypted and offline
  • Use an intermediate CA signed by a corporate root so you can replace the Puppet CA if needed (puppetserver ca import)
  • Do not use autosign = true. Use policy-based autosign with a secret
  • Revoke certificates of decommissioned or compromised nodes: puppetserver ca revoke
  • Watch for unexpected certificate requests

3. Access Control: auth.conf

Puppet Server decides who may call each API using **auth.conf** rules. The defaults are safe. Be careful if you widen them, for example to allow remote catalog compile or CA operations.

text # /etc/puppetlabs/puppetserver/conf.d/auth.conf (excerpt, HOCON) authorization: { version: 1 rules: [ { # Allow nodes to retrieve only their own catalog match-request: { path: "^/puppet/v3/catalog/([^/]+)$" type: regex method: [get, post] } allow: "$1" sort-order: 500 name: "puppetlabs v3 catalog from agents" }, { # Deny everything not allowed above match-request: { path: "/", type: path } deny: "*" sort-order: 999 name: "puppetlabs deny all" } ] }

The line allow: "$1" means a node can fetch only the catalog with its own name. This stops one compromised node from reading another node's catalog (and the data in it).

4. Trust the Certificate, Not the Fact

  • Use $trusted['certname'] and $trusted['extensions'] for security decisions, not self-reported facts like $facts['hostname']
  • Do not put secrets in catalogs that go to nodes that should not see them. Remember that everything compiled into a node's catalog is readable by that node (and its root user)
  • Use per-environment and per-role data so a web server cannot get database passwords
puppet # BAD: relies on a fact the node itself reports if $facts['role'] == 'database' { include profile::db_secrets } # GOOD: relies on the certificate, set when the CSR was approved if $trusted['extensions']['pp_role'] == 'database' { include profile::db_secrets }

5. Protect the Code Supply Chain

RiskControl
Someone pushes bad code to productionProtected branches, required pull request reviews, at least one reviewer, status checks (lint, tests, noop diff)
Stolen developer accountMFA on Git, signed commits or tags, short-lived tokens
Malicious or broken Forge module updatePin exact versions in the Puppetfile, review changes on upgrade, prefer Supported and Approved modules and trusted maintainers
Typosquatted module nameCheck the author prefix and download counts, copy names from official docs
Secrets committed to GitPre-commit and CI secret scanning (gitleaks, trufflehog), use eyaml or a vault
CI/CD system compromiseLeast-privilege deploy tokens, separate deploy credentials per environment, audit logs
Unreviewed exec or shell codeReview rules: any exec, curl | sh, or download resource needs a checksum and a reason
yaml # .gitlab-ci.yml / similar: stop obvious secrets secrets_scan: image: zricethezav/gitleaks:latest script: - gitleaks detect --source . --verbose rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event"
bash # Download checks inside modules: always set a checksum archive { '/tmp/tool.tgz': source => 'https://example.com/tool.tgz', checksum => 'REAL_SHA256_VALUE', checksum_type => 'sha256', }

6. Least Privilege on Agents

  • Do not run the agent as a normal user unless needed. It needs root to change the system
  • Do not give application teams permission to edit production directly. Let them submit pull requests
  • For tasks that need broad rights, use Bolt with sudo rules and an audit log
  • Keep agent data readable only by root (/etc/puppetlabs/puppet/ssl/private_keys)

7. Logging and Detection

  • Ship puppetserver.log and the access log to your log system
  • Alert on: new certificate requests, ca revoke/sign actions, changes in auth.conf, many failed catalog requests, a node requesting another node's catalog
  • Watch corrective changes in reports. They show manual tampering
  • Alert if a node has not reported for many intervals

8. Backup and Recovery

bash # What to back up (encrypted, off the server) /etc/puppetlabs/puppetserver/ca/ # CA keys and signed certificates (very sensitive) /etc/puppetlabs/puppet/eyaml/ # eyaml keys /etc/puppetlabs/puppet/puppet.conf /etc/puppetlabs/puppetserver/conf.d/ PuppetDB PostgreSQL database # pg_dump -Fc puppetdb > puppetdb.dump Git control repository # already versioned, but also mirror it

Write down and test a rebuild procedure: new server, restore CA and keys, deploy code with r10k, agents reconnect. Practise it before you need it.

9. If You Suspect a Compromise

  1. Isolate the Puppet server from the network if it is affected, and alert your security team
  2. Disable Puppet agent runs on affected nodes: puppet agent --disable 'incident' (via Bolt or SSH)
  3. Review recent Git commits, deploy logs and CI jobs for unexpected changes
  4. Revoke affected certificates and rotate the CA if its key may have leaked
  5. Rotate all secrets stored in Hiera, eyaml keys, and credentials used by Puppet
  6. Rebuild the server from a clean image and restore from known good backups
  7. Re-enable agents in waves after verification

Security Checklist

ItemDone?
Policy autosign (not true)
Branch protection and reviews on the control repo
Exact version pins for all modules
Secrets in eyaml or vault, none in plain text
Port 8140 limited by firewall
CA and eyaml keys backed up encrypted offline
Decommissioning removes certificates
Server log monitoring and alerts
Regular patching of server, PuppetDB and Java
Rebuild procedure tested

Practice Tasks

  1. Limit port 8140 in your lab firewall to the agent network and test an agent outside it
  2. Review your auth.conf and explain what one rule does
  3. Add branch protection and a required review to your lab Git repository
  4. Add a secret scanning job to your CI pipeline and test it with a fake password
  5. Write a one-page recovery plan for a lost Puppet server

Conclusion

The Puppet server and repository are root-level control points. Protect the CA, limit network access, review all code, pin modules, keep secrets encrypted, trust certificates for decisions, and rehearse backup and recovery.

Quick Summary: protect CA key; policy autosign; auth.conf node-only catalog; branch protection; pin modules; trusted facts; backup + recovery plan.

Get Newsletter

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