Re: safety net when working on a dedicated server
- From: Peter Gantner <usenet@xxxxxxxxxxx>
- Date: Sat, 24 Jun 2006 01:18:24 +0200
On Thursday 22. June 2006 20:51, fabrulous@xxxxxxxx spake to
comp.os.linux.misc:
Hi Nephros,
nephros wrote:
...
How about the combination of the two approaches? Just flush the relevant
chain.
Set up a user-named chain and let all incoming packets first jump to
this. You cron job could then use something like
iptables -F mychain
iptables -X mychain
iptables -N mychain
iptables -A mychain -p tcp --dport 22 -s ${STATIC_IP} -j ACCEPT
iptables -A mychain -j RETURN
to recreate the rule every hour.
As you told, this is still rather fragile... So I had another idea:
create
a script that does just one thing, execute the following line:
iptables -I INPUT -p tcp --dport 22 -s $STATIC_IP -j ACCEPT
if and only if this is not already the first rule that iptables sees.
^^^^^^^^^^^^
what do you think about it? (it's not that much better that what
you're proposing, but it's "simpler" from iptables's point of vue: only a
single that gets inserted as the very first INPUT rule or not,
Yes it's basically the same approach, only difference I see really is that
your way puts more complexity in the scripting side (you will have to list,
grep/awk ... the iptables state), mine uses a slightly more complex
iptables setup but requires almost no scripting.
I don't think it's such a crazy idea or such a bad practice :-/
No but I think it fixes an issue that Should Never Arise (TM) when the
firewall "master" script is constructed carefully. Like, for example,
putting that ssh accept line directly below the one where you flush the old
and set default policies for the INPUT table.
Do all the fancy firewalling stuff after that area of the script (probably
in separate sh files sourced from the master) and never change the master
without thorough review.
Should be pretty hard to lock yourself out then.
will try it anyway (I'm not that much of a Un*x scripting guru though).Good luck, and I'm sure scripting guruness isn't required for this ;)
nephros
--
"I do not think the way you think I think."
-- Kai, last of the Brunnen G
.
- References:
- safety net when working on a dedicated server
- From: fabrulous
- Re: safety net when working on a dedicated server
- From: Keith Keller
- Re: safety net when working on a dedicated server
- From: nephros
- Re: safety net when working on a dedicated server
- From: fabrulous
- safety net when working on a dedicated server
- Prev by Date: A new reader? Welcome to comp.os.linux.misc, read this first if you're new here (FAQ)
- Next by Date: Re: patched the kernel but still the same version in the Makefile
- Previous by thread: Re: safety net when working on a dedicated server
- Next by thread: Re: safety net when working on a dedicated server
- Index(es):
Relevant Pages
|