Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Henrique Netfilter <henrique.netfilter@gmail.com>
To: netfilter@vger.kernel.org
Subject: Handling RoadWarrior VPN Traffic with IPtables
Date: Fri, 25 Apr 2008 12:05:58 -0300	[thread overview]
Message-ID: <4811F356.9000404@gmail.com> (raw)

Good morning,

List, I've been trying now for some time to create a RoadWarrior VPN, 
and I finally did it.
Now I'm having some problems to tune my iptables rules to make it work 
correctly and safely.

The VPN is based on OpenSwan+l2tpd+pppd.
The distro is a Suse 10.1 kernel 2.6 (NETKEY).

The l2tpd is encaspuled inside the ESP traffic of the IPSec tunnel, and 
when it reaches my external interface, it must be redirected to my 
internal interface (where the l2tpd daemon listens) to continue the 
connection.
If I had a KLIPS kernel, I could easily just DNAT the incoming L2TP 
requisition on interface ipsec0 to my internal interface:

iptables -t nat -A PREROUTING -i ipsecX -p udp --sport 1701 --dport 1701 
-j DNAT --to-destination X.X.X.X <------ my internal interface IP

But since my kernel is NETKEY, I can't, since there is  no ipsec 
interface, and I can't just DNAT the incoming traffic from my external 
to my internal interface for security reasons (since I want that only 
traffic coming from the IPSec tunnel to access the l2tpd daemon).

At first I tought marking the ESP traffic would do the trick. I was 
wrong, since the packets marked are only those from the external peer to 
the external interface (SRC=Y.Y.Y.Y DST=Z.Z.Z.Z PROTO=ESP).

So far my last option is to apply the KLIPS patch and recompile my 
kernel, but I really would like to avoid to do so.
So I come to you, I hope that the netfilter list can help me out how to 
handle those connections using iptables.

Thank you, and so long

Henrique

             reply	other threads:[~2008-04-25 15:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-25 15:05 Henrique Netfilter [this message]
2008-04-25 15:11 ` Handling RoadWarrior VPN Traffic with IPtables Jan Engelhardt
  -- strict thread matches above, loose matches on Subject: below --
2008-04-25 15:28 Henrique Netfilter
2008-04-25 17:23 ` Henrique Netfilter

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=4811F356.9000404@gmail.com \
    --to=henrique.netfilter@gmail.com \
    --cc=netfilter@vger.kernel.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