2021-05-06 17:36:18 +03:00
|
|
|
# Wireguard-Peer-Manager
|
2021-05-06 08:30:51 -07:00
|
|
|

|
2021-05-06 07:56:00 -07:00
|
|
|
|
|
|
|
Adds Wireguard peers to config, reload it and send client config back via Telegram.
|
2021-05-06 07:57:21 -07:00
|
|
|
|
2021-05-06 07:56:00 -07:00
|
|
|
**FYI: That tool stores client private keys into server config as comments.**
|
2021-05-06 08:58:05 -07:00
|
|
|
Is a good idea to update https://github.com/house-of-vanity/Wireguard-Peer-Manager/blob/b914707e06f807b4e57f1c1fa0ffcf903347b013/gen.py#L89
|
2021-05-06 07:57:21 -07:00
|
|
|
|
2021-05-06 07:56:00 -07:00
|
|
|
How to use:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
# create initial wg config or use your own.
|
|
|
|
# P.S. Keep in mind that WPM can't manage peers created my hands
|
|
|
|
# due to absence of client private key.
|
|
|
|
$ cd /etc/wireguard && mkdir clients
|
|
|
|
$ cat > wg0.conf <<EOF
|
|
|
|
[Interface]
|
|
|
|
Address = 10.150.200.1/24
|
|
|
|
ListenPort = 51820
|
|
|
|
PrivateKey = $(wg genkey)
|
|
|
|
PostUp = iptables -A FORWARD -i %i -o %i -j ACCEPT
|
|
|
|
PostDown = iptables -D FORWARD -i %i -o %i -j ACCEPT
|
|
|
|
SaveConfig = false
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# install python and system requirements.
|
|
|
|
$ pip3 install -r requirements.txt
|
|
|
|
$ apt install qrencode
|
|
|
|
|
|
|
|
# CLI usage. Client configs saved into `clients/peer_name.{conf,-qr.png,-qr.txt}`
|
2021-05-06 16:24:11 -07:00
|
|
|
$ python3 gen.py --peer my-pc # add a new peer `my-pc`
|
|
|
|
$ python3 gen.py --delete my-pc # delete peer `my-pc`
|
|
|
|
$ python3 gen.py --update # just regenerate all configs in `clients/`
|
2021-05-06 07:56:00 -07:00
|
|
|
|
|
|
|
# Telegram bot usage
|
|
|
|
$ TG_TOKEN=1292121488:AAG... TG_ADMIN=<your_username> python3 bot.py
|
|
|
|
```
|
2021-05-06 16:23:45 -07:00
|
|
|
## Telegram Interface
|
|
|
|
|
|
|
|
<img src="https://user-images.githubusercontent.com/4666566/117370133-cc31f000-ae7a-11eb-93fd-a390d2616da8.png" alt="drawing" width="350"/> <img src="https://user-images.githubusercontent.com/4666566/117377076-48323500-ae87-11eb-9602-a0cd3072ff53.png" alt="drawing" width="350"/>
|
2021-05-06 14:53:43 -07:00
|
|
|
|
2021-05-06 07:56:00 -07:00
|
|
|
|