add wireguard container to compose
This commit is contained in:
@@ -1,23 +1,61 @@
|
||||
services:
|
||||
multicaster:
|
||||
privileged: true # Grants full access to all devices (needed for serial access)
|
||||
# multicaster:
|
||||
# # TODO: make this more restricitive in the future
|
||||
# privileged: true # Grants full access to all devices (for serial access)
|
||||
# restart: unless-stopped
|
||||
# #ports:
|
||||
# # - "5000:5000" # make the multicaster also reachable from the host
|
||||
# build:
|
||||
# dockerfile: Dockerfile
|
||||
# ssh:
|
||||
# #- default=~/.ssh/id_ed25519 #lappi
|
||||
# - default=~/.ssh/id_rsa #raspi
|
||||
# volumes:
|
||||
# - "/dev/serial:/dev/serial"
|
||||
# #devices:
|
||||
# # - /dev/serial/by-id/usb-ZEPHYR_Zephyr_HCI_UART_sample_81BD14B8D71B5662-if00
|
||||
# environment:
|
||||
# LOG_LEVEL: INFO
|
||||
|
||||
# network_mode: service:wireguard
|
||||
|
||||
# command: python ./auracast/multicast_server.py
|
||||
# #command: python ./auracast/multicast.py # continously streaming test app
|
||||
# #networks:
|
||||
# # - default
|
||||
|
||||
wireguard: # TODO: make all privileges in this compose file as tight as possible
|
||||
image: lscr.io/linuxserver/wireguard:latest
|
||||
container_name: wireguard
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "5000:5000"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
ssh:
|
||||
- default=~/.ssh/id_ed25519 #lappi
|
||||
#- default=~/.ssh/id_rsa #raspi
|
||||
volumes:
|
||||
- "/dev/serial:/dev/serial"
|
||||
#devices:
|
||||
# - /dev/serial/by-id/usb-ZEPHYR_Zephyr_HCI_UART_sample_81BD14B8D71B5662-if00
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- SYS_MODULE #optional
|
||||
environment:
|
||||
LOG_LEVEL: INFO
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Europe/Vienna
|
||||
# - SERVERURL=wireguard.domain.com #optional
|
||||
# - SERVERPORT=51820 #optional
|
||||
# - PEERS=1 #optional
|
||||
# - PEERDNS=auto #optional
|
||||
# - INTERNAL_SUBNET=10.13.13.0 #optional
|
||||
# - ALLOWEDIPS=0.0.0.0/0 #optional
|
||||
# - PERSISTENTKEEPALIVE_PEERS= #optional
|
||||
- LOG_CONFS=true #optional
|
||||
volumes:
|
||||
- ./wg_config:/config
|
||||
- /lib/modules:/lib/modules #optional
|
||||
ports:
|
||||
- 51820:51820/udp # TODO: nececcarry ?
|
||||
#- "5000:5000" # make the multicaster also reachable from the host
|
||||
|
||||
command: python ./auracast/multicast_server.py
|
||||
#command: python ./auracast/multicast.py # continously streaming test app
|
||||
sysctls:
|
||||
- net.ipv4.conf.all.src_valid_mark=1
|
||||
networks:
|
||||
- default
|
||||
#- vpn
|
||||
# use docker compose up --build --remove-orphans
|
||||
|
||||
|
||||
# use docker compose up --build
|
||||
networks:
|
||||
vpn:
|
||||
6
wg_config/coredns/Corefile
Normal file
6
wg_config/coredns/Corefile
Normal file
@@ -0,0 +1,6 @@
|
||||
. {
|
||||
loop
|
||||
errors
|
||||
health
|
||||
forward . /etc/resolv.conf
|
||||
}
|
||||
11
wg_config/templates/peer.conf
Normal file
11
wg_config/templates/peer.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[Interface]
|
||||
Address = ${CLIENT_IP}
|
||||
PrivateKey = $(cat /config/${PEER_ID}/privatekey-${PEER_ID})
|
||||
ListenPort = 51820
|
||||
DNS = ${PEERDNS}
|
||||
|
||||
[Peer]
|
||||
PublicKey = $(cat /config/server/publickey-server)
|
||||
PresharedKey = $(cat /config/${PEER_ID}/presharedkey-${PEER_ID})
|
||||
Endpoint = ${SERVERURL}:${SERVERPORT}
|
||||
AllowedIPs = ${ALLOWEDIPS}
|
||||
6
wg_config/templates/server.conf
Normal file
6
wg_config/templates/server.conf
Normal file
@@ -0,0 +1,6 @@
|
||||
[Interface]
|
||||
Address = ${INTERFACE}.1
|
||||
ListenPort = 51820
|
||||
PrivateKey = $(cat /config/server/privatekey-server)
|
||||
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth+ -j MASQUERADE
|
||||
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth+ -j MASQUERADE
|
||||
11
wg_config/wg_confs/peer_raspi.conf
Normal file
11
wg_config/wg_confs/peer_raspi.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[Interface]
|
||||
Address = 10.13.13.2
|
||||
PrivateKey = WJkEh2FDxJxNnqvVyjOs7acI+RlT63zdQ3wrKbi1oE4=
|
||||
ListenPort = 51820
|
||||
DNS = 10.13.13.1
|
||||
|
||||
[Peer]
|
||||
PublicKey = DnLs1PO3sPt61YY6BWOIuh4F8+DU0zHegG8QnpVqxU0=
|
||||
PresharedKey = YmLbW5O76gRlFvnA/ifRpk1Yiao+SilOJDya0K6bjBo=
|
||||
Endpoint = vpn-hinterwaldner.duckdns.org:51821
|
||||
AllowedIPs = 0.0.0.0/0
|
||||
Reference in New Issue
Block a user