All of lore.kernel.org
 help / color / mirror / Atom feed
From: Valentijn Sessink <linux-kernel-MTA3NDA5NjA5Nwo@mail.v.sessink.nl>
To: netfilter@lists.netfilter.org
Subject: port based filtering and IPsec 2.6
Date: Wed, 14 Jan 2004 17:26:23 +0100	[thread overview]
Message-ID: <20040114162623.GR4106@openoffice.nl> (raw)

Hello list,

https://lists.netfilter.org/pipermail/netfilter/2003-July/045710.html and
following discuss port based filtering and IPsec, AKA 
http://www.ussg.iu.edu/hypermail/linux/kernel/0308.2/1132.html

The issue: if you have a host-to-host connection and you try to use iptables
to filter, you'll see only ESP packets in the INPUT chain. Those are of no
use, as the content (and ports and the like) are all hidden. FreeS/WAN
doesn't have this problem, as it uses a separate dummy interface that
handles the unencrypted packets.

Now there seems a solution that is a bit of a hack, but it does work. Simply
use a *tunnel* between the two hosts, and define the subnets to be
"tunneled" to be the hosts themselves, like so:

add $foo $bar esp 0xf00 -m tunnel   
        -E 3des-cbc $secret1 -A hmac-md5 $secret2; 
spdadd $foo $bar any -P out ipsec
        esp/tunnel/$here-$distant/require;
add $bar $foo esp 0xf01 -m tunnel
	-E 3des-cbc $secret3 -A hmac-md5 $secret4;
spdadd $bar $foo any -P in ipsec
	esp/tunnel/$bar-$foo/require;

Now you'll find double logs from each packet, like so:

$foo:~# iptables -A INPUT -s $bar -j LOG
... to my surprise tells me things like:
Jan 14 14:43:08 $foo kernel: IN=eth1 OUT=
MAC=52:54:05:e5:de:c9:00:02:fd:39:8f:13:08:00 SRC=bar
DST=foo LEN=112 TOS=0x00 PREC=0x00 TTL=54 ID=0 DF PROTO=ESP SPI=0x302
Jan 14 14:43:08 $foo kernel: IN=eth1 OUT=
MAC=52:54:05:e5:de:c9:00:02:fd:39:8f:13:08:00 SRC=bar
DST=foo LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=TCP
SPT=22 DPT=1028 WINDOW=5792 RES=0x00 ACK SYN URGP=0  

I'm not exactly sure what are drawbacks here (if any). I saw comments by
Bruce Schneier http://www.schneier.com/paper-ipsec.html, recommending the
eliminiation of transport mode anyway, but I'm not sure if this is still
debated. So use at your own risk.

Valentijn
-- 
http://www.openoffice.nl/   Open Office - Linux Office Solutions
Valentijn Sessink  valentyn+sessink@nospam.openoffice.nl


             reply	other threads:[~2004-01-14 16:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-14 16:26 Valentijn Sessink [this message]
2004-01-17 13:45 ` [despammed] port based filtering and IPsec 2.6 Andreas Kretschmer
2004-01-17 17:47   ` netfilter.lists.samba.org
2004-01-17 18:29     ` Antony Stone
2004-01-18  9:14       ` Marc Haber
2004-01-18  9:34         ` Antony Stone
2004-01-19  7:43           ` Marc Haber
2004-01-21 15:39     ` [despammed] " Valentijn Sessink
2004-01-21 15:37   ` Valentijn Sessink
2004-01-21 15:44     ` Marc Haber
2004-01-21 16:31       ` Valentijn Sessink
2004-01-21 21:46         ` Marc Haber
2004-01-22 12:43           ` Valentijn Sessink
2004-02-17 15:02             ` Marc Haber
2004-02-17 15:16               ` Valentijn Sessink

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=20040114162623.GR4106@openoffice.nl \
    --to=linux-kernel-mta3nda5nja5nwo@mail.v.sessink.nl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.