From d9a71a04b1478e8ab1ec871b25c8bf043f3a85f7 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 28 Nov 2022 00:07:45 +0100 Subject: add a minimal working version --- .dockerignore | 4 + .env | 1 + Dockerfile | 4 + docker-compose.yml | 31 ++++ etc/nginx/conf.d/default.conf | 22 +++ html/index.html | 381 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 443 insertions(+) create mode 100644 .dockerignore create mode 100644 .env create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 etc/nginx/conf.d/default.conf create mode 100644 html/index.html diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b6a4a76 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +* + +!/etc/** +!/html/** diff --git a/.env b/.env new file mode 100644 index 0000000..ff4b014 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +COMPOSE_PROJECT_NAME=wg diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..614f679 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:1-alpine + +COPY ["etc/", "/etc/"] +COPY ["html/", "/usr/share/nginx/html/"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..717c23c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +version: '3.4' + +x-default-settings: + &default-settings + logging: + driver: journald + restart: unless-stopped + +services: + web: + << : *default-settings + build: . + depends_on: [api] + image: egortensin/wg-api-web:latest + ports: + - '8080:80' + api: + << : *default-settings + image: james/wg-api:latest + cap_add: + - NET_ADMIN + network_mode: host + command: wg-api --device vpn --listen 192.168.177.1:1234 + +networks: + default: + driver: bridge + ipam: + driver: default + config: + - subnet: 192.168.177.0/24 diff --git a/etc/nginx/conf.d/default.conf b/etc/nginx/conf.d/default.conf new file mode 100644 index 0000000..176010f --- /dev/null +++ b/etc/nginx/conf.d/default.conf @@ -0,0 +1,22 @@ +upstream backend { + server 192.168.177.1:1234; +} + +server { + listen 80; + listen [::]:80; + + root /usr/share/nginx/html; + + location / { + index index.html; + } + + location ~ ^/api/(?ListPeers|GetDeviceInfo)$ { + proxy_set_header Content-Type application/json; + proxy_set_header Referer ""; + proxy_method POST; + proxy_set_body '{"jsonrpc": "2.0", "method": "$rpc_method", "params": {}}'; + proxy_pass http://backend; + } +} diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..d1cf373 --- /dev/null +++ b/html/index.html @@ -0,0 +1,381 @@ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Device-
Public key-
Listen port-
# of peers-
+ + + + + + + + + + + + + + +
Public keyLast handshakeEndpointRxTxAllowed IPsPreshared key?
+
+ + + -- cgit v1.2.3