add wireguard executor script

This commit is contained in:
Ariadne Conill 2020-09-04 12:57:41 -06:00
parent 471549db4b
commit f32481deb9
2 changed files with 18 additions and 1 deletions

View file

@ -84,7 +84,8 @@ EXECUTOR_SCRIPTS_OPT ?= \
bridge \ bridge \
vrf \ vrf \
tunnel \ tunnel \
gre gre \
wireguard
EXECUTOR_SCRIPTS ?= ${EXECUTOR_SCRIPTS_CORE} ${EXECUTOR_SCRIPTS_OPT} EXECUTOR_SCRIPTS ?= ${EXECUTOR_SCRIPTS_CORE} ${EXECUTOR_SCRIPTS_OPT}

View file

@ -0,0 +1,16 @@
#!/bin/sh
set -e
[ -n "$VERBOSE" ] && set -x
[ -z "$IF_WIREGUARD_CONFIG_PATH" ] && IF_WIREGUARD_CONFIG_PATH="/etc/wireguard/$IFACE.conf"
case "$PHASE" in
pre-up)
${MOCK} ip link add $IFACE type wireguard
${MOCK} wg setconf $IFACE $IF_WIREGUARD_CONFIG_PATH
;;
post-down)
${MOCK} ip link delete dev $IFACE
;;
esac