diff --git a/.env b/.env index c503965c..f1b23d2e 100644 --- a/.env +++ b/.env @@ -1,6 +1,6 @@ WG_HOST=🚨YOUR_SERVER_IP PASSWORD=🚨YOUR_ADMIN_PASSWORD -LANG=de +LANGUAGE=en PORT=51821 WG_DEVICE=eth0 WG_PORT=51820 diff --git a/README.md b/README.md index 5da8c0a2..07e4dfe3 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ These options can be configured by setting environment variables using `-e KEY=" | Env | Default | Example | Description | | - | - | - | - | +| `LANGUAGE` | `en` | `de` | Web UI language. List of available languages in [i18n.js]() | | `PORT` | `51821` | `6789` | TCP port for Web UI. | | `WEBUI_HOST` | `0.0.0.0` | `localhost` | IP address web UI binds to. | | `PASSWORD` | - | `foobar123` | When set, requires a password when logging in to the Web UI. | @@ -68,10 +69,20 @@ These options can be configured by setting environment variables using `-e KEY=" | `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range. | | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use. If set to blank value, clients will not use any DNS. | | `WG_ALLOWED_IPS` | `0.0.0.0/0, ::/0` | `192.168.15.0/24, 10.0.1.0/24` | Allowed IPs clients will use. | -| `WG_PRE_UP` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L19) for the default value. | -| `WG_POST_UP` | `...` | `iptables ...` | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L20) for the default value. | -| `WG_PRE_DOWN` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L27) for the default value. | -| `WG_POST_DOWN` | `...` | `iptables ...` | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L28) for the default value. | - -> If you change `WG_PORT`, make sure to also change the exposed port. - +| `WG_PRE_UP` | `...` | - | See [config.js](/src/config.js#L21) for the default value. | +| `WG_POST_UP` | `...` | `iptables ...` | See [config.js](/src/config.js#L22) for the default value. | +| `WG_PRE_DOWN` | `...` | - | See [config.js](/src/config.js#L29) for the default value. | +| `WG_POST_DOWN` | `...` | `iptables ...` | See [config.js](/src/config.js#L30) for the default value. | +| `JC` | `random` | `5` | Junk packet count — number of packets with random data that are sent before the start of the session. | +| `JMIN` | `50` | `25` | Junk packet minimum size — minimum packet size for Junk packet. That is, all randomly generated packets will have a size no smaller than Jmin. | +| `JMAX` | `1000` | `250` | Junk packet maximum size — maximum size for Junk packets. | +| `S1` | `random` | `75` | Init packet junk size — the size of random data that will be added to the init packet, the size of which is initially fixed. | +| `S2` | `random` | `75` | Response packet junk size — the size of random data that will be added to the response packet, the size of which is initially fixed. | +| `H1` | `random` | `59869232` | Init packet magic header — the header of the first byte of the handshake. Must be < uint_max. | +| `H2` | `random` | `869587260` | Response packet magic header — header of the first byte of the handshake response. Must be < uint_max. | +| `H3` | `random` | `1632311713` | Underload packet magic header — UnderLoad packet header. Must be < uint_max. | +| `H4` | `random` | `820711365` | Transport packet magic header — header of the packet of the data packet. Must be < uint_max. | + +## Thanks + +Based on [wg-easy](https://github.com/wg-easy/wg-easy) by Emile Nijssen. diff --git a/src/config.js b/src/config.js index 09fbcf3e..65be0b63 100644 --- a/src/config.js +++ b/src/config.js @@ -28,4 +28,18 @@ iptables -A FORWARD -o wg0 -j ACCEPT; module.exports.WG_PRE_DOWN = process.env.WG_PRE_DOWN || ''; module.exports.WG_POST_DOWN = process.env.WG_POST_DOWN || ''; -module.exports.LANG = process.env.LANG || 'en'; +module.exports.LANG = process.env.LANGUAGE || 'en'; + +const getRandomInt = (min, max) => min + Math.floor(Math.random() * (max - min)); +const getRandomJunkSize = () => getRandomInt(15, 150) +const getRandomHeader = () => getRandomInt(1, 2_147_483_647) + +module.exports.JC = process.env.JC || getRandomInt(3, 10); +module.exports.JMIN = process.env.JMIN || 50; +module.exports.JMAX = process.env.JMAX || 1000; +module.exports.S1 = process.env.S1 || getRandomJunkSize(); +module.exports.S2 = process.env.S2 || getRandomJunkSize(); +module.exports.H1 = process.env.H1 || getRandomHeader(); +module.exports.H2 = process.env.H2 || getRandomHeader(); +module.exports.H3 = process.env.H3 || getRandomHeader(); +module.exports.H4 = process.env.H4 || getRandomHeader(); diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index b9cf6eb5..8daffc87 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -23,6 +23,15 @@ const { WG_POST_UP, WG_PRE_DOWN, WG_POST_DOWN, + JC, + JMIN, + JMAX, + S1, + S2, + H1, + H2, + H3, + H4, } = require('../config'); module.exports = class WireGuard { @@ -46,39 +55,27 @@ module.exports = class WireGuard { 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, + jc: JC, + jmin: JMIN, + jmax: JMAX, + s1: S1, + s2: S2, + h1: H1, + h2: H2, + h3: H3, + h4: H4, }, clients: {}, }; + debug('Configuration generated.'); } @@ -133,6 +130,15 @@ H1 = ${config.server.h1} H2 = ${config.server.h2} H3 = ${config.server.h3} H4 = ${config.server.h4} +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)) { diff --git a/src/www/img/apple-touch-icon.png b/src/www/img/apple-touch-icon.png index bf70e575..7703fcd0 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/index.html b/src/www/index.html index 9d4c5b51..ace5021d 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -40,22 +40,6 @@
-{{$t("updateAvailable")}}
-{{latestRelease.changelog}}
-