All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Ivan Mitev <imitev@obs.bg>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: ipsec patches test: minor compilation and policy match issues
Date: Sat, 24 Apr 2004 13:14:55 +0200	[thread overview]
Message-ID: <408A4C2F.3050209@trash.net> (raw)
In-Reply-To: <20040424101748.GB23401@obs.bg>

Hi Ivan,

Ivan Mitev wrote:
> hi !
> 
> i tried to use the ipsec policy for a transport mode, AH+ESP, but i don't
> manage to get it working (ie pkts are not matched by the ipsec policy rule)
> however AH or ESP alone work fine.
> 
> btw, maybe no one uses AH + ESP, but that's only a test...
> 
> setup:
> 
>  --------                           --------
>  | rtr1 | 2.10 --- "inet" ---- 3.10 | rtr2 |
>  -------- eth1                 eth1 --------
> 
> setkey on rtr1:
> 
> spdadd 172.16.3.10 172.16.2.10 any -P out ipsec
>         esp/transport//require
>         ah/transport//require;
> 
> spdadd 172.16.2.10 172.16.3.10 any -P in ipsec
>         esp/transport//require
>         ah/transport//require;
> 
> assuming OUTPUT is wide open, the following rules are not matched by 
> incoming pkts from rtr2 (i do a ping from rtr2 to rtr1)
> 
> iptables -A INPUT  -m policy --dir in --pol ipsec -j ACCEPT
> 
> iptables -A INPUT  -m policy --dir in --proto ah --pol ipsec -j ACCEPT
> iptables -A INPUT  -m policy --dir in --proto esp --pol ipsec -j ACCEPT
> 
> tcpdump on rtr1 eth1:
> 
> 1:28:05.801812 IP 172.16.3.10 > 172.16.2.10: AH(spi=0x08aac272,seq=0x2): ESP(spi=0x0cf46759,seq=0x2)
> 
> as soon as i "free" INPUT, packets begin to flow; packets also flow when
> i set the following rule, so it seems that AH+ESP is not reconized as ipsec:
> iptables -A INPUT  -m policy --dir in --pol none -j ACCEPT 

Did you have rules to accept the encrypted packets ? The policy match
only matches the decapsulated packets, so you need to accept the outer
protocol using the protocol match. AH+ESP works fine with this setup:

setkey:
spdadd 192.168.0.23/32 0.0.0.0/0 any
         -P out ipsec
         esp/tunnel/0.0.0.0-192.168.0.1/require
         ah/transport//require;

spdadd 0.0.0.0/0 192.168.0.23/32 any
         -P in ipsec
         esp/tunnel/192.168.0.1-0.0.0.0/require
         ah/transport//require;

policy match:
iptables -A INPUT -m policy --dir in --pol ipsec --strict --proto esp
  --mode tunnel --tunnel-src 192.168.0.1 --tunnel-dst 192.168.0.23 --next
  --proto ah --mode transport

iptables -A OUTPUT -m policy --dir out --pol ipsec --strict --proto esp
  --mode tunnel --tunnel-src 192.168.0.23 --tunnel-dst 192.168.0.1 --next
  --proto ah  --mode transport

All packets are accepted, the rules are just there for counting.
I have not tried nested transport-mode SAs yet, but I will try after
recompling the kernel.

> a word about other tests:
>  - multiple (>10) concurrent tunnels work fine; once some appropriate user
>    chains are set up, the ipsec policy match is very flexible, and provides
>    more control than with the ipsec+ devices of freeswan ; cool!
>  - i didn't have time yet to test that mangle works fine (eg. test that packets
>    keep their fwmark while being encrypted/decrypted, and that seeing the 
>    packet in both its encrypted and decrypted form doesn't mess up with tc).
>  - SNAT is working well with tunnel mode; eg when the hosts behind rtr1 are
>    s-natted with rtr1's private ip; i didn't test very complicated S/DNAT
>    setups though.

Thanks for your testing.

Regards
Patrick

> 
> ivan
> 

  reply	other threads:[~2004-04-24 11:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-15 21:20 ipsec patches test: minor compilation and policy match issues Ivan Mitev
2004-04-16 14:11 ` Patrick McHardy
2004-04-24 10:17   ` Ivan Mitev
2004-04-24 11:14     ` Patrick McHardy [this message]
2004-04-24 11:51       ` Patrick McHardy
2004-04-24 13:07         ` Ivan Mitev
2004-04-27 18:58     ` Michael Richardson
2004-04-28  0:30       ` Patrick McHardy
2004-04-16 15:21 ` Where is DROP target implemented {Virus Scanned} Qiang
2004-04-16 16:39   ` Patrick McHardy
2004-07-13  2:37 ` ipsec patches test: minor compilation and policy match issues Stephen Frost
2004-07-13  2:54   ` Patrick McHardy
2004-07-13 11:53     ` Stephen Frost
2004-07-13 15:56       ` Patrick McHardy
2004-07-13 16:10         ` Stephen Frost
2004-07-14  1:22           ` Patrick McHardy
2004-07-14  3:00             ` Stephen Frost
2004-07-14 12:11               ` Patrick McHardy
2004-07-14  3:37             ` Henrik Nordstrom
2004-07-14 12:25               ` Patrick McHardy
2004-07-14 15:05                 ` Henrik Nordstrom
2004-07-23  0:06                   ` Patrick McHardy
2004-07-25  9:40                     ` Henrik Nordstrom

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=408A4C2F.3050209@trash.net \
    --to=kaber@trash.net \
    --cc=imitev@obs.bg \
    --cc=netfilter-devel@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.