Live nft-mutation verbs — allow, deny, override, up, down, bypass, quarantine, rules, preview.
Each verb mutates or inspects a running container's shield ruleset. The
handlers accept (shield, [container], **kwargs) and print to stdout;
the CLI dispatcher builds the Shield and forwards
the parsed argv.
ALLOW = CommandDef(name='allow', help='Allow a domain or IP for a container (live, or at its next start when stopped)', handler=_handle_allow, extras=NEEDS_CTR, epilog='A host the security tier denies (a vault-relayed provider host, or anything sharing its address) is refused: break-glass only, through an override.', args=(CONTAINER_ARG, ArgDef(name='target', help='Domain name or IP address to allow')))
module-attribute
DENY = CommandDef(name='deny', help='Live-deny a domain or IP for a container', handler=_handle_deny, extras=NEEDS_CTR, args=(CONTAINER_ARG, ArgDef(name='target', help='Domain name or IP address to deny')))
module-attribute
OVERRIDE = CommandDef(name='override', help='Open a break-glass override above the security tier until a date, or revoke it', handler=_handle_override, extras=NEEDS_CTR, epilog='Grant (both flags are required):\n\n terok-shield override my-ctr api.example.net --expires 2026-11-30 --reason "vendor outage"\n\nRevoke:\n\n terok-shield override my-ctr api.example.net --off\n\nThe override holds through the --expires date: the kernel closes it at\nthe end of that day, host local time. Closing it, then or with --off,\nstops new connections only: any already open keep running until they\nclose. The reason is recorded on the tier entry and in the audit log.\nNo override opens the hard-deny floor (link-local, cloud metadata) or\nthe host\'s own loopback, which a +localhost:PORT grant reaches one port\nat a time. A grant lasts until it expires or a restart re-derives the\npolicy: author it as shield.override to keep it.', args=(CONTAINER_ARG, ArgDef(name='target', help='Domain name, IP address or CIDR to open (or close with --off)'), ArgDef(name='--expires', type=_expiry_date, help='Last day the override holds, YYYY-MM-DD, host local time (required to grant)'), ArgDef(name='--reason', help='Why the break-glass is needed; recorded and audited (required to grant)'), ArgDef(name='--off', action='store_true', help='Revoke the override now')))
module-attribute
DOWN = CommandDef(name='down', help='Switch container to the DOWN posture (accept + log; private ranges still rejected)', handler=_handle_down, extras=NEEDS_CTR, args=(CONTAINER_ARG, CONTAINER_ID_ARG, ArgDef(name='--disengage', action='store_true', dest='disengaged', help='Enforce nothing — lift the deny set and every range reject (DISENGAGED posture)')))
module-attribute
UP = CommandDef(name='up', help='Restore deny-all mode for a container', handler=_handle_up, extras=NEEDS_CTR, args=(CONTAINER_ARG, CONTAINER_ID_ARG))
module-attribute
BYPASS = CommandDef(name='bypass', help='Open, close or show the timed allow-all window for a container', handler=_handle_bypass, extras=NEEDS_CTR, args=(CONTAINER_ARG, ArgDef(name='--for', dest='duration', help='Open the window for this long (an nft timeout such as 5m; default: bypass_duration)'), ArgDef(name='--off', action='store_true', help='Close the window now')))
module-attribute
RESET = CommandDef(name='reset', help='Forget DNS-learned allow state (back to authored policy seeds)', handler=_handle_reset, extras=NEEDS_CTR, args=(CONTAINER_ARG,))
module-attribute
QUARANTINE = CommandDef(name='quarantine', help='Total network blackout (drop all, log dropped traffic)', handler=_handle_quarantine, extras=NEEDS_CTR, args=(CONTAINER_ARG,))
module-attribute
RULES = CommandDef(name='rules', help='Show current nft rules for a container', handler=_handle_rules, extras=NEEDS_CTR, args=(CONTAINER_ARG,))
module-attribute
PREVIEW = CommandDef(name='preview', help='Show ruleset that would be applied', handler=_handle_preview, epilog='With --profiles, the ruleset the hook applies at createRuntime for those profiles: their +localhost:PORT grants in the preamble, their literal IPs seeding the project-allow set. Domains are learned by dnsmasq at runtime, not resolved here. Needs no setup, podman or state:\n\n terok-shield preview --profiles my-project > rules.nft', args=(PROFILES_ARG, ArgDef(name='--down', action='store_true', help='Show the DOWN-posture ruleset'), ArgDef(name='--disengage', action='store_true', dest='disengaged', help='Show the DISENGAGED ruleset: no deny set, no range rejects (requires --down)')))
module-attribute