diff --git a/.env b/.env new file mode 100644 index 00000000..c503965c --- /dev/null +++ b/.env @@ -0,0 +1,9 @@ +WG_HOST=🚨YOUR_SERVER_IP +PASSWORD=🚨YOUR_ADMIN_PASSWORD +LANG=de +PORT=51821 +WG_DEVICE=eth0 +WG_PORT=51820 +WG_DEFAULT_ADDRESS=10.8.0.x +WG_DEFAULT_DNS=1.1.1.1 +WG_ALLOWED_IPS=0.0.0.0/0, ::/0 diff --git a/Dockerfile b/Dockerfile index 985b03e7..aff0b8d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,9 +10,15 @@ RUN npm ci --omit=dev # Copy build result to a new image. # This saves a lot of disk space. -FROM docker.io/library/node:18-alpine +# FROM docker.io/library/node:18-alpine +FROM amneziavpn/amnezia-wg:latest COPY --from=build_node_modules /app /app +# Install Node.js +RUN apk add --no-cache \ + nodejs \ + npm + # Move node_modules one directory up, so during development # we don't have to mount it in a volume. # This results in much faster reloading! @@ -29,9 +35,7 @@ RUN npm i -g nodemon RUN apk add --no-cache \ dpkg \ dumb-init \ - iptables \ - iptables-legacy \ - wireguard-tools + iptables # Use iptables-legacy RUN update-alternatives --install /sbin/iptables iptables /sbin/iptables-legacy 10 --slave /sbin/iptables-restore iptables-restore /sbin/iptables-legacy-restore --slave /sbin/iptables-save iptables-save /sbin/iptables-legacy-save diff --git a/README.md b/README.md index 6c8fe4fc..5da8c0a2 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,6 @@ -# WireGuard Easy +# AmnewziaWG Easy -[](https://github.com/wg-easy/wg-easy/actions/workflows/deploy.yml) -[](https://github.com/wg-easy/wg-easy/actions/workflows/lint.yml) - -[](https://github.com/sponsors/WeeJeWel) - - -You have found the easiest way to install & manage WireGuard on any Linux host! +You have found the easiest way to install & manage AmneziaWG on any Linux host!
@@ -14,10 +8,9 @@ You have found the easiest way to install & manage WireGuard on any Linux host!
## Features
-* All-in-one: WireGuard + Web UI.
+* All-in-one: AmneziaWG + Web UI.
* Easy installation, simple to use.
* List, create, edit, delete, enable & disable clients.
-* Show a client's QR code.
* Download a client's configuration file.
* Statistics for which clients are connected.
* Tx/Rx charts for each connected client.
@@ -26,7 +19,6 @@ You have found the easiest way to install & manage WireGuard on any Linux host!
## Requirements
-* A host with a kernel that supports WireGuard (all modern kernels).
* A host with Docker installed.
## Installation
@@ -43,38 +35,21 @@ $ exit
And log in again.
-### 2. Run WireGuard Easy
-
-To automatically install & run wg-easy, simply run:
-
-
-$ docker run -d \ - --name=wg-easy \ - -e LANG=de \ - -e WG_HOST=🚨YOUR_SERVER_IP \ - -e PASSWORD=🚨YOUR_ADMIN_PASSWORD \ - -v ~/.wg-easy:/etc/wireguard \ - -p 51820:51820/udp \ - -p 51821:51821/tcp \ - --cap-add=NET_ADMIN \ - --cap-add=SYS_MODULE \ - --sysctl="net.ipv4.conf.all.src_valid_mark=1" \ - --sysctl="net.ipv4.ip_forward=1" \ - --restart unless-stopped \ - ghcr.io/wg-easy/wg-easy -- -> 💡 Replace `YOUR_SERVER_IP` with your WAN IP, or a Dynamic DNS hostname. -> -> 💡 Replace `YOUR_ADMIN_PASSWORD` with a password to log in on the Web UI. +### 2. Set environment variables -The Web UI will now be available on `http://0.0.0.0:51821`. +In [.env](.env) set the following environment variables: +- Replace `YOUR_SERVER_IP` with your WAN IP, or a Dynamic DNS hostname. +- Replace `YOUR_ADMIN_PASSWORD` with a password to log in on the Web UI. -> 💡 Your configuration files will be saved in `~/.wg-easy` +### 3. Build & run the Docker image -### 3. Sponsor +```bash +$ docker-compose up -d +``` -Are you enjoying this project? [Buy Emile a beer!](https://github.com/sponsors/WeeJeWel) 🍻 +The Web UI will now be available on `http://0.0.0.0:51821`. + +> 💡 Your configuration files will be saved in `~/.amnezia-wg-easy` ## Options @@ -100,21 +75,3 @@ These options can be configured by setting environment variables using `-e KEY=" > If you change `WG_PORT`, make sure to also change the exposed port. -## Updating - -To update to the latest version, simply run: - -```bash -docker stop wg-easy -docker rm wg-easy -docker pull ghcr.io/wg-easy/wg-easy -``` - -And then run the `docker run -d \ ...` command above again. - -## Common Use Cases - -* [Using WireGuard-Easy with Pi-Hole](https://github.com/wg-easy/wg-easy/wiki/Using-WireGuard-Easy-with-Pi-Hole) -* [Using WireGuard-Easy with nginx/SSL](https://github.com/wg-easy/wg-easy/wiki/Using-WireGuard-Easy-with-nginx-SSL) - -For less common or specific edge-case scenarios, please refer to the detailed information provided in the [Wiki](https://github.com/wg-easy/wg-easy/wiki). diff --git a/assets/screenshot.png b/assets/screenshot.png index c5b73ccb..198097ba 100644 Binary files a/assets/screenshot.png and b/assets/screenshot.png differ diff --git a/assets/wg-easy.sketch b/assets/wg-easy.sketch deleted file mode 100644 index c72b7c3d..00000000 Binary files a/assets/wg-easy.sketch and /dev/null differ diff --git a/docker-compose.yml b/docker-compose.yml index d59aa9cf..9784bc82 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,35 +3,16 @@ volumes: etc_wireguard: services: - wg-easy: - environment: - # Change Language: - # (Supports: en, ru, tr, no, pl, fr, de) - - LANG=de - # ⚠️ Required: - # Change this to your host's public address - - WG_HOST=raspberrypi.local - - # Optional: - # - PASSWORD=foobar123 - # - WG_PORT=51820 - # - WG_DEFAULT_ADDRESS=10.8.0.x - # - WG_DEFAULT_DNS=1.1.1.1 - # - WG_MTU=1420 - # - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24 - # - WG_PERSISTENT_KEEPALIVE=25 - # - WG_PRE_UP=echo "Pre Up" > /etc/wireguard/pre-up.txt - # - WG_POST_UP=echo "Post Up" > /etc/wireguard/post-up.txt - # - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt - # - WG_POST_DOWN=echo "Post Down" > /etc/wireguard/post-down.txt - - image: ghcr.io/wg-easy/wg-easy - container_name: wg-easy + amnezia-wg-easy: + env_file: + - .env + build: . + container_name: amnezia-wg-easy volumes: - - etc_wireguard:/etc/wireguard + - ~/.amnezia-wg-easy:/etc/wireguard ports: - - "51820:51820/udp" - - "51821:51821/tcp" + - "${WG_PORT}:51820/udp" + - "${PORT}:${PORT}/tcp" restart: unless-stopped cap_add: - NET_ADMIN @@ -39,3 +20,5 @@ services: sysctls: - net.ipv4.ip_forward=1 - net.ipv4.conf.all.src_valid_mark=1 + devices: + - /dev/net/tun:/dev/net/tun diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index f72c3a23..b9cf6eb5 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -45,16 +45,40 @@ module.exports = class WireGuard { const publicKey = await Util.exec(`echo ${privateKey} | wg pubkey`, { log: 'echo ***hidden*** | wg pubkey', }); + + const getRandomInt = (min, max) => min + Math.floor(Math.random() * (max - min)); + const getRandomJunkSize = () => getRandomInt(15, 150) + const getRandomHeader = () => getRandomInt(1, 2_147_483_647) + const address = WG_DEFAULT_ADDRESS.replace('x', '1'); + const jc = getRandomInt(3, 10); + const jmin = 50; + const jmax = 1000; + const s1 = getRandomJunkSize(); + const s2 = getRandomJunkSize(); + const h1 = getRandomHeader(); + const h2 = getRandomHeader(); + const h3 = getRandomHeader(); + const h4 = getRandomHeader(); config = { server: { privateKey, publicKey, address, + jc, + jmin, + jmax, + s1, + s2, + h1, + h2, + h3, + h4, }, clients: {}, }; + debug('Configuration generated.'); } @@ -100,6 +124,15 @@ PreUp = ${WG_PRE_UP} PostUp = ${WG_POST_UP} PreDown = ${WG_PRE_DOWN} PostDown = ${WG_POST_DOWN} +Jc = ${config.server.jc} +Jmin = ${config.server.jmin} +Jmax = ${config.server.jmax} +S1 = ${config.server.s1} +S2 = ${config.server.s2} +H1 = ${config.server.h1} +H2 = ${config.server.h2} +H3 = ${config.server.h3} +H4 = ${config.server.h4} `; for (const [clientId, client] of Object.entries(config.clients)) { @@ -198,9 +231,18 @@ AllowedIPs = ${client.address}/32`; return `[Interface] PrivateKey = ${client.privateKey} -Address = ${client.address}/24 +Address = ${client.address} ${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}\n` : ''}\ ${WG_MTU ? `MTU = ${WG_MTU}\n` : ''}\ +Jc = ${config.server.jc} +Jmin = ${config.server.jmin} +Jmax = ${config.server.jmax} +S1 = ${config.server.s1} +S2 = ${config.server.s2} +H1 = ${config.server.h1} +H2 = ${config.server.h2} +H3 = ${config.server.h3} +H4 = ${config.server.h4} [Peer] PublicKey = ${config.server.publicKey} diff --git a/src/www/img/_logo.svg b/src/www/img/_logo.svg new file mode 100644 index 00000000..82df90f1 --- /dev/null +++ b/src/www/img/_logo.svg @@ -0,0 +1,3 @@ + diff --git a/src/www/img/apple-touch-icon.png b/src/www/img/apple-touch-icon.png index 2ebeee55..bf70e575 100644 Binary files a/src/www/img/apple-touch-icon.png and b/src/www/img/apple-touch-icon.png differ diff --git a/src/www/img/favicon.ico b/src/www/img/favicon.ico new file mode 100644 index 00000000..1b607c0e Binary files /dev/null and b/src/www/img/favicon.ico differ diff --git a/src/www/img/favicon.png b/src/www/img/favicon.png deleted file mode 100644 index 470e2e9b..00000000 Binary files a/src/www/img/favicon.png and /dev/null differ diff --git a/src/www/img/logo.png b/src/www/img/logo.png deleted file mode 100644 index 582b1312..00000000 Binary files a/src/www/img/logo.png and /dev/null differ diff --git a/src/www/img/logo.svg b/src/www/img/logo.svg new file mode 100644 index 00000000..e2bad2b6 --- /dev/null +++ b/src/www/img/logo.svg @@ -0,0 +1,33 @@ + diff --git a/src/www/index.html b/src/www/index.html index 2edf3c70..9d4c5b51 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -5,7 +5,7 @@