added three mobike scenarios
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
The roadwarrior <b>alice</b> is sitting behind the NAT router <b>moon</b> but
|
||||||
|
at the outset of the scenariou is also directly connected to the 192.168.0.0/24 network
|
||||||
|
via an additional <b>eth1</b> interface. <b>alice</b> builds up a tunnel to gateway <b>sun</b>
|
||||||
|
in order to reach <b>bob</b> in the subnet behind. When the <b>eth1</b> interface
|
||||||
|
goes away, <b>alice</b> switches to <b>eth0</b> and signals the IP address change
|
||||||
|
via a MOBIKE ADDRESS_UPDATE notification to peer <b>sun</b>. <b>alice</b> sets
|
||||||
|
a virtual IP of PH_IP_ALICE, so that the IPsec policies don't have to be changed.
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
alice::ipsec statusall::ESTABLISHED.*PH_IP_ALICE1.*PH_IP_SUN::YES
|
||||||
|
sun::ipsec statusall::ESTABLISHED.*PH_IP_SUN.*PH_IP_ALICE1::YES
|
||||||
|
alice::ipsec statusall::PH_IP_ALICE/32 === 10.2.0.0/16::YES
|
||||||
|
sun::ipsec statusall::10.2.0.0/16 === PH_IP_ALICE/32::YES
|
||||||
|
alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_seq=1::YES
|
||||||
|
alice::/etc/init.d/net.eth1 stop::No output expected::NO
|
||||||
|
alice::sleep 1::No output expected::NO
|
||||||
|
alice::ipsec statusall::ESTABLISHED.*PH_IP_ALICE.*PH_IP_SUN::YES
|
||||||
|
sun::ipsec statusall::ESTABLISHED.*PH_IP_SUN.*PH_IP_MOON::YES
|
||||||
|
alice::ipsec statusall::PH_IP_ALICE/32 === 10.2.0.0/16::YES
|
||||||
|
sun::ipsec statusall::10.2.0.0/16 === PH_IP_ALICE/32::YES
|
||||||
|
alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_seq=1::YES
|
||||||
|
moon::tcpdump::moon.strongswan.org.*sun.strongswan.org.*: UDP-encap: ESP::YES
|
||||||
|
moon::tcpdump::sun.strongswan.org.*moon.strongswan.org.*: UDP-encap: ESP::YES
|
||||||
|
bob::tcpdump::alice.strongswan.org.*bob.strongswan.org.*ICMP echo request::YES
|
||||||
|
bob::tcpdump::bob.strongswan.org.*alice.strongswan.org.*ICMP echo reply::YES
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2004 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
opts="start stop reload"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
before net
|
||||||
|
need logger
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
ebegin "Starting firewall"
|
||||||
|
|
||||||
|
# default policy is DROP
|
||||||
|
/sbin/iptables -P INPUT DROP
|
||||||
|
/sbin/iptables -P OUTPUT DROP
|
||||||
|
/sbin/iptables -P FORWARD DROP
|
||||||
|
|
||||||
|
# allow esp
|
||||||
|
iptables -A INPUT -i eth0 -p 50 -j ACCEPT
|
||||||
|
iptables -A INPUT -i eth1 -p 50 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth0 -p 50 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth1 -p 50 -j ACCEPT
|
||||||
|
|
||||||
|
# allow IKE
|
||||||
|
iptables -A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
|
||||||
|
iptables -A INPUT -i eth1 -p udp --sport 500 --dport 500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth1 -p udp --dport 500 --sport 500 -j ACCEPT
|
||||||
|
|
||||||
|
# allow MobIKE
|
||||||
|
iptables -A INPUT -i eth0 -p udp --sport 4500 --dport 4500 -j ACCEPT
|
||||||
|
iptables -A INPUT -i eth1 -p udp --sport 4500 --dport 4500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth0 -p udp --dport 4500 --sport 4500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth1 -p udp --dport 4500 --sport 4500 -j ACCEPT
|
||||||
|
|
||||||
|
# allow crl fetch from winnetou
|
||||||
|
iptables -A INPUT -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
|
||||||
|
iptables -A OUTPUT -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
|
||||||
|
|
||||||
|
# allow ssh
|
||||||
|
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
|
||||||
|
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Stopping firewall"
|
||||||
|
for a in `cat /proc/net/ip_tables_names`; do
|
||||||
|
/sbin/iptables -F -t $a
|
||||||
|
/sbin/iptables -X -t $a
|
||||||
|
|
||||||
|
if [ $a == nat ]; then
|
||||||
|
/sbin/iptables -t nat -P PREROUTING ACCEPT
|
||||||
|
/sbin/iptables -t nat -P POSTROUTING ACCEPT
|
||||||
|
/sbin/iptables -t nat -P OUTPUT ACCEPT
|
||||||
|
elif [ $a == mangle ]; then
|
||||||
|
/sbin/iptables -t mangle -P PREROUTING ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P INPUT ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P FORWARD ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P OUTPUT ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
|
||||||
|
elif [ $a == filter ]; then
|
||||||
|
/sbin/iptables -t filter -P INPUT ACCEPT
|
||||||
|
/sbin/iptables -t filter -P FORWARD ACCEPT
|
||||||
|
/sbin/iptables -t filter -P OUTPUT ACCEPT
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
ebegin "Flushing firewall"
|
||||||
|
for a in `cat /proc/net/ip_tables_names`; do
|
||||||
|
/sbin/iptables -F -t $a
|
||||||
|
/sbin/iptables -X -t $a
|
||||||
|
done;
|
||||||
|
eend $?
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# /etc/ipsec.conf - strongSwan IPsec configuration file
|
||||||
|
|
||||||
|
config setup
|
||||||
|
crlcheckinterval=180
|
||||||
|
strictcrlpolicy=no
|
||||||
|
plutostart=no
|
||||||
|
|
||||||
|
conn %default
|
||||||
|
ikelifetime=60m
|
||||||
|
keylife=20m
|
||||||
|
rekeymargin=3m
|
||||||
|
keyingtries=1
|
||||||
|
keyexchange=ikev2
|
||||||
|
|
||||||
|
conn mobike
|
||||||
|
left=PH_IP_ALICE1
|
||||||
|
leftsourceip=PH_IP_ALICE
|
||||||
|
leftcert=aliceCert.pem
|
||||||
|
[email protected]
|
||||||
|
leftfirewall=yes
|
||||||
|
right=PH_IP_SUN
|
||||||
|
[email protected]
|
||||||
|
rightsubnet=10.2.0.0/16
|
||||||
|
auto=add
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
# /etc/ipsec.conf - strongSwan IPsec configuration file
|
||||||
|
|
||||||
|
config setup
|
||||||
|
crlcheckinterval=180
|
||||||
|
strictcrlpolicy=no
|
||||||
|
plutostart=no
|
||||||
|
|
||||||
|
conn %default
|
||||||
|
ikelifetime=60m
|
||||||
|
keylife=20m
|
||||||
|
rekeymargin=3m
|
||||||
|
keyingtries=1
|
||||||
|
keyexchange=ikev2
|
||||||
|
|
||||||
|
conn mobike
|
||||||
|
left=PH_IP_SUN
|
||||||
|
leftcert=sunCert.pem
|
||||||
|
[email protected]
|
||||||
|
leftfirewall=yes
|
||||||
|
leftsubnet=10.2.0.0/16
|
||||||
|
right=%any
|
||||||
|
rightsourceip=%config
|
||||||
|
[email protected]
|
||||||
|
auto=add
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
alice::ipsec stop
|
||||||
|
sun::ipsec stop
|
||||||
|
alice::/etc/init.d/iptables stop 2> /dev/null
|
||||||
|
sun::/etc/init.d/iptables stop 2> /dev/null
|
||||||
|
moon::iptables -t nat -F
|
||||||
|
moon::conntrack -F
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
alice::/etc/init.d/net.eth1 start
|
||||||
|
alice::/etc/init.d/iptables start 2> /dev/null
|
||||||
|
sun::/etc/init.d/iptables start 2> /dev/null
|
||||||
|
moon::conntrack -F
|
||||||
|
moon::echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
|
moon::iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p udp -j SNAT --to-source PH_IP_MOON:1024-1100
|
||||||
|
moon::iptables -t nat -A POSTROUTING -o eth0 -s 10.1.0.0/16 -p tcp -j SNAT --to-source PH_IP_MOON:2000-2100
|
||||||
|
alice::ipsec start
|
||||||
|
sun::ipsec start
|
||||||
|
alice::sleep 2
|
||||||
|
alice::ipsec up mobike
|
||||||
|
alice::sleep 1
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This configuration file provides information on the
|
||||||
|
# UML instances used for this test
|
||||||
|
|
||||||
|
# All UML instances that are required for this test
|
||||||
|
#
|
||||||
|
UMLHOSTS="alice moon winnetou sun bob"
|
||||||
|
|
||||||
|
# Corresponding block diagram
|
||||||
|
#
|
||||||
|
DIAGRAM="a-m-w-s-b.png"
|
||||||
|
|
||||||
|
# UML instances on which tcpdump is to be started
|
||||||
|
#
|
||||||
|
TCPDUMPHOSTS="bob moon"
|
||||||
|
|
||||||
|
# UML instances on which IPsec is started
|
||||||
|
# Used for IPsec logging purposes
|
||||||
|
#
|
||||||
|
IPSECHOSTS="alice sun"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
The roadwarrior <b>alice</b> is sitting behind the router <b>moon</b> but
|
||||||
|
at the outset of the scenariou is also directly connected to the 192.168.0.0/24 network
|
||||||
|
via an additional <b>eth1</b> interface. <b>alice</b> builds up a tunnel to gateway <b>sun</b>
|
||||||
|
in order to reach <b>bob</b> in the subnet behind. When the <b>eth1</b> interface
|
||||||
|
goes away, <b>alice</b> switches to <b>eth0</b> and signals the IP address change
|
||||||
|
via a MOBIKE ADDRESS_UPDATE notification to peer <b>sun</b>. <b>alice</b> sets
|
||||||
|
a virtual IP of PH_IP_ALICE, so that the IPsec policies don't have to be changed.
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
alice::ipsec statusall::ESTABLISHED.*PH_IP_ALICE1.*PH_IP_SUN::YES
|
||||||
|
sun::ipsec statusall::ESTABLISHED.*PH_IP_SUN.*PH_IP_ALICE1::YES
|
||||||
|
alice::ipsec statusall::PH_IP_ALICE/32 === 10.2.0.0/16::YES
|
||||||
|
sun::ipsec statusall::10.2.0.0/16 === PH_IP_ALICE/32::YES
|
||||||
|
alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_seq=1::YES
|
||||||
|
alice::/etc/init.d/net.eth1 stop::No output expected::NO
|
||||||
|
alice::sleep 1::No output expected::NO
|
||||||
|
alice::ipsec statusall::ESTABLISHED.*PH_IP_ALICE.*PH_IP_SUN::YES
|
||||||
|
sun::ipsec statusall::ESTABLISHED.*PH_IP_SUN.*PH_IP_ALICE::YES
|
||||||
|
alice::ipsec statusall::PH_IP_ALICE/32 === 10.2.0.0/16::YES
|
||||||
|
sun::ipsec statusall::10.2.0.0/16 === PH_IP_ALICE/32::YES
|
||||||
|
alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_seq=1::YES
|
||||||
|
moon::tcpdump::alice.strongswan.org.*sun.strongswan.org.*: ESP::YES
|
||||||
|
moon::tcpdump::sun.strongswan.org.*alice.strongswan.org.*: ESP::YES
|
||||||
|
bob::tcpdump::alice.strongswan.org.*bob.strongswan.org.*ICMP echo request::YES
|
||||||
|
bob::tcpdump::bob.strongswan.org.*alice.strongswan.org.*ICMP echo reply::YES
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2004 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
opts="start stop reload"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
before net
|
||||||
|
need logger
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
ebegin "Starting firewall"
|
||||||
|
|
||||||
|
# default policy is DROP
|
||||||
|
/sbin/iptables -P INPUT DROP
|
||||||
|
/sbin/iptables -P OUTPUT DROP
|
||||||
|
/sbin/iptables -P FORWARD DROP
|
||||||
|
|
||||||
|
# allow esp
|
||||||
|
iptables -A INPUT -i eth0 -p 50 -j ACCEPT
|
||||||
|
iptables -A INPUT -i eth1 -p 50 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth0 -p 50 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth1 -p 50 -j ACCEPT
|
||||||
|
|
||||||
|
# allow IKE
|
||||||
|
iptables -A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
|
||||||
|
iptables -A INPUT -i eth1 -p udp --sport 500 --dport 500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth1 -p udp --dport 500 --sport 500 -j ACCEPT
|
||||||
|
|
||||||
|
# allow MobIKE
|
||||||
|
iptables -A INPUT -i eth0 -p udp --sport 4500 --dport 4500 -j ACCEPT
|
||||||
|
iptables -A INPUT -i eth1 -p udp --sport 4500 --dport 4500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth0 -p udp --dport 4500 --sport 4500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth1 -p udp --dport 4500 --sport 4500 -j ACCEPT
|
||||||
|
|
||||||
|
# allow crl fetch from winnetou
|
||||||
|
iptables -A INPUT -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
|
||||||
|
iptables -A OUTPUT -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
|
||||||
|
|
||||||
|
# allow ssh
|
||||||
|
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
|
||||||
|
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Stopping firewall"
|
||||||
|
for a in `cat /proc/net/ip_tables_names`; do
|
||||||
|
/sbin/iptables -F -t $a
|
||||||
|
/sbin/iptables -X -t $a
|
||||||
|
|
||||||
|
if [ $a == nat ]; then
|
||||||
|
/sbin/iptables -t nat -P PREROUTING ACCEPT
|
||||||
|
/sbin/iptables -t nat -P POSTROUTING ACCEPT
|
||||||
|
/sbin/iptables -t nat -P OUTPUT ACCEPT
|
||||||
|
elif [ $a == mangle ]; then
|
||||||
|
/sbin/iptables -t mangle -P PREROUTING ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P INPUT ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P FORWARD ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P OUTPUT ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
|
||||||
|
elif [ $a == filter ]; then
|
||||||
|
/sbin/iptables -t filter -P INPUT ACCEPT
|
||||||
|
/sbin/iptables -t filter -P FORWARD ACCEPT
|
||||||
|
/sbin/iptables -t filter -P OUTPUT ACCEPT
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
ebegin "Flushing firewall"
|
||||||
|
for a in `cat /proc/net/ip_tables_names`; do
|
||||||
|
/sbin/iptables -F -t $a
|
||||||
|
/sbin/iptables -X -t $a
|
||||||
|
done;
|
||||||
|
eend $?
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# /etc/ipsec.conf - strongSwan IPsec configuration file
|
||||||
|
|
||||||
|
config setup
|
||||||
|
crlcheckinterval=180
|
||||||
|
strictcrlpolicy=no
|
||||||
|
plutostart=no
|
||||||
|
|
||||||
|
conn %default
|
||||||
|
ikelifetime=60m
|
||||||
|
keylife=20m
|
||||||
|
rekeymargin=3m
|
||||||
|
keyingtries=1
|
||||||
|
keyexchange=ikev2
|
||||||
|
|
||||||
|
conn mobike
|
||||||
|
left=PH_IP_ALICE1
|
||||||
|
leftsourceip=PH_IP_ALICE
|
||||||
|
leftcert=aliceCert.pem
|
||||||
|
[email protected]
|
||||||
|
leftfirewall=yes
|
||||||
|
right=PH_IP_SUN
|
||||||
|
[email protected]
|
||||||
|
rightsubnet=10.2.0.0/16
|
||||||
|
auto=add
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# /etc/ipsec.conf - strongSwan IPsec configuration file
|
||||||
|
|
||||||
|
config setup
|
||||||
|
crlcheckinterval=180
|
||||||
|
strictcrlpolicy=no
|
||||||
|
plutostart=no
|
||||||
|
|
||||||
|
conn %default
|
||||||
|
ikelifetime=60m
|
||||||
|
keylife=20m
|
||||||
|
rekeymargin=3m
|
||||||
|
keyingtries=1
|
||||||
|
keyexchange=ikev2
|
||||||
|
|
||||||
|
conn mobike
|
||||||
|
left=PH_IP_SUN
|
||||||
|
leftcert=sunCert.pem
|
||||||
|
[email protected]
|
||||||
|
leftfirewall=yes
|
||||||
|
leftsubnet=10.2.0.0/16
|
||||||
|
right=PH_IP_ALICE1
|
||||||
|
rightsourceip=%config
|
||||||
|
[email protected]
|
||||||
|
auto=add
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
alice::ipsec stop
|
||||||
|
sun::ipsec stop
|
||||||
|
alice::/etc/init.d/iptables stop 2> /dev/null
|
||||||
|
sun::/etc/init.d/iptables stop 2> /dev/null
|
||||||
|
sun::ip route del 10.1.0.0/16 via PH_IP_MOON
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
alice::/etc/init.d/net.eth1 start
|
||||||
|
alice::/etc/init.d/iptables start 2> /dev/null
|
||||||
|
sun::/etc/init.d/iptables start 2> /dev/null
|
||||||
|
moon::echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
|
sun::ip route add 10.1.0.0/16 via PH_IP_MOON
|
||||||
|
alice::ipsec start
|
||||||
|
sun::ipsec start
|
||||||
|
alice::sleep 2
|
||||||
|
alice::ipsec up mobike
|
||||||
|
alice::sleep 1
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This configuration file provides information on the
|
||||||
|
# UML instances used for this test
|
||||||
|
|
||||||
|
# All UML instances that are required for this test
|
||||||
|
#
|
||||||
|
UMLHOSTS="alice moon winnetou sun bob"
|
||||||
|
|
||||||
|
# Corresponding block diagram
|
||||||
|
#
|
||||||
|
DIAGRAM="a-m-w-s-b.png"
|
||||||
|
|
||||||
|
# UML instances on which tcpdump is to be started
|
||||||
|
#
|
||||||
|
TCPDUMPHOSTS="bob moon"
|
||||||
|
|
||||||
|
# UML instances on which IPsec is started
|
||||||
|
# Used for IPsec logging purposes
|
||||||
|
#
|
||||||
|
IPSECHOSTS="alice sun"
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
The roadwarrior <b>alice</b> is sitting behind the router <b>moon</b> but
|
||||||
|
at the outset of the scenariou is also directly connected to the 192.168.0.0/24 network
|
||||||
|
via an additional <b>eth1</b> interface. <b>alice</b> builds up a tunnel to gateway <b>sun</b>
|
||||||
|
in order to reach <b>bob</b> in the subnet behind. When the <b>eth1</b> interface
|
||||||
|
goes away, <b>alice</b> switches to <b>eth0</b> and signals the IP address change
|
||||||
|
via a MOBIKE ADDRESS_UPDATE notification to peer <b>sun</b>. Since <b>alice</b> has
|
||||||
|
not configured a virtual IP address the IPsec policies must be updated.
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
alice::ipsec statusall::ESTABLISHED.*PH_IP_ALICE1.*PH_IP_SUN::YES
|
||||||
|
sun::ipsec statusall::ESTABLISHED.*PH_IP_SUN.*PH_IP_ALICE1::YES
|
||||||
|
alice::ipsec statusall::PH_IP_ALICE1/32 === 10.2.0.0/16::YES
|
||||||
|
sun::ipsec statusall::10.2.0.0/16 === PH_IP_ALICE1/32::YES
|
||||||
|
alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_seq=1::YES
|
||||||
|
alice::/etc/init.d/net.eth1 stop::No output expected::NO
|
||||||
|
alice::sleep 1::No output expected::NO
|
||||||
|
alice::ipsec statusall::ESTABLISHED.*PH_IP_ALICE.*PH_IP_SUN::YES
|
||||||
|
sun::ipsec statusall::ESTABLISHED.*PH_IP_SUN.*PH_IP_ALICE::YES
|
||||||
|
alice::ipsec statusall::PH_IP_ALICE/32 === 10.2.0.0/16::YES
|
||||||
|
sun::ipsec statusall::10.2.0.0/16 === PH_IP_ALICE/32::YES
|
||||||
|
alice::ping -c 1 PH_IP_BOB::64 bytes from PH_IP_BOB: icmp_seq=1::YES
|
||||||
|
moon::tcpdump::alice.strongswan.org.*sun.strongswan.org.*: ESP::YES
|
||||||
|
moon::tcpdump::sun.strongswan.org.*alice.strongswan.org.*: ESP::YES
|
||||||
|
bob::tcpdump::alice1.strongswan.org.*bob.strongswan.org.*ICMP echo request::YES
|
||||||
|
bob::tcpdump::bob.strongswan.org.*alice1.strongswan.org.*ICMP echo reply::YES
|
||||||
|
bob::tcpdump::alice.strongswan.org.*bob.strongswan.org.*ICMP echo request::YES
|
||||||
|
bob::tcpdump::bob.strongswan.org.*alice.strongswan.org.*ICMP echo reply::YES
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
#!/sbin/runscript
|
||||||
|
# Copyright 1999-2004 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
opts="start stop reload"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
before net
|
||||||
|
need logger
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
ebegin "Starting firewall"
|
||||||
|
|
||||||
|
# default policy is DROP
|
||||||
|
/sbin/iptables -P INPUT DROP
|
||||||
|
/sbin/iptables -P OUTPUT DROP
|
||||||
|
/sbin/iptables -P FORWARD DROP
|
||||||
|
|
||||||
|
# allow esp
|
||||||
|
iptables -A INPUT -i eth0 -p 50 -j ACCEPT
|
||||||
|
iptables -A INPUT -i eth1 -p 50 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth0 -p 50 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth1 -p 50 -j ACCEPT
|
||||||
|
|
||||||
|
# allow IKE
|
||||||
|
iptables -A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
|
||||||
|
iptables -A INPUT -i eth1 -p udp --sport 500 --dport 500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth1 -p udp --dport 500 --sport 500 -j ACCEPT
|
||||||
|
|
||||||
|
# allow MobIKE
|
||||||
|
iptables -A INPUT -i eth0 -p udp --sport 4500 --dport 4500 -j ACCEPT
|
||||||
|
iptables -A INPUT -i eth1 -p udp --sport 4500 --dport 4500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth0 -p udp --dport 4500 --sport 4500 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -o eth1 -p udp --dport 4500 --sport 4500 -j ACCEPT
|
||||||
|
|
||||||
|
# allow crl fetch from winnetou
|
||||||
|
iptables -A INPUT -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
|
||||||
|
iptables -A OUTPUT -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
|
||||||
|
|
||||||
|
# allow ssh
|
||||||
|
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
|
||||||
|
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
|
||||||
|
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
ebegin "Stopping firewall"
|
||||||
|
for a in `cat /proc/net/ip_tables_names`; do
|
||||||
|
/sbin/iptables -F -t $a
|
||||||
|
/sbin/iptables -X -t $a
|
||||||
|
|
||||||
|
if [ $a == nat ]; then
|
||||||
|
/sbin/iptables -t nat -P PREROUTING ACCEPT
|
||||||
|
/sbin/iptables -t nat -P POSTROUTING ACCEPT
|
||||||
|
/sbin/iptables -t nat -P OUTPUT ACCEPT
|
||||||
|
elif [ $a == mangle ]; then
|
||||||
|
/sbin/iptables -t mangle -P PREROUTING ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P INPUT ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P FORWARD ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P OUTPUT ACCEPT
|
||||||
|
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
|
||||||
|
elif [ $a == filter ]; then
|
||||||
|
/sbin/iptables -t filter -P INPUT ACCEPT
|
||||||
|
/sbin/iptables -t filter -P FORWARD ACCEPT
|
||||||
|
/sbin/iptables -t filter -P OUTPUT ACCEPT
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
ebegin "Flushing firewall"
|
||||||
|
for a in `cat /proc/net/ip_tables_names`; do
|
||||||
|
/sbin/iptables -F -t $a
|
||||||
|
/sbin/iptables -X -t $a
|
||||||
|
done;
|
||||||
|
eend $?
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
# /etc/ipsec.conf - strongSwan IPsec configuration file
|
||||||
|
|
||||||
|
config setup
|
||||||
|
crlcheckinterval=180
|
||||||
|
strictcrlpolicy=no
|
||||||
|
plutostart=no
|
||||||
|
|
||||||
|
conn %default
|
||||||
|
ikelifetime=60m
|
||||||
|
keylife=20m
|
||||||
|
rekeymargin=3m
|
||||||
|
keyingtries=1
|
||||||
|
keyexchange=ikev2
|
||||||
|
|
||||||
|
conn mobike
|
||||||
|
left=PH_IP_ALICE1
|
||||||
|
leftcert=aliceCert.pem
|
||||||
|
[email protected]
|
||||||
|
leftfirewall=yes
|
||||||
|
right=PH_IP_SUN
|
||||||
|
[email protected]
|
||||||
|
rightsubnet=10.2.0.0/16
|
||||||
|
auto=add
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
# /etc/ipsec.conf - strongSwan IPsec configuration file
|
||||||
|
|
||||||
|
config setup
|
||||||
|
crlcheckinterval=180
|
||||||
|
strictcrlpolicy=no
|
||||||
|
plutostart=no
|
||||||
|
|
||||||
|
conn %default
|
||||||
|
ikelifetime=60m
|
||||||
|
keylife=20m
|
||||||
|
rekeymargin=3m
|
||||||
|
keyingtries=1
|
||||||
|
keyexchange=ikev2
|
||||||
|
|
||||||
|
conn mobike
|
||||||
|
left=PH_IP_SUN
|
||||||
|
leftcert=sunCert.pem
|
||||||
|
[email protected]
|
||||||
|
leftfirewall=yes
|
||||||
|
leftsubnet=10.2.0.0/16
|
||||||
|
right=PH_IP_ALICE1
|
||||||
|
[email protected]
|
||||||
|
auto=add
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
alice::ipsec stop
|
||||||
|
sun::ipsec stop
|
||||||
|
alice::/etc/init.d/iptables stop 2> /dev/null
|
||||||
|
sun::/etc/init.d/iptables stop 2> /dev/null
|
||||||
|
sun::ip route del 10.1.0.0/16 via PH_IP_MOON
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
alice::/etc/init.d/net.eth1 start
|
||||||
|
alice::/etc/init.d/iptables start 2> /dev/null
|
||||||
|
sun::/etc/init.d/iptables start 2> /dev/null
|
||||||
|
moon::echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
|
sun::ip route add 10.1.0.0/16 via PH_IP_MOON
|
||||||
|
alice::ipsec start
|
||||||
|
sun::ipsec start
|
||||||
|
alice::sleep 2
|
||||||
|
alice::ipsec up mobike
|
||||||
|
alice::sleep 1
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This configuration file provides information on the
|
||||||
|
# UML instances used for this test
|
||||||
|
|
||||||
|
# All UML instances that are required for this test
|
||||||
|
#
|
||||||
|
UMLHOSTS="alice moon winnetou sun bob"
|
||||||
|
|
||||||
|
# Corresponding block diagram
|
||||||
|
#
|
||||||
|
DIAGRAM="a-m-w-s-b.png"
|
||||||
|
|
||||||
|
# UML instances on which tcpdump is to be started
|
||||||
|
#
|
||||||
|
TCPDUMPHOSTS="bob moon"
|
||||||
|
|
||||||
|
# UML instances on which IPsec is started
|
||||||
|
# Used for IPsec logging purposes
|
||||||
|
#
|
||||||
|
IPSECHOSTS="alice sun"
|
||||||
Reference in New Issue
Block a user