[PR #48] awg genconf command to generate random config parameters #60

Open
opened 2026-10-13 21:02:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amneziawg-tools/pull/48
Author: @vgrebenschikov
Created: 5/21/2026
Status: 🔄 Open

Base: master ← Head: feature/genconf


📝 Commits (2)

  • e4c36f0 Add wg genconf cli command to generate random interface parameters
  • 2a77977 feat: generate AmneziaWG 1/2/3.1 configs from genconf

📊 Changes

8 files changed (+471 additions, -60 deletions)

View changed files

📝 src/completion/wg.bash-completion (+5 -1)
➕ src/genconf.c (+368 -0)
📝 src/genkey.c (+1 -59)
📝 src/man/wg.8 (+11 -0)
➕ src/random.c (+69 -0)
➕ src/random.h (+15 -0)
📝 src/subcommands.h (+1 -0)
📝 src/wg.c (+1 -0)

📄 Description

Generate a base AmneziaWG interface config with random PrivateKey,
ListenPort, junk packet settings, packet junk sizes, and magic headers.

Reuse the existing secure random implementation from genkey, avoid
overlapping magic header ranges, and skip UDP ports that are already bound.

Example of use:

$ awg genconf
[Interface]
ListenPort = 61134
PrivateKey = sLX5RYtVGRMTLNEWP2FaayLNnh71suORV/QkHNaeVF8=
Jc = 12
Jmin = 121
Jmax = 505
S1 = 14
S2 = 14
S3 = 14
S4 = 14
H1 = 2763320278
H2 = 590972797
H3 = 1487575597
H4 = 3525471892
HeaderProtectionKey = ruEF2ZHMk9tI0GNdOfNr4jeZijuCypRRjXOfyGxo5mM=
ContentPaddingAddition = 18-31
RekeyAfterTime = 120-138
RekeyTimeout = 5-6
RejectAfterTime = 183-239
KeepaliveTimeout = 12-14
MaxHandshakeAttempts = 22-37
RandomTrailers = on
DisableCookies = on

$ awg genconf -v2
[Interface]
ListenPort = 18354
PrivateKey = OMun4tlUqxsrkM0qr7BNDIXL5AcZiW0SYgWgU6C1T20=
Jc = 9
Jmin = 100
Jmax = 442
S1 = 434
S2 = 484
S3 = 271
S4 = 15
H1 = 4241571220-4241599444
H2 = 372628373-372667566
H3 = 2962273012-2962285084
H4 = 1423761423-1423772358

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amneziawg-tools/pull/48 **Author:** [@vgrebenschikov](https://github.com/vgrebenschikov) **Created:** 5/21/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `feature/genconf` --- ### 📝 Commits (2) - [`e4c36f0`](https://github.com/amnezia-vpn/amneziawg-tools/commit/e4c36f0d4b73bcc23facea5075a7f42c3044f6e8) Add wg genconf cli command to generate random interface parameters - [`2a77977`](https://github.com/amnezia-vpn/amneziawg-tools/commit/2a77977a5a2dd5c96b6555675ad6ca497c96954d) feat: generate AmneziaWG 1/2/3.1 configs from genconf ### 📊 Changes **8 files changed** (+471 additions, -60 deletions) <details> <summary>View changed files</summary> 📝 `src/completion/wg.bash-completion` (+5 -1) ➕ `src/genconf.c` (+368 -0) 📝 `src/genkey.c` (+1 -59) 📝 `src/man/wg.8` (+11 -0) ➕ `src/random.c` (+69 -0) ➕ `src/random.h` (+15 -0) 📝 `src/subcommands.h` (+1 -0) 📝 `src/wg.c` (+1 -0) </details> ### 📄 Description Generate a base AmneziaWG interface config with random PrivateKey, ListenPort, junk packet settings, packet junk sizes, and magic headers. Reuse the existing secure random implementation from genkey, avoid overlapping magic header ranges, and skip UDP ports that are already bound. Example of use: ```shell $ awg genconf [Interface] ListenPort = 61134 PrivateKey = sLX5RYtVGRMTLNEWP2FaayLNnh71suORV/QkHNaeVF8= Jc = 12 Jmin = 121 Jmax = 505 S1 = 14 S2 = 14 S3 = 14 S4 = 14 H1 = 2763320278 H2 = 590972797 H3 = 1487575597 H4 = 3525471892 HeaderProtectionKey = ruEF2ZHMk9tI0GNdOfNr4jeZijuCypRRjXOfyGxo5mM= ContentPaddingAddition = 18-31 RekeyAfterTime = 120-138 RekeyTimeout = 5-6 RejectAfterTime = 183-239 KeepaliveTimeout = 12-14 MaxHandshakeAttempts = 22-37 RandomTrailers = on DisableCookies = on $ awg genconf -v2 [Interface] ListenPort = 18354 PrivateKey = OMun4tlUqxsrkM0qr7BNDIXL5AcZiW0SYgWgU6C1T20= Jc = 9 Jmin = 100 Jmax = 442 S1 = 434 S2 = 484 S3 = 271 S4 = 15 H1 = 4241571220-4241599444 H2 = 372628373-372667566 H3 = 2962273012-2962285084 H4 = 1423761423-1423772358 ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-tools#60
No description provided.