nftables Kill-Switch-First Enforcement Rollout

    1

    This kit is the ownership boundary, the off switch, the preflight and the rollout order that make host enforcement safe to turn on.

    $29

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    nftables Kill-Switch-First Enforcement Rollout

    Example session with this skill installed

    We are about to let our intrusion-response agent start banning IPs with nftables on three Ubuntu servers that already run fail2ban. Our admins come from 203.0.113.0/24 and SSH is on port 2222. Set this up so we cannot lock ourselves out.

    • Read your context and instructions
    • Compiled the nftables kill-switch-first enforcement

    Summary

    Owned table rendered, kill switch tested, preflight run on all three hosts: two pass, one must not enable yet.

    What I did

    1. owned_table.py render --config guard.json with trusted 203.0.113.0/24, management port 2222, response ports 22, 80, 443. nft -c -f guard.nft accepted it on each host.
    2. Loaded the table by hand, ran killswitch.sh --table guard --stop-file /run/responder/STOP, confirmed nft list table inet guard fails and fail2ban's tables are still listed. Filled in the runbook card.
    3. rollout-check.sh --admin-cidr 203.0.113.0/24 --management-port 2222 --ruleset guard.nft from your SSH session on each host.

    Results

    • web-1, web-2: all PASS; WARN only that STOP is absent (created it).
    • db-1: FAIL, your current source 198.51.100.7 is not inside 203.0.113.0/24. You are coming through the VPN exit, which is not in the allowlist. Add 198.51.100.0/28 to trusted or connect from the admin network before enabling anything there.

    Next

    Start the responder monitor-only on web-1 and web-2 for a full week of deploys and backups, then enable one category to ban, leaving fail2ban running.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    A process that can add firewall rules can lock you out, leave permanent bans when it dies, and flush rules it does not own. This kit is the ownership boundary, the off switch, the preflight and the rollout order that make host enforcement safe to turn on.

    owned_table.py renders the one table the responder may own: inet <name> with interval sets for trusted IPv4 and IPv6 networks, timed sets for management leases, bans and throttles, and an input chain at priority -20 whose first verdicts return loopback, trusted and leased traffic before any drop; bans and throttles are exact addresses with kernel timeouts scoped to the ports you name; throttles use a per-source meter. It refuses a trusted source in a deny set, a source both banned and throttled, a lease inside the allowlist, and non-unicast addresses. Check the output with nft -c -f.

    killswitch.sh creates the STOP file atomically (temp file, fsync, rename), deletes only the owned table, verifies it is gone and lists the tables that remain; it refuses symlinked or non-regular STOP paths and never issues nft flush ruleset. --dry-run prints the plan; --status reports STOP and table state.

    rollout-check.sh: read-only preflight that fails on nft missing or older than 0.9.7, your current SSH source outside the admin allowlist, a management port with no listener, an owned table lacking the trusted-return rule, a ruleset with a global flush, or nft -c rejecting it; warns on an absent STOP file and on fail2ban state.

    Reference: the rollout order (boundary, kill switch first, preflight, monitor-only, narrow enable with all gates at once, fail2ban coexistence, rollback order) and a printable runbook card with the emergency sequence for a provider console.

    6 tests (renderer rules and refusals, CLI, shell syntax, dry runs). POSIX sh and Python 3.9+ stdlib, no network.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for DevOps & Cloud.

    The user must provide the detection/decision agent. Preflight source checks require SSH_CONNECTION env var. Requires nftables 0.9.7+ for typed sets.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 18 days ago

    Software
    nft python3 sh

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    The renderer writes one ruleset file. The kill switch (root) creates a STOP file and deletes only the named nftables table. The preflight reads nft, ss and fail2ban state. No network, no environment variables beyond SSH_CONNECTION for the source-address check.

    Listed18 days ago

    What's inside

    Frequently Asked Questions

    This kit prevents accidental lockouts by enforcing 'table ownership,' meaning the responder only manages its own dedicated nftables table and never touches your global firewall rules or existing SSH configurations.

    Yes, it is designed to run alongside tools like fail2ban or firewalld by using specific nftables namespaces, ensuring your different security layers don't overwrite or conflict with each other.

    The purchase includes the Python-based ruleset renderer, the preflight validation suite, the atomic kill switch shell scripts, and a structured deployment guide for the rollout stages.

    You need a Linux system with nftables 0.9.7+, Python 3.9+ for the configuration logic, and standard POSIX shell support for the emergency kill switch scripts.

    The kit provides the 'safety cage' and enforcement logic (the firewall rules and emergency stops), but you must provide the specific detection logic or AI agent that decides which IPs need to be banned.

    New in DevOps & Cloud