All of lore.kernel.org
 help / color / mirror / Atom feed
* Reject non-ipsec traffic
@ 2011-07-20 19:20 Ryan Whelan
  2011-07-20 19:56 ` Jan Engelhardt
  0 siblings, 1 reply; 15+ messages in thread
From: Ryan Whelan @ 2011-07-20 19:20 UTC (permalink / raw)
  To: netfilter

I have IPSec setup between 2 hosts and would like to stop all
inter-host traffic thats not secured with IPSec (They have a GRE
tunnel between them, and I want to be sure the GRE traffic fails to
transmit if the IPSec daemon fails)

I'm testing from host hostA, trying to ping hostB.

This is what I've tried; allow only output traffic thats part of IPSec
to hostB. Else, reject it

iptables -A OUTPUT -p udp --dport 500 -d hostB.example.com -j ACCEPT
iptables -A OUTPUT -p tcp --dport 500 -d hostB.example.com -j ACCEPT
iptables -A OUTPUT -p esp -d hostB.example.com -j ACCEPT
iptables -A OUTPUT -d hostB.example.com -j REJECT

[root@hostA ~]# iptables -vL
Chain INPUT (policy ACCEPT 124 packets, 9920 bytes)
pkts bytes target     prot opt in     out     source
destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source
destination

Chain OUTPUT (policy ACCEPT 94 packets, 12768 bytes)
pkts bytes target     prot opt in     out     source
destination
   0     0 ACCEPT     udp  --  any    any     anywhere
hostB.example.com udp dpt:isakmp
   0     0 ACCEPT     tcp  --  any    any     anywhere
hostB.example.com tcp dpt:isakmp
   0     0 ACCEPT     esp  --  any    any     anywhere
hostB.example.com
   8   864 REJECT     all  --  any    any     anywhere
hostB.example.com reject-with icmp-port-unreachable
[root@hostA ~]#



The reject rule is rejecting all traffic to that host as you can see
from the pkt counter.  If i remove that rule, everything works and i
see the packets get counted on the ESP protocol rule.  I thought the
rules were processes in order until a match was found. Clearly I'm
wrong.

Is this possible without much complexity?

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-07-25  0:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-20 19:20 Reject non-ipsec traffic Ryan Whelan
2011-07-20 19:56 ` Jan Engelhardt
2011-07-20 20:13   ` Ryan Whelan
2011-07-20 20:30     ` Jan Engelhardt
2011-07-20 20:33       ` Ryan Whelan
2011-07-20 20:34         ` Jan Engelhardt
2011-07-21  0:09           ` Ryan Whelan
2011-07-21 16:55             ` Petr Pisar
2011-07-21 17:05               ` Ryan Whelan
2011-07-21 19:01                 ` Steven Kath
2011-07-21 19:29                   ` Jan Engelhardt
2011-07-22  5:15                 ` Petr Pisar
2011-07-24 22:40                   ` Greg Scott
2011-07-25  0:32                     ` Jan Engelhardt
2011-07-25  0:47             ` Jan Engelhardt

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.