summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Leung <jleung@v10networks.ca>2015-01-31 05:17:48 +0000
committerJeff Leung <jleung@v10networks.ca>2015-01-31 05:17:48 +0000
commit434c1b6f76ddd27dc30ee3f00e8a0f4515ee2185 (patch)
tree793ba1bf46ee6bdca1cb616b625b27f79a7e432a
parent516228ffe2dfdcb8a543c3cfdd991eebb5bb0be1 (diff)
downloadvyatta-op-vpn-434c1b6f76ddd27dc30ee3f00e8a0f4515ee2185.tar.gz
vyatta-op-vpn-434c1b6f76ddd27dc30ee3f00e8a0f4515ee2185.zip
Bring the VPN tunnel down and up as opposed to commenting it out in the ipsec.conf file
Commenting out the tunnel and restoring it does not reset the tunnel. Use the ipsec commands to actually bring it down and back up to properly reset the tunnel.
-rwxr-xr-xscripts/vyatta-vpn-op.pl27
1 files changed, 5 insertions, 22 deletions
diff --git a/scripts/vyatta-vpn-op.pl b/scripts/vyatta-vpn-op.pl
index f862ef7..55ea1d5 100755
--- a/scripts/vyatta-vpn-op.pl
+++ b/scripts/vyatta-vpn-op.pl
@@ -44,28 +44,11 @@ sub clear_tunnel {
my $cmd = undef;
print "Resetting tunnel $tunnel with peer $peer...\n";
-
- # back-up ipsec.conf
- `sudo cp /etc/ipsec.conf /etc/ipsec.conf.bak.\$PPID`;
-
- # remove specific connection from ipsec.conf
- `sudo sed -i -e '/conn peer-$peer-tunnel-$tunnel/,/#conn peer-$peer-tunnel-$tunnel/d' /etc/ipsec.conf`;
-
- # update ipsec connections
- `sudo /usr/sbin/ipsec update >&/dev/null`;
-
- # sleep for 1/4th of a second for connection to go down
- `sudo sleep 0.25`;
-
- # move original ipsec.conf back
- `sudo mv /etc/ipsec.conf.bak.\$PPID /etc/ipsec.conf`;
-
- # update ipsec connections
- `sudo /usr/sbin/ipsec update >&/dev/null`;
-
- # sleep for 3/4th of a second for connection to come up
- # this gives us sometime before bringing clearing another tunnel
- `sudo sleep 0.75`;
+
+ # bring down the tunnel
+ `sudo /usr/sbin/ipsec down peer-$peer-tunnel-$tunnel`;
+ # bring up the tunnel
+ `sudo /usr/sbin/ipsec up peer-$peer-tunnel-$tunnel`;
}
if ($op eq '') {