Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
changeset 471:e2555d5fc61f
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.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 22 Aug 2024 14:07:27 +0200 |
| parents | c65a79d84e9e |
| children | 692c6357ce39 |
| files | docs/man/man8/fwireguard.rst files/fwireguard.in |
| diffstat | 2 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 -----
--- 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 }
