Files
Wireguard-Peer-Manager/README.md

61 lines
1.9 KiB
Markdown
Raw Normal View History

2021-05-06 17:36:18 +03:00
# Wireguard-Peer-Manager
2021-05-06 08:30:51 -07:00
![image](https://user-images.githubusercontent.com/4666566/117325184-56f7f800-ae45-11eb-9003-b85aadbf5ff0.png)
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 07:57:21 -07:00
2021-05-06 07:56:00 -07:00
How to use:
```shell
2021-07-07 12:23:30 +03:00
2021-07-06 21:18:47 +03:00
2021-05-06 07:56:00 -07:00
# 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.
2022-05-04 18:51:24 +03:00
$ cd /etc/wireguard
2021-07-07 12:23:30 +03:00
$ git clone https://github.com/house-of-vanity/Wireguard-Peer-Manager wpm
2021-05-06 07:56:00 -07:00
$ 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
2021-07-07 12:23:30 +03:00
$ cd wpm
# install python and system requirements.
$ apt install qrencode python3-pip
$ pip3 install -r requirements.txt
2021-06-15 16:11:06 +03:00
# Create config. It's optionally.
$ cp wpm_example.conf wpm.conf
2021-05-06 07:56:00 -07:00
# 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
2022-04-25 15:18:28 +03:00
$ TG_TOKEN=1292121488:AAG... TG_ADMIN=<comma separated list of usernames> python3 bot.py
2021-05-06 07:56:00 -07:00
```
2021-06-15 16:11:06 +03:00
## Config
Key | Default | Description
------------ | ------------- | ------------
allowed_ips | 0.0.0.0 | allowed_ips for generated peer configs.
dns | 8.8.8.8 | DNS for peer configs
hostname | $(hostname -f) | server address for peer configs. May be an IP.
config | wg0 | WireGuard config to work with.
2021-05-06 16:23:45 -07:00
## Telegram Interface
2021-05-06 16:48:17 -07:00
<img src="https://user-images.githubusercontent.com/4666566/117370133-cc31f000-ae7a-11eb-93fd-a390d2616da8.png" alt="drawing" width="450"/> <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