Skip to content

Commit 0f2fd28

Browse files
committed
WireGuard - experimental branch - PR 3 of 3
Adds service definition from [IOTstack tutorial: Quick and Dirty WireGuard](https://gist.github.com/Paraphraser/f46014b8a27e3f878f07657d6db4490e) gist, with two differences. Instead of hard-coding the following environment variables: ``` - SERVERURL=your.dynamic.dns.name - SERVERPORT=51820 ``` this PR follows the convention of using the `Unset` key: ``` - SERVERURL=Unset - SERVERPORT=Unset ``` Adds same `duck.sh` proposed in PR 1 of 3 in this PR group. No changes to documentation. I'm assuming there will be appropriate consolidation and rewriting of documentation as `experimental` approaches mainstream.
1 parent 293aedd commit 0f2fd28

File tree

2 files changed

+42
-24
lines changed

2 files changed

+42
-24
lines changed
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
wireguard:
2-
image: linuxserver/wireguard
32
container_name: wireguard
4-
cap_add:
5-
- NET_ADMIN
6-
- SYS_MODULE
3+
image: ghcr.io/linuxserver/wireguard
4+
restart: unless-stopped
75
environment:
8-
- PUID=1000
9-
- PGID=1000
10-
- TZ=Etc/UTC
11-
- SERVERURL=Unset
12-
- SERVERPORT=Unset
13-
- PEERS=1
14-
- PEERDNS=auto
15-
- INTERNAL_SUBNET=100.64.0.0/24
16-
volumes:
17-
- ./services/wireguard/config:/config
18-
- /lib/modules:/lib/modules
6+
- PUID=1000
7+
- PGID=1000
8+
- TZ=Etc/UTC
9+
- SERVERURL=Unset
10+
- SERVERPORT=Unset
11+
- PEERS=laptop,phone,tablet
12+
- PEERDNS=auto
13+
# - INTERNAL_SUBNET=100.64.0.0/24
14+
- ALLOWEDIPS=0.0.0.0/0
1915
ports:
20-
- "51820:51820/udp"
16+
- "51820:51820/udp"
17+
volumes:
18+
- ./volumes/wireguard:/config
19+
- /lib/modules:/lib/modules:ro
20+
cap_add:
21+
- NET_ADMIN
22+
- SYS_MODULE
2123
sysctls:
22-
- net.ipv4.conf.all.src_valid_mark=1
23-
restart: unless-stopped
24+
- net.ipv4.conf.all.src_valid_mark=1

scripts/host_installers/duck.sh

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
1-
#!/bin/bash
2-
# Your comma-separated domains list
3-
DOMAINS="YOUR_DOMAINS"
1+
#!/usr/bin/env bash
2+
3+
# Your DuckDNS domain (or comma-separated list of DuckDNS domains if you
4+
# have multiple domains associated with the same IP address).
5+
DOMAINS="YOURS.duckdns.org"
6+
47
# Your DuckDNS Token
58
DUCKDNS_TOKEN="YOUR_DUCKDNS_TOKEN"
69

7-
# A random delay to avoid every client contacting the duckdns server at the same moment
8-
sleep $((RANDOM % 60))
10+
# is this script running in the foreground or background?
11+
if [ "$(tty)" = "not a tty" ] ; then
12+
13+
# background! Assume launched by cron. Add a random delay to avoid
14+
# every client contacting DuckDNS at exactly the same moment.
15+
sleep $((RANDOM % 60))
16+
17+
fi
18+
19+
# mark the event in case this is being logged.
20+
echo "$(date "+%a, %d %b %Y %H:%M:%S %z") - updating DuckDNS"
21+
922
# Request duckdns to update your domain name with your public IP address
10-
curl --silent --max-time 10 --output /dev/null "https://www.duckdns.org/update?domains=${DOMAINS}&token=${DUCKDNS_TOKEN}&ip="
23+
curl --max-time 10 \
24+
"https://www.duckdns.org/update?domains=${DOMAINS}&token=${DUCKDNS_TOKEN}&ip="
25+
26+
# curl does not append newline so fix that
27+
echo ""

0 commit comments

Comments
 (0)