aboutsummaryrefslogtreecommitdiff
path: root/net/openvpn/files/etc
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-12-01 12:36:46 -0800
committerRosen Penev <rosenp@gmail.com>2020-12-01 12:37:37 -0800
commit4434915571b5c3dbc7d000215e48d8d0d60e41bc (patch)
tree5c5d7a0b5fe3db1f29475651a0aa2be33ce003a5 /net/openvpn/files/etc
parent0e77d0264e0c800d470581ce32a9d2f315a80fe6 (diff)
openvpn: import from base
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'net/openvpn/files/etc')
-rw-r--r--net/openvpn/files/etc/hotplug.d/openvpn/01-user22
-rw-r--r--net/openvpn/files/etc/openvpn.user11
2 files changed, 33 insertions, 0 deletions
diff --git a/net/openvpn/files/etc/hotplug.d/openvpn/01-user b/net/openvpn/files/etc/hotplug.d/openvpn/01-user
new file mode 100644
index 000000000..f93823e5c
--- /dev/null
+++ b/net/openvpn/files/etc/hotplug.d/openvpn/01-user
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. /lib/functions/openvpn.sh
+
+[ -e "/etc/openvpn.user" ] && {
+ env -i ACTION="$ACTION" INSTANCE="$INSTANCE" \
+ /bin/sh \
+ /etc/openvpn.user \
+ $*
+}
+
+# Wrap user defined scripts on up/down events
+case "$ACTION" in
+ up|down)
+ if get_openvpn_option "$config" command "$ACTION"; then
+ shift
+ exec /bin/sh -c "$command $*"
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/net/openvpn/files/etc/openvpn.user b/net/openvpn/files/etc/openvpn.user
new file mode 100644
index 000000000..a77566556
--- /dev/null
+++ b/net/openvpn/files/etc/openvpn.user
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# This file is interpreted as shell script.
+# Put your custom openvpn action here, they will
+# be executed with each opevnp event.
+#
+# $ACTION
+# <down> down action is generated after the TUN/TAP device is closed
+# <up> up action is generated after the TUN/TAP device is opened
+# $INSTANCE Name of the openvpn instance which went up or down
+