SSH Certificate Authority (CA) Setup & Rotation Prompt
Stand up an SSH CA to replace sprawling authorized_keys with short-lived, principal-scoped certificates for both host and user authentication.
- Target user
- Platform/security engineers managing SSH at scale
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform security engineer who deploys SSH certificate authorities for fleet authentication. I will provide: - The current SSH access model (authorized_keys sprawl, jump hosts, number of servers/users) - Constraints (offline CA, short TTLs, principals/roles, host-key trust, HSM/Vault availability) - Existing sshd_config and any current CA setup Your job: 1. **Separate the two CAs** — explain user-CA (signs user keys, trusted via TrustedUserCAKeys) vs host-CA (signs host keys, trusted via @cert-authority in known_hosts). 2. **Generate and protect the CA** — show `ssh-keygen` to create CA keys and recommend keeping the private CA key offline or in Vault/an HSM. 3. **Sign certificates** — give `ssh-keygen -s` examples with -I (key id), -n (principals), -V (validity window), and -O options (force-command, source-address) for least privilege. 4. **Configure servers** — set TrustedUserCAKeys and AuthorizedPrincipalsFile in sshd_config; configure clients to trust the host-CA. 5. **Enforce short TTLs** — design issuance so certs expire in hours/days, removing the need for revocation in most cases. 6. **Plan revocation** — set up a KRL (`ssh-keygen -k`) and RevokedKeys for the exceptions. 7. **Roll out safely** — keep key-based auth as a fallback until cert auth is verified, then tighten. Output as: (a) architecture, (b) exact ssh-keygen/sshd_config snippets, (c) issuance workflow, (d) rollback/fallback plan. Validate cert auth on one host with a fallback login open before disabling password/authorized_keys access fleet-wide.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
SELinux Denial Troubleshooting & Policy Review Prompt
Diagnose SELinux AVC denials and produce a least-privilege fix (correct file contexts, booleans, or a minimal custom module) instead of disabling enforcement, with audit2allow used as a guide rather than a rubber stamp.
-
SSH Client Config, Jump Host & Multiplexing Review Prompt
Review and refactor an SSH client configuration (~/.ssh/config) for clean ProxyJump bastion chains, connection multiplexing, key/agent hygiene, and host-key safety across many target hosts.
-
sudoers Policy Authoring & Validation Prompt
Write least-privilege sudoers rules with command aliases, NOPASSWD scoping, and Defaults that pass visudo and resist privilege-escalation tricks.
-
fail2ban Brute-Force Protection Setup Prompt
Design and tune fail2ban jails to block SSH and service brute-force attacks without locking out legitimate users, coordinating with nftables/firewalld.
More Linux Admins prompts & error guides
Browse every Linux Admins prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.