1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-24 08:52:15 +02:00

update wireguard

This commit is contained in:
kev 2021-02-03 17:05:06 +08:00
parent d07fcd4bbd
commit 095d1475d1
5 changed files with 49 additions and 64 deletions

View File

@ -392,6 +392,7 @@ A collection of delicious docker recipes.
- [x] wekanteam/wekan
- [x] requarks/wiki
- [x] yourls
- [x] ghcr.io/linuxserver/wireguard
- [x] zookeeper
- [x] elkozmon/zoonavigator

View File

@ -1,13 +0,0 @@
#
# Dockerfile for wireguard-arm
#
FROM arm32v7/alpine
MAINTAINER EasyPi Software Foundation
RUN apk add --no-cache coreutils iptables wireguard-tools
EXPOSE 51820/udp
CMD ["wg", "--help"]

View File

@ -1,39 +1,32 @@
wireguard
=========
## Install Kernel Module
[WireGuard®][1] is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN.
## Up and Running
```bash
$ echo 'deb http://deb.debian.org/debian buster-backports main contrib non-free' > /etc/apt/sources.list.d/buster-backports.list
$ apt update
$ apt install -y dirmngr raspberrypi-kernel-headers
$ echo 'deb http://deb.debian.org/debian/ unstable main' > /etc/apt/sources.list.d/unstable-wireguard.list
$ printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC
$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
$ apt update
$ apt install -y wireguard-dkms
$ modprobe wireguard
$ lsmod | grep wireguard
$ apt install wireguard
$ docker-compose up -d
$ docker-compose logs -f wireguard
$ tree -d
└── data
├── coredns
├── peer1
├── peer2
├── peer3
├── server
└── templates
```
## Generate Keys
## GUI Clients
```bash
$ umask 077
$ wg genkey | tee privatekey | wg pubkey > publickey
```
- Android: https://f-droid.org/en/packages/com.wireguard.android/
- iOS: https://itunes.apple.com/us/app/wireguard/id1441195209
- MacOS: https://itunes.apple.com/us/app/wireguard/id1451685025
- Windows: https://download.wireguard.com/windows-client/
## Create Config
```ini
[Interface]
Address = 192.168.32.1/24
ListenPort = 51820
PrivateKey = SMDPkZPE6R9VyqT3ucxE5v//GnIzzruYC0MPD5efr3w=
PostUp = iptables -t nat -A POSTROUTING -s 192.168.32.0/24 -j MASQUERADE; iptables -t filter -A FORWARD -j ACCEPT
PreDown = iptables -t nat -D POSTROUTING -s 192.168.32.0/24 -j MASQUERADE; iptables -t filter -D FORWARD -j ACCEPT
# [Peer]
# PublicKey = VMK48tEcTLBwzxS+2gx3MH4IRlE7upTKPkYIE/xa7S0=
# AllowedIPs = 192.168.32.2/32
```
[1]: https://www.wireguard.com/

View File

@ -1,10 +0,0 @@
[Interface]
Address = 192.168.32.1/24
ListenPort = 51820
PrivateKey = kNX2ozKebAlSd8P7mbRnm5RPT1/1l9DF05Nes9yjJ3o=
PostUp = iptables -t nat -A POSTROUTING -s 192.168.32.0/24 -j MASQUERADE; iptables -t filter -A FORWARD -j ACCEPT
PreDown = iptables -t nat -D POSTROUTING -s 192.168.32.0/24 -j MASQUERADE; iptables -t filter -D FORWARD -j ACCEPT
[Peer]
PublicKey = vrNjkdY8PT7AFcWr87uhrwuPPDgzNh1KA9zkyRiQSRM=
AllowedIPs = 192.168.32.2/32

View File

@ -1,12 +1,26 @@
wireguard:
image: easypi/wireguard-arm
command: ["sh", "-c", "wg-quick up wg0 && sleep infinity"]
ports:
- "51820:51820/udp"
volumes:
- ./data:/etc/wireguard
- /lib/modules:/lib/modules
cap_add:
- NET_ADMIN
- SYS_MODULE
restart: unless-stopped
version: "3.8"
services:
wireguard:
image: ghcr.io/linuxserver/wireguard
container_name: wireguard
cap_add:
- NET_ADMIN
- SYS_MODULE
environment:
- PUID=1000
- PGID=1000
- TZ=UTC
- SERVERURL=easypi.duckdns.org
- SERVERPORT=51820
- PEERS=3
- PEERDNS=auto
- INTERNAL_SUBNET=10.18.18.0
- ALLOWEDIPS=0.0.0.0/0
volumes:
- ./data:/config
- /lib/modules:/lib/modules
ports:
- 51820:51820/udp
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
restart: unless-stopped