From: Guillaume Marcais <guillaume.marcais@free.fr>
To: netfilter@lists.netfilter.org
Subject: Child proofing...
Date: Thu, 7 Nov 2002 14:53:14 -0500 [thread overview]
Message-ID: <B0000532307@smtp.rapiddsl.net> (raw)
We have remote routers that we access with ssh. Sometime, I am
not careful enough and I enter stupid routing information that not only
leaves our clients connectionless but also prevents me from accessing the
router. Then truck roll, long downtimes and angry customers... I am really a
child sometimes :)
The idea was to be able to have access to ssh (almost) no matter what I do to
the main routing table. Even something like: ip route del default. I thought
of doing it with policy routing with something like the following:
(Let's assume the router has eth0 with 192.168.0.2/24 as its main gateway
interface).
ip rule add fwmark 1 table sshtable
ip route add 192.168.0.0/24 dev eth0 table sshtable
ip route add default via 192.168.0.1 dev eth0 table sshtable
iptables -I PREROUTING -t mangle -p tcp -d 192.168.0.2 --destination-port ssh
-j MARK --set-mark 1
iptables -I OUTPUT -t mangle -p tcp -s 192.168.0.2 --source-port ssh -j MARK
--set-mark 1
Basically, the traffic to/from the ssh daemon uses a separate routing table,
which I won't tamper with on a regurlar basis.
Alas, it doesn't work. If I do the following:
ip route del 192.168.0.0/24 dev eth0
I cannot access ssh anymore. The netfilter Hacking howto tells us that: "The
NF_IP_LOCAL_OUT [5] hook is called for packets that are created locally. Here
you can see that routing occurs after this hook is called: in fact, the
routing code is called first [...]". So the routing is called first, which
fails with the main table and the packet is drop before being marked by
netfilter and routed according to the sshtable...
Anybody has any idea on how to work aroung this?
Guillaume.
PS: in all fairness, the howto suggest to " alter the `skb->dst' field
yourself, as is done in the NAT code". But I would like to avoid to write a
kernel module if possible.
next reply other threads:[~2002-11-07 19:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-07 19:53 Guillaume Marcais [this message]
2002-11-09 14:37 ` Child proofing Antony Stone
2002-11-11 22:26 ` Nick Drage
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=B0000532307@smtp.rapiddsl.net \
--to=guillaume.marcais@free.fr \
--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