packages/net/wg-installer/common/wg.sh
Nick Hainke 3a6949dfaf wg-installer: add wg-installer
This tool can be used to automatically create wireguard tunnels. Using
rpcd a new wireguard interface is created on the server where the client
can connect to.

Wiregurad server automatically installs a user and associated ACL to use
the wireguard-installer-server features. The user is called wginstaller
and so is the password.

Get Usage:
  wg-client-installer get_usage --ip 127.0.0.1 --user wginstaller
	--password wginstaller

Register Interface:
  wg-client-installer register --ip 127.0.0.1 --user wginstaller
         --password wginstaller --bandwidth 10 --mtu 1400

Signed-off-by: Nick Hainke <vincent@systemli.org>
2021-02-06 22:41:29 +01:00

13 lines
227 B
Bash

next_port () {
local port_start=$1
local port_end=$2
ports=$(wg show all listen-port | awk '{print $2}')
for i in $(seq $port_start $port_end); do
if ! echo $ports | grep -q "$i"; then
echo $i
return
fi
done
}