From: Jim Carter <jimc@math.ucla.edu>
To: Eric Gibson <aithien@bellsouth.net>
Cc: netfilter@lists.netfilter.org
Subject: Re: iptables -f locks me out?
Date: Sat, 18 Oct 2003 21:43:56 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.53.0310182125530.8624@xena.cft.ca.us> (raw)
In-Reply-To: <001701c395af$409f1a10$0201a8c0@ERICDEV>
On Sat, 18 Oct 2003, Eric Gibson wrote:
> Is there anyway around this? It never used to happen with ipchains...
> Whenever I run iptables -F, or stop my shorewall script with it's init
> script (or if there is an error in the config file, and it stops itself.)
> it completely locks me out of remote access and I...
"iptables -F" would clear the filter table, and if the nat or mangle tables
still had rules, something bad might happen. Also the chains still have
their individual policies, some of which are DROP. That's probably what
is killing you. You need to set the policies of all the builtin chains to
ACCEPT.
Consider using iptables-save and iptables-restore. I've replaced my
original firewall script with one like this. For the payload I dumped my
rules using iptables-save, and then neatened and annotated them, replacing
numeric ports and protocols with keys from /etc/services and
/etc/protocols. If there's a syntax error in any one table, that table
will not be replaced; otherwise it is replaced atomically. No need to
flush rules, opening up your box for a second.
iptables-restore <<EOF
*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
# auth queries need to be rejected actively to avoid annoying timeouts.
-A INPUT -p tcp -m tcp --dport auth -j REJECT --reject-with icmp-port-unreachable
COMMIT
*nat
:PREROUTING DROP [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# My user-defined chain
:COUCHNET - [0:0]
# Ports and protocols that are allowed
# ssh secure shell
-A PREROUTING -p tcp -m tcp --dport ssh -j ACCEPT
# etc. etc.
EOF
It also has a function which restores a pristine state (with ACCEPT
policies), which is executed when you do "/etc/init.d/firewall stop".
Hope this helps!
James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: jimc@math.ucla.edu http://www.math.ucla.edu/~jimc (q.v. for PGP key)
prev parent reply other threads:[~2003-10-19 4:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-18 19:37 iptables -f locks me out? Eric Gibson
2003-10-19 4:43 ` Jim Carter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.53.0310182125530.8624@xena.cft.ca.us \
--to=jimc@math.ucla.edu \
--cc=aithien@bellsouth.net \
--cc=netfilter@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox