Browse Source

Added AmneziaWG parameters

pull/1239/head
Viktor Yudov 2 years ago
parent
commit
b9d0e7b6db
  1. 2
      .env
  2. 25
      README.md
  3. 16
      src/config.js
  4. 50
      src/lib/WireGuard.js
  5. BIN
      src/www/img/apple-touch-icon.png
  6. 16
      src/www/index.html

2
.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

25
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.

16
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();

50
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)) {

BIN
src/www/img/apple-touch-icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 14 KiB

16
src/www/index.html

@ -40,22 +40,6 @@
</h1>
<h2 class="text-sm text-gray-400 dark:text-neutral-400 mb-10"></h2>
<div v-if="latestRelease"
class="bg-red-800 dark:bg-red-100 p-4 text-white dark:text-red-600 text-sm font-small mb-10 rounded-md shadow-lg"
:title="`v${currentRelease} → v${latestRelease.version}`">
<div class="container mx-auto flex flex-row flex-auto items-center">
<div class="flex-grow">
<p class="font-bold">{{$t("updateAvailable")}}</p>
<p>{{latestRelease.changelog}}</p>
</div>
<a href="https://github.com/wg-easy/wg-easy#updating" target="_blank"
class="p-3 rounded-md bg-white dark:bg-red-100 float-right font-sm font-semibold text-red-800 dark:text-red-600 flex-shrink-0 border-2 border-red-800 dark:border-red-600 hover:border-white dark:hover:border-red-600 hover:text-white dark:hover:text-red-100 hover:bg-red-800 dark:hover:bg-red-600 transition-all">
{{$t("update")}} →
</a>
</div>
</div>
<div class="shadow-md rounded-lg bg-white dark:bg-neutral-700 overflow-hidden">
<div class="flex flex-row flex-auto items-center p-3 px-5 border-b-2 border-gray-100 dark:border-neutral-600">
<div class="flex-grow">

Loading…
Cancel
Save