mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
3a6949dfaf
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>
33 lines
594 B
Bash
33 lines
594 B
Bash
#!/bin/sh
|
|
|
|
. /usr/share/libubox/jshn.sh
|
|
. /usr/share/wginstaller/wg_functions.sh
|
|
|
|
case "$1" in
|
|
list)
|
|
cmd='{ "get_usage": {},'
|
|
cmd=$(echo $cmd ' "register": {"uplink_bw":"10", "mtu":"1400", "public_key": "xyz"} }')
|
|
echo $cmd
|
|
;;
|
|
call)
|
|
case "$2" in
|
|
get_usage)
|
|
read input
|
|
logger -t "wginstaller" "call" "$2" "$input"
|
|
wg_get_usage
|
|
;;
|
|
register)
|
|
read input
|
|
logger -t "wginstaller" "call" "$2" "$input"
|
|
|
|
json_load "$input"
|
|
json_get_var uplink_bw uplink_bw
|
|
json_get_var mtu mtu
|
|
json_get_var public_key public_key
|
|
|
|
wg_register $uplink_bw $mtu $public_key
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|