Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #9 from gsanchietti/issue5760
Browse files Browse the repository at this point in the history
Add nethserver-ipsec-tunnels-modify event.
Allow selective start/stop of single tunnels.

NethServer/dev#5760
  • Loading branch information
gsanchietti committed Jun 6, 2019
2 parents 561a102 + e17b54a commit ea14880
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
13 changes: 13 additions & 0 deletions createlinks
Expand Up @@ -68,3 +68,16 @@ event_services('interface-update', qw(
ipsec restart
));

#
# Event nethserver-ipsec-tunnels-modify
#
event_templates('nethserver-ipsec-tunnels-modify', qw(
/etc/ipsec.d/tunnels.conf
));

event_actions('nethserver-ipsec-tunnels-modify', qw(
nethserver-ipsec-tunnels-edit 40
firewall-adjust 50
trusted-networks-modify 95
));

1 change: 1 addition & 0 deletions nethserver-ipsec-tunnels.spec
Expand Up @@ -9,6 +9,7 @@ BuildArch: noarch

Requires: openswan
Requires: nethserver-firewall-base
Requires: nethserver-vpn-ui

BuildRequires: nethserver-devtools

Expand Down
36 changes: 36 additions & 0 deletions root/etc/e-smith/events/actions/nethserver-ipsec-tunnels-edit
@@ -0,0 +1,36 @@
#
# Copyright (C) 2019 Nethesis S.r.l.
# http://www.nethesis.it - nethserver@nethesis.it
#
# This script is part of NethServer.
#
# NethServer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,
# or any later version.
#
# NethServer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NethServer. If not, see COPYING.
#

event=$1
action=$2
tunnel=$3

if [ -z "$event" ]; then
exit 0
fi

if [ "$action" == "create" ]; then
ipsec auto --start "$tunnel"
elif [ "$action" == "modify" ]; then
ipsec auto --delete "$tunnel"
ipsec auto --start "$tunnel"
elif [ "$action" == "delete" ]; then
ipsec auto --delete "$tunnel"
fi

0 comments on commit ea14880

Please sign in to comment.