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>
22 lines
547 B
Bash
22 lines
547 B
Bash
#!/bin/sh
|
|
|
|
# do not override already existing user!!!
|
|
[ "$(uci show rpcd | grep wginstaller)" ] && exit 0
|
|
|
|
# install wginstaller user with standard credentials
|
|
# user: wginstaller
|
|
# password: wginstaller
|
|
uci add rpcd login
|
|
uci set rpcd.@login[-1].username='wginstaller'
|
|
|
|
password=$(uhttpd -m wginstaller)
|
|
uci set rpcd.@login[-1].password=$password
|
|
uci add_list rpcd.@login[-1].read='wginstaller'
|
|
uci add_list rpcd.@login[-1].write='wginstaller'
|
|
uci commit rpcd
|
|
|
|
# restart rpcd
|
|
/etc/init.d/rpcd restart
|
|
|
|
# restart uhttpd
|
|
/etc/init.d/uhttpd restart
|