IPTABLES-APPLY(8)

๐Ÿ’… IPTABLES-APPLY(8) โ€” a safer way to update iptables remotely

okay so bestie, this is iptables-apply from the iptables 1.8.13 era, and it is literally the โœจ responsible queen โœจ of remote firewall editing. buckle up ๐ŸŽ€


๐ŸŒธ SYNOPSIS ๐ŸŒธ

iptables-apply [-hV] [-t timeout] [-w savefile] {[rulesfile]|-c
[runcmd]}

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so here's the whole vibe: iptables-apply tries to apply a new rulesfile โ€” like, the kind of file that iptables-save spits out and iptables-restore reads back in โ€” or it runs a command to configure iptables. then it prompts you to confirm whether the changes are actually okay. main character energy, but with a safety net ๐Ÿซถ

and why does it ask? because if the new iptables rules just cut your existing connection (yes, we've all been there ๐Ÿ˜ญ), you literally can't answer affirmatively. you're locked out. no cap. so when that timeout hits and you haven't said "yeah it's fine," the script rolls back to the previous working iptables rules. iconic rollback behaviour, honestly ๐Ÿ‘‘

rules that do get applied successfully can also be written out to a savefile, and later used to roll back to this state. this is how you implement a store-last-good-configuration mechanism while you're out here experimenting with an iptables setup script:

iptables-apply -w /etc/network/iptables.up.rules -c /etc/network/iptables.up.run

also, when it's called as ip6tables-apply, the script uses ip6tables-save/-restore and IPv6 default values instead of the v4 ones. cute, right? ๐ŸŒˆ and the default value for rulesfile is /etc/network/iptables.up.rules.


โœจ OPTIONS โœจ

  • -t seconds, --timeout seconds โ€” sets the timeout, in seconds, after which the script rolls back to the previous ruleset. default: 10.
  • -w savefile, --write savefile โ€” names the savefile where successfully applied rules get written. the default, if an empty string is given, is /etc/network/iptables.up.rules.
  • -c runcmd, --command runcmd โ€” runs the command runcmd to configure iptables instead of applying a rulesfile. default: /etc/network/iptables.up.run.
  • -h, --help โ€” displays usage information.
  • -V, --version โ€” displays version information.
โš ๏ธ real talk: the whole point of -t is that you might lose your connection. keep the timeout short-ish, hold your breath, and confirm fast ๐Ÿ’€

๐ŸŒผ SEE ALSO ๐ŸŒผ


๐Ÿ‘‘ LEGALESE ๐Ÿ‘‘

original iptables-apply โ€” Copyright 2006 Martin F. Krafft <madduck@madduck.net>. Version 1.1 โ€” Copyright 2010 GW <gw.2010@tnode.com or http://gw.tnode.com/>.

this manual page was written by Martin F. Krafft <madduck@madduck.net> and extended by GW <gw.2010@tnode.com or http://gw.tnode.com/>.

permission is granted to copy, distribute and/or modify this document under the terms of the Artistic License 2.0. periodt ๐Ÿ’…


and that's the whole page, bestie ๐Ÿ“ โ€” brought to you by iptables 1.8.13, straight from the IPTABLES-APPLY(8) corner of the manual. go forth and not lock yourself out ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from