Skip to content

Commit 6e2d65e

Browse files
authored
Merge pull request #218 from linuxserver/readme-alpine
2 parents c1396ff + f23ce0f commit 6e2d65e

File tree

6 files changed

+31
-29
lines changed

6 files changed

+31
-29
lines changed

.github/ISSUE_TEMPLATE/issue.bug.yml

100755100644
File mode changed.

.github/ISSUE_TEMPLATE/issue.feature.yml

100755100644
File mode changed.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Comment on invalid interaction
2+
on:
3+
issues:
4+
types:
5+
- labeled
6+
jobs:
7+
add-comment-on-invalid:
8+
if: github.event.label.name == 'invalid'
9+
permissions:
10+
issues: write
11+
uses: linuxserver/github-workflows/.github/workflows/invalid-interaction-helper.yml@v1
12+
secrets: inherit

README.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,10 @@ This image provides various versions that are available via tags. Please read th
7070

7171
During container start, it will first check if the wireguard module is already installed and loaded. Kernels newer than 5.6 generally have the wireguard module built-in (along with some older custom kernels). However, the module may not be enabled. Make sure it is enabled prior to starting the container.
7272

73-
If the kernel is not built-in, or installed on host, the container will check if the kernel headers are present (in `/usr/src`) and if not, it will attempt to download the necessary kernel headers from the `ubuntu xenial/bionic`, `debian/raspbian buster` repos; then will attempt to compile and install the kernel module. If the kernel headers are not found in either `usr/src` or in the repos mentioned, container will sleep indefinitely as wireguard cannot be installed.
74-
75-
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).
76-
77-
With regards to arm32/64 devices, Raspberry Pi 2-4 running the [official ubuntu images](https://ubuntu.com/download/raspberry-pi) or Raspbian Buster are supported out of the box. For all other devices and OSes, you can try installing the kernel headers on the host, and mapping `/usr/src:/usr/src` and it may just work (no guarantees).
78-
79-
This can be run as a server or a client, based on the parameters used.
73+
This can be run as a server or a client, based on the parameters used.
8074

8175
## Server Mode
76+
8277
If the environment variable `PEERS` is set to a number or a list of strings separated by comma, the container will run in server mode and the necessary server and peer/client confs will be generated. The peer/client config qr codes will be output in the docker log. They will also be saved in text and png format under `/config/peerX` in case `PEERS` is a variable and an integer or `/config/peer_X` in case a list of names was provided instead of an integer.
8378

8479
Variables `SERVERURL`, `SERVERPORT`, `INTERNAL_SUBNET` and `PEERDNS` are optional variables used for server mode. Any changes to these environment variables will trigger regeneration of server and peer confs. Peer/client confs will be recreated with existing private/public keys. Delete the peer folders for the keys to be recreated along with the confs.
@@ -90,11 +85,13 @@ To display the QR codes of active peers again, you can use the following command
9085
The templates used for server and peer confs are saved under `/config/templates`. Advanced users can modify these templates and force conf generation by deleting `/config/wg0.conf` and restarting the container.
9186

9287
## Client Mode
88+
9389
Do not set the `PEERS` environment variable. Drop your client conf into the config folder as `/config/wg0.conf` and start the container.
9490

9591
If you get IPv6 related errors in the log and connection cannot be established, edit the `AllowedIPs` line in your peer/client wg0.conf to include only `0.0.0.0/0` and not `::/0`; and restart the container.
9692

9793
## Road warriors, roaming and returning home
94+
9895
If you plan to use Wireguard both remotely and locally, say on your mobile phone, you will need to consider routing. Most firewalls will not route ports forwarded on your WAN interface correctly to the LAN out of the box. This means that when you return home, even though you can see the Wireguard server, the return packets will probably get lost.
9996

10097
This is not a Wireguard specific issue and the two generally accepted solutions are NAT reflection (setting your edge router/firewall up in such a way as it translates internal packets correctly) or split horizon DNS (setting your internal DNS to return the private rather than public IP when connecting locally).
@@ -107,7 +104,7 @@ Both of these approaches have positives and negatives however their setup is out
107104

108105
When routing via Wireguard from another container using the `service` option in docker, you might lose access to the containers webUI locally. To avoid this, exclude the docker subnet from being routed via Wireguard by modifying your `wg0.conf` like so (modifying the subnets as you require):
109106

110-
```
107+
```ini
111108
[Interface]
112109
PrivateKey = <private key>
113110
Address = 9.8.7.6/32
@@ -145,7 +142,6 @@ services:
145142
container_name: wireguard
146143
cap_add:
147144
- NET_ADMIN
148-
- SYS_MODULE
149145
environment:
150146
- PUID=1000
151147
- PGID=1000
@@ -159,7 +155,6 @@ services:
159155
- LOG_CONFS=true #optional
160156
volumes:
161157
- /path/to/appdata/config:/config
162-
- /lib/modules:/lib/modules
163158
ports:
164159
- 51820:51820/udp
165160
sysctls:
@@ -173,7 +168,6 @@ services:
173168
docker run -d \
174169
--name=wireguard \
175170
--cap-add=NET_ADMIN \
176-
--cap-add=SYS_MODULE \
177171
-e PUID=1000 \
178172
-e PGID=1000 \
179173
-e TZ=Europe/London \
@@ -186,7 +180,6 @@ docker run -d \
186180
-e LOG_CONFS=true `#optional` \
187181
-p 51820:51820/udp \
188182
-v /path/to/appdata/config:/config \
189-
-v /lib/modules:/lib/modules \
190183
--sysctl="net.ipv4.conf.all.src_valid_mark=1" \
191184
--restart unless-stopped \
192185
lscr.io/linuxserver/wireguard:alpine
@@ -210,7 +203,6 @@ Container images are configured using parameters passed at runtime (such as thos
210203
| `-e ALLOWEDIPS=0.0.0.0/0` | The IPs/Ranges that the peers will be able to reach using the VPN connection. If not specified the default value is: '0.0.0.0/0, ::0/0' This will cause ALL traffic to route through the VPN, if you want split tunneling, set this to only the IPs you would like to use the tunnel AND the ip of the server's WG ip, such as 10.13.13.1. |
211204
| `-e LOG_CONFS=true` | Generated QR codes will be displayed in the docker log. Set to `false` to skip log output. |
212205
| `-v /config` | Contains all relevant configuration files. |
213-
| `-v /lib/modules` | Maps host's modules folder. |
214206
| `--sysctl=` | Required for client mode. |
215207

216208
### Portainer notice

readme-vars.yml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ param_container_name: "{{ project_name }}"
2525
param_usage_include_vols: true
2626
param_volumes:
2727
- { vol_path: "/config", vol_host_path: "/path/to/appdata/config", desc: "Contains all relevant configuration files." }
28-
- { vol_path: "/lib/modules", vol_host_path: "/lib/modules", desc: "Maps host's modules folder." }
2928
param_usage_include_ports: true
3029
param_ports:
3130
- { external_port: "51820", internal_port: "51820/udp", port_desc: "wireguard port" }
@@ -35,7 +34,6 @@ param_env_vars:
3534
cap_add_param: true
3635
cap_add_param_vars:
3736
- { cap_add_var: "NET_ADMIN" }
38-
- { cap_add_var: "SYS_MODULE" }
3937
custom_params:
4038
- { name: "sysctl", name_compose: "sysctls", value: ["net.ipv4.conf.all.src_valid_mark=1"], desc: "Required for client mode.", array: "true" }
4139

@@ -57,36 +55,33 @@ optional_block_1_items: ""
5755
app_setup_block_enabled: true
5856
app_setup_block: |
5957
During container start, it will first check if the wireguard module is already installed and loaded. Kernels newer than 5.6 generally have the wireguard module built-in (along with some older custom kernels). However, the module may not be enabled. Make sure it is enabled prior to starting the container.
60-
61-
If the kernel is not built-in, or installed on host, the container will check if the kernel headers are present (in `/usr/src`) and if not, it will attempt to download the necessary kernel headers from the `ubuntu xenial/bionic`, `debian/raspbian buster` repos; then will attempt to compile and install the kernel module. If the kernel headers are not found in either `usr/src` or in the repos mentioned, container will sleep indefinitely as wireguard cannot be installed.
62-
63-
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).
64-
65-
With regards to arm32/64 devices, Raspberry Pi 2-4 running the [official ubuntu images](https://ubuntu.com/download/raspberry-pi) or Raspbian Buster are supported out of the box. For all other devices and OSes, you can try installing the kernel headers on the host, and mapping `/usr/src:/usr/src` and it may just work (no guarantees).
6658
67-
This can be run as a server or a client, based on the parameters used.
59+
This can be run as a server or a client, based on the parameters used.
6860
6961
## Server Mode
62+
7063
If the environment variable `PEERS` is set to a number or a list of strings separated by comma, the container will run in server mode and the necessary server and peer/client confs will be generated. The peer/client config qr codes will be output in the docker log. They will also be saved in text and png format under `/config/peerX` in case `PEERS` is a variable and an integer or `/config/peer_X` in case a list of names was provided instead of an integer.
71-
64+
7265
Variables `SERVERURL`, `SERVERPORT`, `INTERNAL_SUBNET` and `PEERDNS` are optional variables used for server mode. Any changes to these environment variables will trigger regeneration of server and peer confs. Peer/client confs will be recreated with existing private/public keys. Delete the peer folders for the keys to be recreated along with the confs.
73-
66+
7467
To add more peers/clients later on, you increment the `PEERS` environment variable or add more elements to the list and recreate the container.
75-
68+
7669
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` or `docker exec -it wireguard /app/show-peer myPC myPhone myTablet` (Keep in mind that the QR codes are also stored as PNGs in the config folder).
7770
7871
The templates used for server and peer confs are saved under `/config/templates`. Advanced users can modify these templates and force conf generation by deleting `/config/wg0.conf` and restarting the container.
7972
8073
## Client Mode
81-
Do not set the `PEERS` environment variable. Drop your client conf into the config folder as `/config/wg0.conf` and start the container.
74+
75+
Do not set the `PEERS` environment variable. Drop your client conf into the config folder as `/config/wg0.conf` and start the container.
8276
8377
If you get IPv6 related errors in the log and connection cannot be established, edit the `AllowedIPs` line in your peer/client wg0.conf to include only `0.0.0.0/0` and not `::/0`; and restart the container.
8478
8579
## Road warriors, roaming and returning home
80+
8681
If you plan to use Wireguard both remotely and locally, say on your mobile phone, you will need to consider routing. Most firewalls will not route ports forwarded on your WAN interface correctly to the LAN out of the box. This means that when you return home, even though you can see the Wireguard server, the return packets will probably get lost.
87-
82+
8883
This is not a Wireguard specific issue and the two generally accepted solutions are NAT reflection (setting your edge router/firewall up in such a way as it translates internal packets correctly) or split horizon DNS (setting your internal DNS to return the private rather than public IP when connecting locally).
89-
84+
9085
Both of these approaches have positives and negatives however their setup is out of scope for this document as everyone's network layout and equipment will be different.
9186
9287
## Maintaining local access to attached services
@@ -95,7 +90,7 @@ app_setup_block: |
9590
9691
When routing via Wireguard from another container using the `service` option in docker, you might lose access to the containers webUI locally. To avoid this, exclude the docker subnet from being routed via Wireguard by modifying your `wg0.conf` like so (modifying the subnets as you require):
9792
98-
```
93+
```ini
9994
[Interface]
10095
PrivateKey = <private key>
10196
Address = 9.8.7.6/32

root/etc/s6-overlay/s6-rc.d/init-wireguard-module/run

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ ip link del dev test 2>/dev/null
88
if ip link add dev test type wireguard; then
99
echo "**** It seems the wireguard module is already active. Skipping kernel header install and module compilation. ****"
1010
ip link del dev test
11+
if capsh --print | grep -qv '\!cap_sys_module'; then
12+
echo "**** As the wireguard module is already active you can remove the SYS_MODULE capability from your container run/compose. ****"
13+
fi
1114
else
1215
echo "**** The wireguard module is not active. If you believe that your kernel should have wireguard support already, make sure that it is activated via modprobe! ****"
1316
sleep infinity

0 commit comments

Comments
 (0)