This is a simple wireguard VPN user management script using on VPN server. Client config file and qrcode are generated.
- wireguard
- qrencode
The wireguard default config directory is /etc/wireguard.
-
Copy script
wg-config.def.sampleconfig file/etc/wireguard/wg-config.def. This is the main wg-configs config. -
Copy
client.conf.tpl.sampleto/etc/wireguard/client.conf.tpl -
Copy
server.conf.tpl.sampleto/etc/wireguard/server.conf.tpl -
put
wg-configs.shto your path or any location you wish.
You can generate the public key and private key with command cd /etc/wireguard && wg genkey | tee prikey | wg pubkey > pubkey.
Running as root.
./wg-config.sh -i./wg-config.sh -a aliceThis will generate a client conf and qrcode in users directory which name is alice and add alice to the wg server config.
This will disable default route change. Route traffic Manually.
./wg-config.sh -a alice -rclient will route all traffic to server.
./wg-config.sh -d aliceThis will delete the alice directory and delete alice from the wg server config.
./wg-config.sh -cDelete all users before clear.