# HG changeset patch # User Franz Glasner # Date 1724328447 -7200 # Node ID e2555d5fc61f571722f15ab1bf3b7a9c036e7491 # Parent c65a79d84e9e9200da8f8126b1f5891af6197974 Implement a fwireguard RC variable to manually determine the names of wireguard interfaces to configure to. By default this variable is set to "AUTO" to determine the interfaces automatically. diff -r c65a79d84e9e -r e2555d5fc61f docs/man/man8/fwireguard.rst --- a/docs/man/man8/fwireguard.rst Thu Aug 22 03:34:36 2024 +0200 +++ b/docs/man/man8/fwireguard.rst Thu Aug 22 14:07:27 2024 +0200 @@ -26,10 +26,15 @@ calling the post-start script. Default: 2s - `fwireguard_configdir` Default: /usr/local/etc/fwireguard +`fwireguard_interfaces` + The list of names of the Wireguard interfaces to configure. + + Default: AUTO -- i.e. determine the Wireguard interfaces automatically by + calling :command:`ifconfig -g wg`. + Files ----- diff -r c65a79d84e9e -r e2555d5fc61f files/fwireguard.in --- a/files/fwireguard.in Thu Aug 22 03:34:36 2024 +0200 +++ b/files/fwireguard.in Thu Aug 22 14:07:27 2024 +0200 @@ -33,6 +33,11 @@ : ${fwireguard_enable:="NO"} : ${fwireguard_wait="2s"} : ${fwireguard_configdir:="%%PREFIX%%/etc/fwireguard"} +: ${fwireguard_interfaces="AUTO"} + + +# Automatically expand to the interface names if needed +[ "${fwireguard_interfaces}" = "AUTO" ] && fwireguard_interfaces="$(/sbin/ifconfig -g wg)" fwireguard_start() @@ -42,7 +47,7 @@ if [ ! -d "${fwireguard_configdir}" ]; then mkdir "${fwireguard_configdir}" fi - for _if in `/sbin/ifconfig -g wg`; do + for _if in ${fwireguard_interfaces}; do _f="${fwireguard_configdir}/${_if}.key" if [ ! -f "${_f}" ]; then @@ -91,7 +96,7 @@ { local _if - for _if in `/sbin/ifconfig -g wg`; do + for _if in ${fwireguard_interfaces}; do if [ -x "${fwireguard_configdir}/${_if}.pre-stop" ]; then "${fwireguard_configdir}/${_if}.pre-stop" fi @@ -110,7 +115,7 @@ { local _if - for _if in `/sbin/ifconfig -g wg`; do + for _if in ${fwireguard_interfaces}; do /usr/bin/wg show "${_if}" done }