wireguard-management/README.md
2023-05-01 16:52:35 +03:00

4.0 KiB

wireguard-management

Wireguard management and monitoring utils.


wg-client-management.sh

Description:

Creating or deleting client config for wireguard and sending config and info to email.

Dependencies:

POSITION PARAMETERS DESCRIPTION DEFAULT
1 add|del add or delete client config REQUIRED
2 <username> client username REQUIRED
3 <address> client ip address REQUIRED
4 [-f],[--force] service will restart after add|del username

Example usage:

# download
sudo wget https://git.hmp.today/pavel.muhortov/wireguard-managemen/raw/branch/master/wg-client-management.sh -O /etc/wireguard/wg-client-management.sh
sudo chmod +x /etc/wireguard/wg-client-management.sh
# create link
ln -s /etc/wireguard/wg-client-management.sh ./wg
# create client
sudo ./wg add username address
# delete client and restart service
sudo  ./wg del username address -f
# check journal
tail -f /var/log/wireguard/wg.log

wg-connect-handling.sh

Description:

Handling client connection and preparing stats for monitoring.

Dependencies:

POSITION PARAMETERS DESCRIPTION DEFAULT
1 </path/to/dir> root path for counter, names, log REQUIRED
2 [mail] send email notification
3 [geo] check client address geolocation

Example usage:

# download
sudo wget https://git.hmp.today/pavel.muhortov/wireguard-managemen/raw/branch/master/wg-connect-handling.sh -O /etc/wireguard/wg-connect-handling.sh
sudo chmod +x /etc/wireguard/wg-connect-handling.sh
# create root path for counter, names, log
sudo mkdir /var/log/wireguard
sudo chown -R root:root /var/log/wireguard
sudo chmod -R 755 /var/log/wireguard
# sudo crontab -e
* * * * * bash /etc/wireguard/wg-connect-handling.sh /var/log/wireguard mail geo
# check counter and names
watch cat /var/log/wireguard/wg-counts.log
# check journal
tail -f /var/log/wireguard/wg-connect-handling.log