2 # iproute2 version, default updown script
4 # Copyright (C) 2003-2004 Nigel Meteringham
5 # Copyright (C) 2003-2004 Tuomo Soini
6 # Copyright (C) 2002-2004 Michael Richardson
7 # Copyright (C) 2005-2007 Andreas Steffen <andreas.steffen@strongswan.org>
9 # This program is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by the
11 # Free Software Foundation; either version 2 of the License, or (at your
12 # option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 # CAUTION: Installing a new version of strongSwan will install a new
20 # copy of this script, wiping out any custom changes you make. If
21 # you need changes, make a copy of this under another name, and customize
22 # that, and use the (left/right)updown parameters in ipsec.conf to make
23 # strongSwan use yours instead of this default one.
25 # things that this script gets (from ipsec_pluto(8) man page)
28 # indicates what version of this interface is being
29 # used. This document describes version 1.1. This
30 # is upwardly compatible with version 1.0.
33 # specifies the name of the operation to be performed
34 # (prepare-host, prepare-client, up-host, up-client,
35 # down-host, or down-client). If the address family
36 # for security gateway to security gateway communica-
37 # tions is IPv6, then a suffix of -v6 is added to the
41 # is the name of the connection for which we are
45 # is the name of the ipsec interface to be used.
48 # is the requid of the AH|ESP policy
51 # is the negotiated IPsec protocol, ah|esp
54 # is the unique identifier of the associated IKE_SA
57 # is the IP address of our host.
60 # is the ID of our host.
63 # is the IP address / count of our client subnet. If
64 # the client is just the host, this will be the
65 # host's own IP address / max (where max is 32 for
66 # IPv4 and 128 for IPv6).
69 # PLUTO_MY_SOURCEIP4_$i
70 # PLUTO_MY_SOURCEIP6_$i
71 # contains IPv4/IPv6 virtual IP received from a responder,
72 # $i enumerates from 1 to the number of IP per address family.
73 # PLUTO_MY_SOURCEIP is a legacy variable and equals to the first
74 # virtual IP, IPv4 or IPv6.
77 # is the IP protocol that will be transported.
80 # is the UDP/TCP port to which the IPsec SA is
81 # restricted on our side. For ICMP/ICMPv6 this contains the
82 # message type, and PLUTO_PEER_PORT the message code.
85 # is the IP address of our peer.
88 # is the ID of our peer.
91 # is the IP address / count of the peer's client sub-
92 # net. If the client is just the peer, this will be
93 # the peer's own IP address / max (where max is 32
94 # for IPv4 and 128 for IPv6).
97 # is the IP protocol that will be transported.
100 # is the UDP/TCP port to which the IPsec SA is
101 # restricted on the peer side. For ICMP/ICMPv6 this contains the
102 # message code, and PLUTO_MY_PORT the message type.
105 # is an optional user ID employed by the XAUTH protocol
108 # is an optional XFRM mark set on the inbound IPsec SA
111 # is an optional XFRM mark set on the outbound IPsec SA
114 # contains the remote UDP port in the case of ESP_IN_UDP
119 # contains IPv4/IPv6 DNS server attribute received from a
120 # responder, $i enumerates from 1 to the number of servers per
124 # define a minimum PATH environment in case it is not set
125 PATH
="/sbin:/bin:/usr/sbin:/usr/bin:@sbindir@"
128 # uncomment to log VPN connections
131 # tag put in front of each log entry:
134 # syslog facility and priority used:
135 FAC_PRIO
=local0.notice
137 # to create a special vpn logging file, put the following line into
138 # the syslog configuration file /etc/syslog.conf:
140 # local0.notice -/var/log/vpn
142 # in order to use source IP routing the Linux kernel options
143 # CONFIG_IP_ADVANCED_ROUTER and CONFIG_IP_MULTIPLE_TABLES
146 # special routing table for sourceip routes
147 SOURCEIP_ROUTING_TABLE
=@routing_table@
149 # priority of the sourceip routing table
150 SOURCEIP_ROUTING_TABLE_PRIO
=@routing_table_prio@
152 # check interface version
153 case "$PLUTO_VERSION" in
154 1.
[0|
1]) # Older Pluto?!? Play it safe, script may be using new features.
155 echo "$0: obsolete interface version \`$PLUTO_VERSION'," >&2
156 echo "$0: called by obsolete Pluto?" >&2
160 *) echo "$0: unknown interface version \`$PLUTO_VERSION'" >&2
169 iptables
:iptables
) # due to (left/right)firewall; for default script only
171 custom
:*) # custom parameters (see above CAUTION comment)
173 *) echo "$0: unknown parameters \`$*'" >&2
178 # utility functions for route manipulation
179 # Meddling with this stuff should not be necessary and requires great care.
191 if ! ip
-o route get
${PLUTO_MY_SOURCEIP%/*} |
grep -q ^
local
193 it
="ip addr add ${PLUTO_MY_SOURCEIP%/*}/32 dev $PLUTO_INTERFACE"
194 oops
="`eval $it 2>&1`"
196 if test " $oops" = " " -a " $st" != " 0"
198 oops
="silent error, exit status $st"
200 if test " $oops" != " " -o " $st" != " 0"
202 echo "$0: addsource \`$it' failed ($oops)" >&2
211 if [ -z "$PLUTO_MY_SOURCEIP" ]
213 for dir
in /etc
/sysconfig
/etc
/conf.d
; do
214 if [ -f "$dir/defaultsource" ]
216 .
"$dir/defaultsource"
220 if [ -n "$DEFAULTSOURCE" ]
222 PLUTO_MY_SOURCEIP
=$DEFAULTSOURCE
226 if [ -z "$KLIPS" -a -z "$PLUTO_MY_SOURCEIP" ]
228 # leave because no route entry is required
232 parms1
="$PLUTO_PEER_CLIENT"
234 if [ -n "$PLUTO_NEXT_HOP" ]
236 parms2
="via $PLUTO_NEXT_HOP"
238 parms2
="via $PLUTO_PEER"
240 parms2
="$parms2 dev $PLUTO_INTERFACE"
243 if [ -n "$PLUTO_MY_SOURCEIP" ]
248 if ! ip rule list |
grep -q "lookup $SOURCEIP_ROUTING_TABLE"
250 ip rule add pref
$SOURCEIP_ROUTING_TABLE_PRIO table
$SOURCEIP_ROUTING_TABLE
253 parms3
="$parms3 src ${PLUTO_MY_SOURCEIP%/*} table $SOURCEIP_ROUTING_TABLE"
256 case "$PLUTO_PEER_CLIENT_NET/$PLUTO_PEER_CLIENT_MASK" in
258 # opportunistic encryption work around
259 # need to provide route that eclipses default, without
261 it
="ip route $1 0.0.0.0/1 $parms2 $parms3 &&
262 ip route $1 128.0.0.0/1 $parms2 $parms3"
264 *) it
="ip route $1 $parms1 $parms2 $parms3"
267 oops
="`eval $it 2>&1`"
269 if test " $oops" = " " -a " $st" != " 0"
271 oops
="silent error, exit status $st"
273 if test " $oops" != " " -o " $st" != " 0"
275 echo "$0: doroute \`$it' failed ($oops)" >&2
280 # in the presence of KLIPS and ipsecN interfaces do not use IPSEC_POLICY
281 if [ `echo "$PLUTO_INTERFACE" | grep "ipsec"` ]
288 IPSEC_POLICY
="-m policy --pol ipsec --proto $PLUTO_PROTO --reqid $PLUTO_REQID"
289 IPSEC_POLICY_IN
="$IPSEC_POLICY --dir in"
290 IPSEC_POLICY_OUT
="$IPSEC_POLICY --dir out"
293 # use protocol specific options to set ports
294 case "$PLUTO_MY_PROTOCOL" in
296 ICMP_TYPE_OPTION
="--icmp-type"
299 ICMP_TYPE_OPTION
="--icmpv6-type"
305 # are there port numbers?
306 if [ "$PLUTO_MY_PORT" != 0 ]
308 if [ -n "$ICMP_TYPE_OPTION" ]
310 S_MY_PORT
="$ICMP_TYPE_OPTION $PLUTO_MY_PORT"
311 D_MY_PORT
="$ICMP_TYPE_OPTION $PLUTO_MY_PORT"
313 S_MY_PORT
="--sport $PLUTO_MY_PORT"
314 D_MY_PORT
="--dport $PLUTO_MY_PORT"
317 if [ "$PLUTO_PEER_PORT" != 0 ]
319 if [ -n "$ICMP_TYPE_OPTION" ]
321 # the syntax is --icmp[v6]-type type[/code], so add it to the existing option
322 S_MY_PORT
="$S_MY_PORT/$PLUTO_PEER_PORT"
323 D_MY_PORT
="$D_MY_PORT/$PLUTO_PEER_PORT"
325 S_PEER_PORT
="--sport $PLUTO_PEER_PORT"
326 D_PEER_PORT
="--dport $PLUTO_PEER_PORT"
330 # resolve octal escape sequences
331 PLUTO_MY_ID
=`printf "$PLUTO_MY_ID"`
332 PLUTO_PEER_ID
=`printf "$PLUTO_PEER_ID"`
335 case "$PLUTO_VERB:$1" in
336 prepare-host
:*|prepare-client
:*)
337 if [ -z "$KLIPS" -a -z "$PLUTO_MY_SOURCEIP" ]
339 # exit because no route will be added,
340 # so that existing routes can stay
344 # delete possibly-existing route (preliminary to adding a route)
345 case "$PLUTO_PEER_CLIENT_NET/$PLUTO_PEER_CLIENT_MASK" in
347 # need to provide route that eclipses default, without
351 it
="ip route delete $parms1 2>&1 ; ip route delete $parms2 2>&1"
352 oops
="`ip route delete $parms1 2>&1 ; ip route delete $parms2 2>&1`"
355 parms
="$PLUTO_PEER_CLIENT"
356 it
="ip route delete $parms 2>&1"
357 oops
="`ip route delete $parms 2>&1`"
361 if test " $oops" = " " -a " $status" != " 0"
363 oops
="silent error, exit status $status"
366 *'RTNETLINK answers: No such process'*)
367 # This is what route (currently -- not documented!) gives
368 # for "could not find such a route".
373 if test " $oops" != " " -o " $status" != " 0"
375 echo "$0: \`$it' failed ($oops)" >&2
379 route-host
:*|route-client
:*)
380 # connection to me or my client subnet being routed
383 unroute-host
:*|unroute-client
:*)
384 # connection to me or my client subnet being unrouted
388 # connection to me coming up
389 # If you are doing a custom version, firewall commands go here.
392 # connection to me going down
393 # If you are doing a custom version, firewall commands go here.
396 # connection to my client subnet coming up
397 # If you are doing a custom version, firewall commands go here.
400 # connection to my client subnet going down
401 # If you are doing a custom version, firewall commands go here.
404 # connection to me, with (left/right)firewall=yes, coming up
405 # This is used only by the default updown script, not by your custom
406 # ones, so do not mess with it; see CAUTION comment up at top.
407 iptables
-I INPUT
1 -i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
408 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
409 -d $PLUTO_ME $D_MY_PORT $IPSEC_POLICY_IN -j ACCEPT
410 iptables
-I OUTPUT
1 -o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
411 -s $PLUTO_ME $S_MY_PORT $IPSEC_POLICY_OUT \
412 -d $PLUTO_PEER_CLIENT $D_PEER_PORT -j ACCEPT
414 # log IPsec host connection setup
417 if [ "$PLUTO_PEER_CLIENT" = "$PLUTO_PEER/32" ]
419 logger
-t $TAG -p $FAC_PRIO \
420 "+ $PLUTO_PEER_ID $PLUTO_PEER -- $PLUTO_ME"
422 logger
-t $TAG -p $FAC_PRIO \
423 "+ $PLUTO_PEER_ID $PLUTO_PEER_CLIENT == $PLUTO_PEER -- $PLUTO_ME"
428 # connection to me, with (left/right)firewall=yes, going down
429 # This is used only by the default updown script, not by your custom
430 # ones, so do not mess with it; see CAUTION comment up at top.
431 iptables
-D INPUT
-i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
432 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
433 -d $PLUTO_ME $D_MY_PORT $IPSEC_POLICY_IN -j ACCEPT
434 iptables
-D OUTPUT
-o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
435 -s $PLUTO_ME $S_MY_PORT $IPSEC_POLICY_OUT \
436 -d $PLUTO_PEER_CLIENT $D_PEER_PORT -j ACCEPT
438 # log IPsec host connection teardown
441 if [ "$PLUTO_PEER_CLIENT" = "$PLUTO_PEER/32" ]
443 logger
-t $TAG -p $FAC_PRIO -- \
444 "- $PLUTO_PEER_ID $PLUTO_PEER -- $PLUTO_ME"
446 logger
-t $TAG -p $FAC_PRIO -- \
447 "- $PLUTO_PEER_ID $PLUTO_PEER_CLIENT == $PLUTO_PEER -- $PLUTO_ME"
452 # connection to client subnet, with (left/right)firewall=yes, coming up
453 # This is used only by the default updown script, not by your custom
454 # ones, so do not mess with it; see CAUTION comment up at top.
455 if [ "$PLUTO_PEER_CLIENT" != "$PLUTO_MY_SOURCEIP/32" ]
457 iptables
-I FORWARD
1 -o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
458 -s $PLUTO_MY_CLIENT $S_MY_PORT \
459 -d $PLUTO_PEER_CLIENT $D_PEER_PORT $IPSEC_POLICY_OUT -j ACCEPT
460 iptables
-I FORWARD
1 -i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
461 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
462 -d $PLUTO_MY_CLIENT $D_MY_PORT $IPSEC_POLICY_IN -j ACCEPT
465 # a virtual IP requires an INPUT and OUTPUT rule on the host
466 # or sometimes host access via the internal IP is needed
467 if [ -n "$PLUTO_MY_SOURCEIP" -o -n "$PLUTO_HOST_ACCESS" ]
469 iptables
-I INPUT
1 -i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
470 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
471 -d $PLUTO_MY_CLIENT $D_MY_PORT $IPSEC_POLICY_IN -j ACCEPT
472 iptables
-I OUTPUT
1 -o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
473 -s $PLUTO_MY_CLIENT $S_MY_PORT \
474 -d $PLUTO_PEER_CLIENT $D_PEER_PORT $IPSEC_POLICY_OUT -j ACCEPT
477 # log IPsec client connection setup
480 if [ "$PLUTO_PEER_CLIENT" = "$PLUTO_PEER/32" ]
482 logger
-t $TAG -p $FAC_PRIO \
483 "+ $PLUTO_PEER_ID $PLUTO_PEER -- $PLUTO_ME == $PLUTO_MY_CLIENT"
485 logger
-t $TAG -p $FAC_PRIO \
486 "+ $PLUTO_PEER_ID $PLUTO_PEER_CLIENT == $PLUTO_PEER -- $PLUTO_ME == $PLUTO_MY_CLIENT"
490 down-client
:iptables
)
491 # connection to client subnet, with (left/right)firewall=yes, going down
492 # This is used only by the default updown script, not by your custom
493 # ones, so do not mess with it; see CAUTION comment up at top.
494 if [ "$PLUTO_PEER_CLIENT" != "$PLUTO_MY_SOURCEIP/32" ]
496 iptables
-D FORWARD
-o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
497 -s $PLUTO_MY_CLIENT $S_MY_PORT \
498 -d $PLUTO_PEER_CLIENT $D_PEER_PORT \
499 $IPSEC_POLICY_OUT -j ACCEPT
500 iptables
-D FORWARD
-i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
501 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
502 -d $PLUTO_MY_CLIENT $D_MY_PORT \
503 $IPSEC_POLICY_IN -j ACCEPT
506 # a virtual IP requires an INPUT and OUTPUT rule on the host
507 # or sometimes host access via the internal IP is needed
508 if [ -n "$PLUTO_MY_SOURCEIP" -o -n "$PLUTO_HOST_ACCESS" ]
510 iptables
-D INPUT
-i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
511 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
512 -d $PLUTO_MY_CLIENT $D_MY_PORT \
513 $IPSEC_POLICY_IN -j ACCEPT
514 iptables
-D OUTPUT
-o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
515 -s $PLUTO_MY_CLIENT $S_MY_PORT \
516 -d $PLUTO_PEER_CLIENT $D_PEER_PORT \
517 $IPSEC_POLICY_OUT -j ACCEPT
520 # log IPsec client connection teardown
523 if [ "$PLUTO_PEER_CLIENT" = "$PLUTO_PEER/32" ]
525 logger
-t $TAG -p $FAC_PRIO -- \
526 "- $PLUTO_PEER_ID $PLUTO_PEER -- $PLUTO_ME == $PLUTO_MY_CLIENT"
528 logger
-t $TAG -p $FAC_PRIO -- \
529 "- $PLUTO_PEER_ID $PLUTO_PEER_CLIENT == $PLUTO_PEER -- $PLUTO_ME == $PLUTO_MY_CLIENT"
536 prepare-host-v6
:*|prepare-client-v6
:*)
538 route-host-v6
:*|route-client-v6
:*)
539 # connection to me or my client subnet being routed
542 unroute-host-v6
:*|unroute-client-v6
:*)
543 # connection to me or my client subnet being unrouted
547 # connection to me coming up
548 # If you are doing a custom version, firewall commands go here.
551 # connection to me going down
552 # If you are doing a custom version, firewall commands go here.
555 # connection to my client subnet coming up
556 # If you are doing a custom version, firewall commands go here.
559 # connection to my client subnet going down
560 # If you are doing a custom version, firewall commands go here.
563 # connection to me, with (left/right)firewall=yes, coming up
564 # This is used only by the default updown script, not by your custom
565 # ones, so do not mess with it; see CAUTION comment up at top.
566 ip6tables
-I INPUT
1 -i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
567 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
568 -d $PLUTO_ME $D_MY_PORT $IPSEC_POLICY_IN -j ACCEPT
569 ip6tables
-I OUTPUT
1 -o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
570 -s $PLUTO_ME $S_MY_PORT $IPSEC_POLICY_OUT \
571 -d $PLUTO_PEER_CLIENT $D_PEER_PORT -j ACCEPT
573 # log IPsec host connection setup
576 if [ "$PLUTO_PEER_CLIENT" = "$PLUTO_PEER/128" ]
578 logger
-t $TAG -p $FAC_PRIO \
579 "+ $PLUTO_PEER_ID $PLUTO_PEER -- $PLUTO_ME"
581 logger
-t $TAG -p $FAC_PRIO \
582 "+ $PLUTO_PEER_ID $PLUTO_PEER_CLIENT == $PLUTO_PEER -- $PLUTO_ME"
586 down-host-v6
:iptables
)
587 # connection to me, with (left/right)firewall=yes, going down
588 # This is used only by the default updown script, not by your custom
589 # ones, so do not mess with it; see CAUTION comment up at top.
590 ip6tables
-D INPUT
-i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
591 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
592 -d $PLUTO_ME $D_MY_PORT $IPSEC_POLICY_IN -j ACCEPT
593 ip6tables
-D OUTPUT
-o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
594 -s $PLUTO_ME $S_MY_PORT $IPSEC_POLICY_OUT \
595 -d $PLUTO_PEER_CLIENT $D_PEER_PORT -j ACCEPT
597 # log IPsec host connection teardown
600 if [ "$PLUTO_PEER_CLIENT" = "$PLUTO_PEER/128" ]
602 logger
-t $TAG -p $FAC_PRIO -- \
603 "- $PLUTO_PEER_ID $PLUTO_PEER -- $PLUTO_ME"
605 logger
-t $TAG -p $FAC_PRIO -- \
606 "- $PLUTO_PEER_ID $PLUTO_PEER_CLIENT == $PLUTO_PEER -- $PLUTO_ME"
610 up-client-v6
:iptables
)
611 # connection to client subnet, with (left/right)firewall=yes, coming up
612 # This is used only by the default updown script, not by your custom
613 # ones, so do not mess with it; see CAUTION comment up at top.
614 if [ "$PLUTO_PEER_CLIENT" != "$PLUTO_MY_SOURCEIP/128" ]
616 ip6tables
-I FORWARD
1 -o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
617 -s $PLUTO_MY_CLIENT $S_MY_PORT \
618 -d $PLUTO_PEER_CLIENT $D_PEER_PORT $IPSEC_POLICY_OUT -j ACCEPT
619 ip6tables
-I FORWARD
1 -i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
620 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
621 -d $PLUTO_MY_CLIENT $D_MY_PORT $IPSEC_POLICY_IN -j ACCEPT
624 # a virtual IP requires an INPUT and OUTPUT rule on the host
625 # or sometimes host access via the internal IP is needed
626 if [ -n "$PLUTO_MY_SOURCEIP" -o -n "$PLUTO_HOST_ACCESS" ]
628 ip6tables
-I INPUT
1 -i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
629 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
630 -d $PLUTO_MY_CLIENT $D_MY_PORT $IPSEC_POLICY_IN -j ACCEPT
631 ip6tables
-I OUTPUT
1 -o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
632 -s $PLUTO_MY_CLIENT $S_MY_PORT \
633 -d $PLUTO_PEER_CLIENT $D_PEER_PORT $IPSEC_POLICY_OUT -j ACCEPT
636 # log IPsec client connection setup
639 if [ "$PLUTO_PEER_CLIENT" = "$PLUTO_PEER/128" ]
641 logger
-t $TAG -p $FAC_PRIO \
642 "+ $PLUTO_PEER_ID $PLUTO_PEER -- $PLUTO_ME == $PLUTO_MY_CLIENT"
644 logger
-t $TAG -p $FAC_PRIO \
645 "+ $PLUTO_PEER_ID $PLUTO_PEER_CLIENT == $PLUTO_PEER -- $PLUTO_ME == $PLUTO_MY_CLIENT"
649 down-client-v6
:iptables
)
650 # connection to client subnet, with (left/right)firewall=yes, going down
651 # This is used only by the default updown script, not by your custom
652 # ones, so do not mess with it; see CAUTION comment up at top.
653 if [ "$PLUTO_PEER_CLIENT" != "$PLUTO_MY_SOURCEIP/128" ]
655 ip6tables
-D FORWARD
-o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
656 -s $PLUTO_MY_CLIENT $S_MY_PORT \
657 -d $PLUTO_PEER_CLIENT $D_PEER_PORT \
658 $IPSEC_POLICY_OUT -j ACCEPT
659 ip6tables
-D FORWARD
-i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
660 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
661 -d $PLUTO_MY_CLIENT $D_MY_PORT \
662 $IPSEC_POLICY_IN -j ACCEPT
665 # a virtual IP requires an INPUT and OUTPUT rule on the host
666 # or sometimes host access via the internal IP is needed
667 if [ -n "$PLUTO_MY_SOURCEIP" -o -n "$PLUTO_HOST_ACCESS" ]
669 ip6tables
-D INPUT
-i $PLUTO_INTERFACE -p $PLUTO_MY_PROTOCOL \
670 -s $PLUTO_PEER_CLIENT $S_PEER_PORT \
671 -d $PLUTO_MY_CLIENT $D_MY_PORT \
672 $IPSEC_POLICY_IN -j ACCEPT
673 ip6tables
-D OUTPUT
-o $PLUTO_INTERFACE -p $PLUTO_PEER_PROTOCOL \
674 -s $PLUTO_MY_CLIENT $S_MY_PORT \
675 -d $PLUTO_PEER_CLIENT $D_PEER_PORT \
676 $IPSEC_POLICY_OUT -j ACCEPT
679 # log IPsec client connection teardown
682 if [ "$PLUTO_PEER_CLIENT" = "$PLUTO_PEER/128" ]
684 logger
-t $TAG -p $FAC_PRIO -- \
685 "- $PLUTO_PEER_ID $PLUTO_PEER -- $PLUTO_ME == $PLUTO_MY_CLIENT"
687 logger
-t $TAG -p $FAC_PRIO -- \
688 "- $PLUTO_PEER_ID $PLUTO_PEER_CLIENT == $PLUTO_PEER -- $PLUTO_ME == $PLUTO_MY_CLIENT"
692 *) echo "$0: unknown verb \`$PLUTO_VERB' or parameter \`$1'" >&2