/devops-skills:vps-forgefrom devops-skills
Set up, harden, audit and polish a Linux VPS (Debian/Ubuntu) to production grade without ever losing access — SSH keys and crypto, firewall, fail2ban/CrowdSec, automatic security updates, kernel hardening, Docker, Caddy/nginx with TLS, WireGuard/Tailscale, restic backups, phone alerts, monitoring and a final verified score. Use this skill whenever the user mentions a VPS, VDS, cloud server, droplet, Hetzner/DigitalOcean/Vultr/Linode/OVH/Oracle Cloud/AWS EC2 or Lightsail box (x86 or ARM), a "fresh server", "secure/harden/lock down my server", SSH hardening, ufw, fail2ban, "set up Docker/Caddy/nginx on my server", preparing a server for Coolify, Dokploy, CapRover or Kamal, server backups or monitoring, or asks to audit or check an existing server — even if they don't say "harden". Not for RHEL/Fedora-family servers, Kubernetes nodes (k3s, kubeadm), Proxmox or other hypervisor hosts, managed or shared hosting without root, or the user's own desktop.
Ships in devops-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Take a fresh or existing Debian/Ubuntu VPS to a state the user will be proud of: locked down, observable, backed up, documented, reproducible and pleasant to live on. Do it with a safety net under every risky step, so access to the server is never lost.
Speak the user's language. Before every change, say in one line what you are changing and why. When the user asks "why?", answer properly: the reasoning matters more than the command.
These exist because one wrong sshd or ufw change can make a server unreachable, and the user may have no idea how to use the provider's rescue console.
scripts/deadman.sh arm → change → validate → test from a new, unmultiplexed connection → disarm. If the new connection fails, do nothing and let the timer roll back (default 5 min). Arm longer (arm 10) when the change needs several edits or a package install, and if it runs late, vps-forge-deadman extend <min> moves the rollback while the snapshot stays the same. Never extend after a failed test login.
ssh host reuses the live ControlMaster, which never touches the new sshd, port or firewall. Always test with -o ControlPath=none.ssh -o ControlPath=none -o BatchMode=yes -p <port> <admin>@<host> 'sudo -n vps-forge-deadman disarm'. Under password sudo, sudo -n -v must fail with a password is required, and you disarm from the root session (ssh.md "Test and disarm").limit, and a ban on the admin's IP looks exactly like a lockout. The admin's IP goes on every exemption list before anything can count it: fail2ban's ignoreip, a ufw allow rule ahead of limit, and sshd's PerSourcePenaltyExemptList (firewall.md, ssh.md).
$(sudo vps-forge-deadman client-ip), because $SSH_CLIENT is empty under sudo. Stop if it's empty or not an IP. If you aren't on the user's own machine (cloud sandbox, CI), it's your IP: mark every entry (ufw, ignoreip, sshd's exempt list) agent session <date>, ask for the user's real IP or range, and remove your entries in phase 12.ignoreip before fail2ban can first start. Debian 13 and Ubuntu 24.04 start it on install, and on start it re-reads recent journal lines, so your earlier test logins ban the user at once. So: systemctl mask fail2ban and write the jail before the phase-2 install, then unmask and enable it in phase 5 (base.md). A runtime addignoreip is lost on every restart, and the deadman can't undo a ban (firewall.md).references/audit-mode.md).etckeeper early so /etc is under git with an auto-commit per change, and commit after each phase with a message (etckeeper commit "vps-forge: ssh hardening"). Prefer drop-in files over editing main configs./etc/os-release, ssh -V, ssh -Q kex and systemd-detect-virt, and read references/distro-notes.md when anything is unusual.authorized_keys, /etc/ld.so.preload, miners, curl | sh cron entries: stop hardening and follow the compromise section of references/audit-mode.md. You can't harden your way out of a breach.Pick the mode from what you can actually do in this session:
| Mode | When | How |
|---|---|---|
| Direct | You have a shell that can ssh to the server | Run commands over SSH with multiplexing (below). This is the best mode. |
| Script | No SSH access from here (a chat app) | Recon first, then one small script per stage that the user runs and pastes back; every risky step pauses for a test login from the user's second terminal. Follow references/script-mode.md. |
| Audit | The user wants a check, not changes, or the server is already in production | Run scripts/audit.sh read-only, then produce the findings report. Change nothing until asked. |
Direct-mode mechanics
limit won't throttle you: -o ControlMaster=auto -o ControlPath=~/.ssh/cm-%r@%h:%p -o ControlPersist=10m. The master outlives sshd and ufw changes, so it never counts as a login test; that always takes -o ControlPath=none (rule 1).export DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a and apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold. Use adduser --disabled-password --gecos "". Don't use dpkg-reconfigure; write the config files directly.ssh host 'sudo bash -s -- --flags' < scripts/audit.sh. Install the helpers that must stay on the server (deadman, alerts) into /usr/local/sbin/ with install -m 755.sshd -t, visudo -cf, nft -c -f, caddy validate, nginx -t, python3 -m json.tool).You need four answers before starting. Infer whatever you can from the conversation and from the server itself.
web, docker, vpn, db, worker (bots, cron jobs, outbound only), game. Profiles combine. For docker or web, ask whether a deploy panel or tool (Coolify, Dokploy, CapRover, Kamal, Dokku) runs or will run here: it changes root login, the proxy and the firewall (paas.md).
Restart=on-failure, keep its secrets in a 600 env file, and cap its logs.ufw allow <port>/udp comment '<game>'). Run the server as a dedicated non-root user under systemd, and back up its world directory.baseline, hardened (recommend this by default), or paranoid. Explain the difference in one sentence each (see §5).ssh-keygen -t ed25519 locally; FIDO2 is -t ed25519-sk if they own a hardware key.Choose the mode and follow the companion skill routing in §9 before any live workflow; its scope and authorization boundaries govern the generic workflow and done criteria below.
Match the work to the request.
hardened by default.Create a task list from the phases below, trimmed to the chosen profile and level. Show the user a short plan, then go. After each phase, append a line to /var/lib/vps-forge/progress.log (date phase=ssh status=done) and commit with etckeeper, so an interrupted run can resume where it stopped.
| # | Phase | Read | Key outcome |
|---|---|---|---|
| 0 | Recon | scripts/audit.sh | Facts, a baseline score, and red flags spotted before any change. Stop on a Kubernetes node, a hypervisor host or a non-Debian/Ubuntu system (distro-notes.md). Coolify, Dokploy, CapRover, Kamal or Dokku found or planned: read references/paas.md before phase 3 |
| 1 | Safety net | references/base.md §Safety net | Provider snapshot, console known, etckeeper on, deadman installed |
| 2 | Base system | references/base.md | Non-interactive full upgrade, unattended security updates, time sync, swap, journald limits, hostname that survives reboots |
| 3 | Admin user & SSH | references/ssh.md | Admin user with a key, sudo policy chosen, root login and passwords off, modern crypto, verified from a new session |
| 4 | Firewall | references/firewall.md | Default deny, only explained ports open, IPv6 matched, Docker gap closed, provider firewall considered |
| 5 | Brute-force defence | references/firewall.md §fail2ban | fail2ban unmasked and started with the systemd backend (or CrowdSec), detection and ban action proven |
| 6 | Kernel & OS hardening | references/kernel.md | sysctl set, AppArmor on, unused services off, BBR |
| 7 | Workload | references/docker.md, web.md, vpn.md, databases.md | Per profile |
| 8 | Backups | references/backups.md | restic on a timer, dumps first, protected against deletion, restore tested |
| 9 | Alerts & monitoring | references/alerts-monitoring.md | Phone alerts, heartbeat, external uptime check |
| 10 | Comfort | references/comfort.md | Status motd, sane shell, useful tools |
| 11 | Verify | scripts/audit.sh, scripts/external-check.sh, base.md §Reboot drill | Score before → after, external scan clean, every listening port explained, reboot drill passed (with the user's OK) |
| 12 | Document & hand off | assets/SERVER.md, references/reproducibility.md, ssh.md §Hand-off cleanup | /root/SERVER.md and the final report, agent-session entries and the temporary sudo grant removed; offer the cloud-init/Ansible export, and build it only if the user wants it |
Do the alerts phase near the end. Otherwise the SSH-login alert fires for every connection you make during setup.
Keep it fast without skipping safety:
apt-get install in phase 2 (base.md).Never merge deadman windows across unrelated changes: when a combined change fails, you can't tell which part broke.
| baseline | hardened (default) | paranoid | |
|---|---|---|---|
| SSH | keys only, no root, AllowGroups, MaxAuthTries 5 | + modern KEX/ciphers/MACs, ed25519 host key only, ssh-audit clean | + FIDO2 keys or TOTP, SSH reachable only via WireGuard/Tailscale |
| Firewall | ufw default deny, needed ports only | + IPv6 parity, Docker DOCKER-USER rules, provider firewall as a second layer | + Cloudflare-only 80/443 or Cloudflare Tunnel, egress review |
| Intrusion | fail2ban sshd, incremental bans | + recidive jail (SSH port, 1 day) | CrowdSec with a firewall bouncer |
| Updates | unattended security updates | + needrestart auto, Livepatch (Ubuntu Pro) where supported | + scheduled auto-reboot window |
| OS | sysctl baseline, swap, journald cap | + etckeeper, AppArmor check, BBR, unused services off | + auditd, AIDE, /dev/shm noexec, core dumps off |
| Backups | restic daily + tested restore | + versioned or append-only repo, weekly restic check | + second off-site repo, quarterly restore drill |
| Alerts | external uptime check | + phone alerts: SSH login, failed units, disk, reboot needed; backup heartbeat | + fail2ban/CrowdSec digest |
| Proof | final audit | + Lynis, ssh-audit, testssl/securityheaders | + all of it, scores recorded in SERVER.md |
A level is a starting point. If the user wants "hardened, but keep password sudo", do exactly that.
Don't call the server done until every applicable item is true and you have shown the evidence:
ssh root@host and password login are rejected (shown by external-check.sh --root-test, run after whitelisting the user's IP in fail2ban: every probe counts as a failed login)sshd -T shows the intended values; nothing in sshd_config.d/ overrides themss -tulpn and in docker ps is listed in SERVER.md with a reasonunattended-upgrade --dry-run runs without errorsaudit.sh has no FAIL; the score before → after is reported/root/SERVER.md is written and the user has a local copy; etckeeper holds the full historyEnd with a short message in the user's language:
ssh <admin>@<host> -p <port>, the ~/.ssh/config block with IdentitiesOnly yes (ssh.md), and where the provider console is.Offer the export from references/reproducibility.md (cloud-init or Ansible) so the next server comes out identical.
Read only what the current phase needs.
references/base.md: packages, non-interactive apt, unattended-upgrades, needrestart, time, swap/zram, journald, hostname vs cloud-init, Ubuntu Pro/Livepatch, etckeeper, safety netreferences/ssh.md: admin user, sudo policy, the drop-in ordering trap, crypto, port change with socket activation, FIDO2/TOTP, cleanup of provider keysreferences/firewall.md: ufw, IPv6, Cloudflare allowlists, Docker vs ufw, provider firewalls, fail2ban, CrowdSecreferences/kernel.md: sysctl (and when not to), AppArmor, services, BBR, paranoid extrasreferences/docker.md, references/web.md, references/vpn.md, references/databases.md: workload profilesreferences/paas.md: Coolify, Dokploy, CapRover, Kamal and Dokku: root key login, the panel's own SSH, its proxy and dashboard ports, what to back upreferences/backups.md: restic, DB dumps, deletion-resistant repos, restore drillsreferences/alerts-monitoring.md: phone alerts, heartbeats, uptime checks, metricsreferences/comfort.md: motd, shell, toolsreferences/audit-mode.md: read-only audits, severity rubric, findings format, compromise responsereferences/reproducibility.md: SERVER.md, cloud-init and Ansible exportreferences/distro-notes.md: Ubuntu 22.04/24.04, Debian 12/13 differences, containers (OpenVZ/LXC), ARMreferences/script-mode.md: no SSH from here: recon, stage scripts, the test-and-disarm pausereferences/troubleshooting.md: locked out, cloud-init overrides, fail2ban won't start, Docker ignores ufw, and moreGigma marketplace adaptation: This section defines local Codex routing and authorization boundaries.
vps-forge is the safety orchestrator for server changes. At the matching workflow phase, explicitly read the selected companion's SKILL.md from the active skill catalogue; otherwise read ../<skill-name>/SKILL.md relative to the vps-forge folder. Load only relevant skills and references. Resolve companion referrals such as Skill(devops-skills:terraform-validator) to the local companion's SKILL.md, and repo-style or hardcoded donor skill-root paths for scripts and references to the matching installed companion directory; do not replace paths in user project artifacts. Reuse loaded instructions and results for unchanged artifacts; rerun affected validation after changes, without recursive or duplicate delegation.
Choose scope before any live workflow: plan-only means a plan in chat, with no generators, executable artifact writes, SSH or audit scripts; artifact-only means the authorized local artifact and its validation, without host phases, probes or live calls; audit means only permitted read-only targets and commands, without mutation. These mode and authorization boundaries override broader generic workflow, done criteria and probe wording. In every mode inspect companion commands and nested commands for side effects before running them: generators or validators may bootstrap, Ansible checks may use SSH, Helm or kubectl dry-runs may contact a cluster, and Terraform init or plan may contact a backend or provider.
Companion rules cannot relax Art's server permissions: show the exact proposed server changes, commands and effects and obtain current explicit approval before any server write; an offline request or delegated decision is not approval. For this Codex integration, these authorization rules take precedence over broader offline-approval wording in §1, §4 and the references. Use only the approved named user and key, with no root fallback or key guessing; do not run root-rejection or other-account probes without explicit authorization for those tests. Apply the relevant recon, snapshot and console checks, dead-man window, validation, new-login test and hand-off cleanup to each authorized change.
For an audit-only request, select validators and read-only commands only; inspect the commands before running a companion validator because it may bootstrap tools or auto-fix files. Do not generate or fix artifacts, bootstrap, install, or run live probes without authorization. Validate an existing artifact without requiring its generator; use a generator only when creation or modification is requested. Artifact generation does not authorize SSH, deploy or Terraform apply.
Route work as follows:
| Request or artifact | Companion skill | Boundary |
|---|---|---|
| Ansible playbook, role, inventory or reproducibility export | ansible-generator → ansible-validator | Generate and validate the artifact; apply it to a server only through the active vps-forge safety gates |
| Bash helper or server script | bash-script-generator → bash-script-validator | Validate shell locally before sending it; keep server-side changes idempotent and reversible |
| Dockerfile or image build | dockerfile-generator → dockerfile-validator | Do not expose a container port publicly without checking the Docker/UFW and DOCKER-USER rules in references/docker.md and references/firewall.md |
| GitHub Actions workflow | github-actions-generator → github-actions-validator | CI may build or deploy, but it does not authorize a production change; keep deploy approval outside the workflow |
| GitLab CI, Azure Pipelines, Jenkinsfile or Makefile | gitlab-ci-generator/gitlab-ci-validator, azure-pipelines-generator/azure-pipelines-validator, jenkinsfile-generator/jenkinsfile-validator, makefile-generator/makefile-validator | Use only when the project uses that toolchain; keep production approval and server safety gates in vps-forge |
| Terraform or Terragrunt configuration | terraform-generator → terraform-validator, or terragrunt-generator → terragrunt-validator | Do not infer live state from configuration alone; review the plan and obtain explicit approval before apply |
| Prometheus, Loki, LogQL or Fluent Bit monitoring | promql-generator/promql-validator, loki-config-generator, logql-generator, fluentbit-generator/fluentbit-validator | Bind admin and metrics endpoints to localhost or the VPN unless the user explicitly approves public access; propose external checks and alert tests in the plan, and execute them only within separately authorized scope |
| Kubernetes or Helm workload | k8s-yaml-generator → k8s-yaml-validator, helm-generator → helm-validator, k8s-debug | Hand off workload-only tasks to the relevant skill; skip the normal VPS host-hardening flow for Kubernetes nodes |
If a mandatory companion or check is unavailable or blocked, mark the dependent mutation blocked; continue only authorized read-only analysis and drafts. Never report a skipped check as passed. When generation is requested, validate the resulting artifact, then return to the vps-forge phase that owns any separately authorized live change.
Scripts (all idempotent; --help on each):
scripts/audit.sh: read-only audit with PASS/WARN/FAIL, a score and optional --json; exits 1 on any FAIL. Used in phase 0 and phase 11.scripts/deadman.sh: arm [minutes] [--ip addr] / extend <minutes> / disarm / status / restore / client-ip (the calling SSH client's address, also under sudo). Snapshots SSH, firewall and sudoers config and rolls back automatically unless disarmed, also after a reboot. The rollback unbans the arming SSH client (or --ip) in fail2ban. disarm exits 3 with ROLLED BACK when the rollback already ran: the change was not kept.scripts/external-check.sh: runs on the user's machine. Checks open ports, offered SSH auth methods, admin login, TLS and headers for a domain; --root-test and --ssh-audit are opt-in because they add failed logins. They are harmless when the user's IP is in fail2ban's ignoreip (firewall.md); if it isn't, add it first.scripts/install-alerts.sh: installs vps-notify (ntfy/Telegram/webhook), SSH-login alerts, and a 5-minute health timer (failed units, disk, inodes, reboot-required, heartbeat).Assets: config templates in assets/ (sshd, sysctl, fail2ban, unattended-upgrades, needrestart, journald, docker, Caddyfile, restic units, motd, SERVER.md, cloud-init). Copy a template, fill in the <placeholders>, then validate it.
assets/SERVER.md (opens in a new tab)assets/alerts/notify.env.example (opens in a new tab)assets/apt/20auto-upgrades (opens in a new tab)assets/apt/52vps-forge-unattended (opens in a new tab)assets/caddy/Caddyfile (opens in a new tab)assets/cloud-init.yaml (opens in a new tab)assets/docker/daemon.json (opens in a new tab)assets/fail2ban/vps-forge.local (opens in a new tab)assets/firewall/ufw-cloudflare-sync.service (opens in a new tab)assets/firewall/ufw-cloudflare-sync.sh (opens in a new tab)assets/firewall/ufw-cloudflare-sync.timer (opens in a new tab)assets/journald/10-vps-forge.conf (opens in a new tab)assets/motd/60-vps-forge (opens in a new tab)assets/needrestart/50-vps-forge.conf (opens in a new tab)assets/restic/env.example (opens in a new tab)assets/restic/exclude (opens in a new tab)assets/restic/include (opens in a new tab)assets/restic/vps-forge-backup-maint.service (opens in a new tab)assets/restic/vps-forge-backup-maint.timer (opens in a new tab)assets/restic/vps-forge-backup.service (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub artypoul/gigma_skills --plugin devops-skills32 skills in this plugin
/ansible-generatorGenerate, create, or scaffold Ansible playbooks, roles, tasks, handlers, inventory, vars./ansible-validatorValidate, lint, audit, or debug Ansible playbooks, roles, inventories, FQCN, tasks./azure-pipelines-generatorGenerate/create/scaffold azure-pipelines.yml, stages, jobs, steps, or reusable templates.Other plugins' skills for the same job
/azure-pipelines-validatorValidate, lint, audit, or review azure-pipelines.yml — syntax, security, best practices.