Skip to content

Commit 198d427

Browse files
authored
Merge pull request #2 from linuxserver/show
add show-peer, add host installed headers info
2 parents f7f9da9 + d6edaf2 commit 198d427

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,18 @@ In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as bel
161161

162162
This image is designed for Ubuntu and Debian x86_64 systems only. During container start, it will download the necessary kernel headers and build the kernel module (until kernel 5.6, which has the module built-in, goes mainstream).
163163

164+
If you're on a debian/ubuntu based host with a custom or downstream distro provided kernel (ie. Pop!_OS), the container won't be able to install the kernel headers from the regular ubuntu and debian repos. In those cases, you can try installing the headers on the host via `sudo apt install linux-headers-$(uname -r)` (if distro version) and then add a volume mapping for `/usr/src:/usr/src`, or if custom built, map the location of the existing headers to allow the container to use host installed headers to build the kernel module (tested successful on Pop!_OS, ymmv).
165+
164166
This can be run as a server or a client, based on the parameters used.
165167

166168
## Server Mode
167169
Pass the environment variables `SERVERURL`, `SERVERPORT`, `PEERS` and `PEERDNS`, and the container will generate all necessary confs for both the server and the clients. The client config qr codes will be output in the docker log. They will also be saved in text and png format under `/config/peerX`.
168170

169171
If there is an existing `/config/wg0.conf`, the above environment variables won't have any affect. To add more peers/clients later on, you can run `docker exec -it wireguard /app/add-peer` while the container is running.
170172

171-
To recreate all serer and client confs, set the above env vars, delete `/config/wg0.conf` and restart the container. Client confs will be recreated with existing private/public keys. Delete the peer folders for the keys to be recreated along with the confs.
173+
To display the QR codes of active peers again, you can use the following command and list the peer numbers as arguments: `docker exec -it wireguard /app/show-peer 1 4 5` (Keep in mind that the QR codes are also stored as PNGs in the config folder).
174+
175+
To recreate all server and client confs, set the above env vars, delete `/config/wg0.conf` and restart the container. Client confs will be recreated with existing private/public keys. Delete the peer folders for the keys to be recreated along with the confs.
172176

173177
## Client Mode
174178
Drop your client conf into the config folder as `/config/wg0.conf` and start the container.
@@ -239,4 +243,5 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
239243

240244
## Versions
241245

246+
* **01.04.20:** - Add `show-peer` script and include info on host installed headers.
242247
* **31.03.20:** - Initial Release.

readme-vars.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,23 @@ app_setup_block_enabled: true
7979
app_setup_block: |
8080
This image is designed for Ubuntu and Debian x86_64 systems only. During container start, it will download the necessary kernel headers and build the kernel module (until kernel 5.6, which has the module built-in, goes mainstream).
8181
82+
If you're on a debian/ubuntu based host with a custom or downstream distro provided kernel (ie. Pop!_OS), the container won't be able to install the kernel headers from the regular ubuntu and debian repos. In those cases, you can try installing the headers on the host via `sudo apt install linux-headers-$(uname -r)` (if distro version) and then add a volume mapping for `/usr/src:/usr/src`, or if custom built, map the location of the existing headers to allow the container to use host installed headers to build the kernel module (tested successful on Pop!_OS, ymmv).
83+
8284
This can be run as a server or a client, based on the parameters used.
8385
8486
## Server Mode
8587
Pass the environment variables `SERVERURL`, `SERVERPORT`, `PEERS` and `PEERDNS`, and the container will generate all necessary confs for both the server and the clients. The client config qr codes will be output in the docker log. They will also be saved in text and png format under `/config/peerX`.
8688
8789
If there is an existing `/config/wg0.conf`, the above environment variables won't have any affect. To add more peers/clients later on, you can run `docker exec -it wireguard /app/add-peer` while the container is running.
8890
89-
To recreate all serer and client confs, set the above env vars, delete `/config/wg0.conf` and restart the container. Client confs will be recreated with existing private/public keys. Delete the peer folders for the keys to be recreated along with the confs.
91+
To display the QR codes of active peers again, you can use the following command and list the peer numbers as arguments: `docker exec -it wireguard /app/show-peer 1 4 5` (Keep in mind that the QR codes are also stored as PNGs in the config folder).
92+
93+
To recreate all server and client confs, set the above env vars, delete `/config/wg0.conf` and restart the container. Client confs will be recreated with existing private/public keys. Delete the peer folders for the keys to be recreated along with the confs.
9094
9195
## Client Mode
9296
Drop your client conf into the config folder as `/config/wg0.conf` and start the container.
9397
9498
# changelog
9599
changelogs:
100+
- { date: "01.04.20:", desc: "Add `show-peer` script and include info on host installed headers." }
96101
- { date: "31.03.20:", desc: "Initial Release." }

root/app/show-peer

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
if [ ! $# -gt 0 ]; then
4+
echo "You need to specify which peers to show"
5+
exit 0
6+
fi
7+
8+
for i in "$@"; do
9+
if grep -q "AllowedIPs = 10.13.13.$(( $i + 1 ))/32" /config/wg0.conf; then
10+
echo "PEER $i QR code:"
11+
qrencode -t ansiutf8 < /config/peer${i}/peer${i}.conf
12+
else
13+
echo "PEER $i is not active"
14+
fi
15+
done

0 commit comments

Comments
 (0)