diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-03-12 21:24:22 +0100 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-03-12 21:35:58 +0100 |
commit | 3ba44927180453caa1d225d8a2275be382b7cbfb (patch) | |
tree | 67298069bd8f921aeb9516e6c254b5c3b0e1f014 | |
parent | README: update (diff) | |
download | wg-api-web-3ba44927180453caa1d225d8a2275be382b7cbfb.tar.gz wg-api-web-3ba44927180453caa1d225d8a2275be382b7cbfb.zip |
test/linuxserver: add a test configuration
23 files changed, 102 insertions, 4 deletions
diff --git a/test/linuxserver/docker-compose.yml b/test/linuxserver/docker-compose.yml index a2db94d..9713116 100644 --- a/test/linuxserver/docker-compose.yml +++ b/test/linuxserver/docker-compose.yml @@ -21,19 +21,19 @@ services: image: lscr.io/linuxserver/wireguard:latest restart: unless-stopped environment: - - SERVERURL=wireguard.domain.com + - SERVERURL=127.0.0.1 - SERVERPORT=51820 - PEERS=3 - INTERNAL_SUBNET=10.13.13.0 + - PEERDNS=off - LOG_CONFS=true networks: - wg_web_api_network ports: - 51820:51820/udp - '192.168.177.1:1234:1234' - # Uncomment to save configuration to the config/ directory: - #volumes: - # - ./config:/config + volumes: + - ./example_config:/config cap_add: - NET_ADMIN - SYS_MODULE diff --git a/test/linuxserver/example_config/.donoteditthisfile b/test/linuxserver/example_config/.donoteditthisfile new file mode 100644 index 0000000..00bf371 --- /dev/null +++ b/test/linuxserver/example_config/.donoteditthisfile @@ -0,0 +1,7 @@ +ORIG_SERVERURL="127.0.0.1" +ORIG_SERVERPORT="51820" +ORIG_PEERDNS="off" +ORIG_PEERS="3" +ORIG_INTERFACE="10.13.13" +ORIG_ALLOWEDIPS="0.0.0.0/0, ::/0" +ORIG_PERSISTENTKEEPALIVE_PEERS="" diff --git a/test/linuxserver/example_config/coredns/Corefile b/test/linuxserver/example_config/coredns/Corefile new file mode 100644 index 0000000..ded974e --- /dev/null +++ b/test/linuxserver/example_config/coredns/Corefile @@ -0,0 +1,5 @@ +. { + loop + health + forward . /etc/resolv.conf +}
\ No newline at end of file diff --git a/test/linuxserver/example_config/peer1/peer1.conf b/test/linuxserver/example_config/peer1/peer1.conf new file mode 100644 index 0000000..cac141d --- /dev/null +++ b/test/linuxserver/example_config/peer1/peer1.conf @@ -0,0 +1,11 @@ +[Interface] +Address = 10.13.13.2 +PrivateKey = gIdVetT76luLb7rnVx0qwW4sESoUPeF5slPfNW/K4Fg= +ListenPort = 51820 +DNS = off + +[Peer] +PublicKey = qqCJ8qR7mNe6Kkwym7ii979mCaJ2YC+2RYmFQoNVoUc= +PresharedKey = t6OE7dlyynev/QEiPmvQ9YxRew/jTyiKCqGDNWeMCFU= +Endpoint = 127.0.0.1:51820 +AllowedIPs = 0.0.0.0/0, ::/0 diff --git a/test/linuxserver/example_config/peer1/peer1.png b/test/linuxserver/example_config/peer1/peer1.png Binary files differnew file mode 100644 index 0000000..49687d7 --- /dev/null +++ b/test/linuxserver/example_config/peer1/peer1.png diff --git a/test/linuxserver/example_config/peer1/presharedkey-peer1 b/test/linuxserver/example_config/peer1/presharedkey-peer1 new file mode 100644 index 0000000..7075a12 --- /dev/null +++ b/test/linuxserver/example_config/peer1/presharedkey-peer1 @@ -0,0 +1 @@ +t6OE7dlyynev/QEiPmvQ9YxRew/jTyiKCqGDNWeMCFU= diff --git a/test/linuxserver/example_config/peer1/privatekey-peer1 b/test/linuxserver/example_config/peer1/privatekey-peer1 new file mode 100644 index 0000000..059c77d --- /dev/null +++ b/test/linuxserver/example_config/peer1/privatekey-peer1 @@ -0,0 +1 @@ +gIdVetT76luLb7rnVx0qwW4sESoUPeF5slPfNW/K4Fg= diff --git a/test/linuxserver/example_config/peer1/publickey-peer1 b/test/linuxserver/example_config/peer1/publickey-peer1 new file mode 100644 index 0000000..0570083 --- /dev/null +++ b/test/linuxserver/example_config/peer1/publickey-peer1 @@ -0,0 +1 @@ +5K7R+QjsV7nCtDbBMJlujiFuU0Y22VGmg+furfYKCRA= diff --git a/test/linuxserver/example_config/peer2/peer2.conf b/test/linuxserver/example_config/peer2/peer2.conf new file mode 100644 index 0000000..50ec2ff --- /dev/null +++ b/test/linuxserver/example_config/peer2/peer2.conf @@ -0,0 +1,11 @@ +[Interface] +Address = 10.13.13.3 +PrivateKey = OGPxWhhPaVz5ld9umBT/lEjRmbt7mgc4vAxNemKXWnI= +ListenPort = 51820 +DNS = off + +[Peer] +PublicKey = qqCJ8qR7mNe6Kkwym7ii979mCaJ2YC+2RYmFQoNVoUc= +PresharedKey = f386wjXiWLbMMhgI2OZYb/sRSh7oxcDnpeddIqqbmxU= +Endpoint = 127.0.0.1:51820 +AllowedIPs = 0.0.0.0/0, ::/0 diff --git a/test/linuxserver/example_config/peer2/peer2.png b/test/linuxserver/example_config/peer2/peer2.png Binary files differnew file mode 100644 index 0000000..1490540 --- /dev/null +++ b/test/linuxserver/example_config/peer2/peer2.png diff --git a/test/linuxserver/example_config/peer2/presharedkey-peer2 b/test/linuxserver/example_config/peer2/presharedkey-peer2 new file mode 100644 index 0000000..1c4009f --- /dev/null +++ b/test/linuxserver/example_config/peer2/presharedkey-peer2 @@ -0,0 +1 @@ +f386wjXiWLbMMhgI2OZYb/sRSh7oxcDnpeddIqqbmxU= diff --git a/test/linuxserver/example_config/peer2/privatekey-peer2 b/test/linuxserver/example_config/peer2/privatekey-peer2 new file mode 100644 index 0000000..93c894e --- /dev/null +++ b/test/linuxserver/example_config/peer2/privatekey-peer2 @@ -0,0 +1 @@ +OGPxWhhPaVz5ld9umBT/lEjRmbt7mgc4vAxNemKXWnI= diff --git a/test/linuxserver/example_config/peer2/publickey-peer2 b/test/linuxserver/example_config/peer2/publickey-peer2 new file mode 100644 index 0000000..0098116 --- /dev/null +++ b/test/linuxserver/example_config/peer2/publickey-peer2 @@ -0,0 +1 @@ +cUgCQRZpnqKvLd/XcKbGP2kItCWAt+8L475MUMCOTWk= diff --git a/test/linuxserver/example_config/peer3/peer3.conf b/test/linuxserver/example_config/peer3/peer3.conf new file mode 100644 index 0000000..33d7e61 --- /dev/null +++ b/test/linuxserver/example_config/peer3/peer3.conf @@ -0,0 +1,11 @@ +[Interface] +Address = 10.13.13.4 +PrivateKey = sCuYK4YLH0Fsyv3gBQpKCZiuqFEzfdjcCdSVG/KhRGU= +ListenPort = 51820 +DNS = off + +[Peer] +PublicKey = qqCJ8qR7mNe6Kkwym7ii979mCaJ2YC+2RYmFQoNVoUc= +PresharedKey = RISZI5HXufwn2ABJNasT+PjKS+uZ530jlspWJjCpvSk= +Endpoint = 127.0.0.1:51820 +AllowedIPs = 0.0.0.0/0, ::/0 diff --git a/test/linuxserver/example_config/peer3/peer3.png b/test/linuxserver/example_config/peer3/peer3.png Binary files differnew file mode 100644 index 0000000..1373ba4 --- /dev/null +++ b/test/linuxserver/example_config/peer3/peer3.png diff --git a/test/linuxserver/example_config/peer3/presharedkey-peer3 b/test/linuxserver/example_config/peer3/presharedkey-peer3 new file mode 100644 index 0000000..e4effe7 --- /dev/null +++ b/test/linuxserver/example_config/peer3/presharedkey-peer3 @@ -0,0 +1 @@ +RISZI5HXufwn2ABJNasT+PjKS+uZ530jlspWJjCpvSk= diff --git a/test/linuxserver/example_config/peer3/privatekey-peer3 b/test/linuxserver/example_config/peer3/privatekey-peer3 new file mode 100644 index 0000000..9394d70 --- /dev/null +++ b/test/linuxserver/example_config/peer3/privatekey-peer3 @@ -0,0 +1 @@ +sCuYK4YLH0Fsyv3gBQpKCZiuqFEzfdjcCdSVG/KhRGU= diff --git a/test/linuxserver/example_config/peer3/publickey-peer3 b/test/linuxserver/example_config/peer3/publickey-peer3 new file mode 100644 index 0000000..b6e9b33 --- /dev/null +++ b/test/linuxserver/example_config/peer3/publickey-peer3 @@ -0,0 +1 @@ +Nf+DkYmYWtpCC5IPVqorUqHRbxiFaHrrTV8YR4whwAo= diff --git a/test/linuxserver/example_config/server/privatekey-server b/test/linuxserver/example_config/server/privatekey-server new file mode 100644 index 0000000..2321a0f --- /dev/null +++ b/test/linuxserver/example_config/server/privatekey-server @@ -0,0 +1 @@ +8PudiDNyChBnnwRfx21a1qjvCGu1U1H+em9xbepCPXo= diff --git a/test/linuxserver/example_config/server/publickey-server b/test/linuxserver/example_config/server/publickey-server new file mode 100644 index 0000000..1cffa61 --- /dev/null +++ b/test/linuxserver/example_config/server/publickey-server @@ -0,0 +1 @@ +qqCJ8qR7mNe6Kkwym7ii979mCaJ2YC+2RYmFQoNVoUc= diff --git a/test/linuxserver/example_config/templates/peer.conf b/test/linuxserver/example_config/templates/peer.conf new file mode 100644 index 0000000..cd6e3ae --- /dev/null +++ b/test/linuxserver/example_config/templates/peer.conf @@ -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}
\ No newline at end of file diff --git a/test/linuxserver/example_config/templates/server.conf b/test/linuxserver/example_config/templates/server.conf new file mode 100644 index 0000000..757682d --- /dev/null +++ b/test/linuxserver/example_config/templates/server.conf @@ -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 diff --git a/test/linuxserver/example_config/wg0.conf b/test/linuxserver/example_config/wg0.conf new file mode 100644 index 0000000..48954e2 --- /dev/null +++ b/test/linuxserver/example_config/wg0.conf @@ -0,0 +1,25 @@ +[Interface] +Address = 10.13.13.1 +ListenPort = 51820 +PrivateKey = 8PudiDNyChBnnwRfx21a1qjvCGu1U1H+em9xbepCPXo= +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 + +[Peer] +# peer1 +PublicKey = 5K7R+QjsV7nCtDbBMJlujiFuU0Y22VGmg+furfYKCRA= +PresharedKey = t6OE7dlyynev/QEiPmvQ9YxRew/jTyiKCqGDNWeMCFU= +AllowedIPs = 10.13.13.2/32 + +[Peer] +# peer2 +PublicKey = cUgCQRZpnqKvLd/XcKbGP2kItCWAt+8L475MUMCOTWk= +PresharedKey = f386wjXiWLbMMhgI2OZYb/sRSh7oxcDnpeddIqqbmxU= +AllowedIPs = 10.13.13.3/32 + +[Peer] +# peer3 +PublicKey = Nf+DkYmYWtpCC5IPVqorUqHRbxiFaHrrTV8YR4whwAo= +PresharedKey = RISZI5HXufwn2ABJNasT+PjKS+uZ530jlspWJjCpvSk= +AllowedIPs = 10.13.13.4/32 + |