[GH-ISSUE #6407] AmneziaWG: empty client allowedIPs silently drops the whole inbound (no logs); server keys silently regenerate on update without explicit keys #4340

Closed
opened 2026-10-31 20:38:57 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @ARBlazeAG on GitHub (Sep 4, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6407

Environment

  • 3x-ui dev channel, reproduced on dev+38dd9bcc and re-confirmed unchanged on dev+3ef06b70 (2026-09-04), after upstream commits e95fe80f (fix(amneziawg): avoid manager lock inversion) and bd1c27b0 (fix(amneziawg): H1-H4 generator + queue-depth throughput fixes) had already landed.
  • Reproduced entirely through the REST API (POST /panel/api/inbounds/add, POST /panel/api/inbounds/update/{id}), not the web UI.

Bug 1 — empty allowedIPs on a client silently drops the entire AmneziaWG instance

Steps to reproduce:

  1. POST /panel/api/inbounds/add with protocol: "amneziawg", a valid settings.server block, and one client in settings.clients with allowedIPs: [] (empty array) and otherwise-valid keys.
  2. API responds 200 OK, "success": true, and the inbound is saved with enable: true.
  3. Wait past the @every 10s AmneziaWGJob reconcile cycle.
  4. Check POST /panel/api/server/amneziawglogs/{count} → {"peers":[],"events":[],"running":false}.
  5. ss -ulnp on the host confirms no UDP socket was ever opened for that inbound's port.
  6. journalctl -u x-ui has zero lines mentioning the inbound, the interface, or any error — nothing to diagnose by.

Expected: either the documented auto-assignment behaviour (amneziawg.mdx: "Leave empty to auto-assign") actually happens server-side when creating/updating via the API, or the API rejects the empty allowedIPs with a clear validation error at save time.

Actual: the inbound is silently never brought up, with no error surfaced anywhere (API response, panel UI event log, or systemd journal).

Root cause (traced in source): internal/amneziawg/instance.go, InstanceFromInbound:

for _, c := range parsed.Clients {
    if !c.Enable || c.PublicKey == "" || len(c.AllowedIPs) == 0 {
        continue
    }
    ...
}
if len(peers) == 0 {
    return Instance{}, false
}

A client with empty AllowedIPs is skipped from peers; if that empties the whole peer list, the entire instance is dropped (ok=false). The caller, DesiredAmneziaWGInstances in internal/web/service/inbound_amneziawg.go, does not log anything when InstanceFromInbound returns false — so there's no trace at any log level explaining why an enabled inbound never starts.

The "leave empty to auto-assign" behaviour documented in amneziawg.mdx appears to only be implemented client-side in the React form (which fills the field before submit), not enforced or auto-filled server-side, so any non-UI API consumer silently loses the whole inbound.

Suggested fix: either (a) implement the documented auto-assignment at the API/DB layer (next free host in the interface's subnet) so it's consistent regardless of caller, or (b) at minimum, log a Warning in AmneziaWGJob.Run / DesiredAmneziaWGInstances naming the inbound id/tag that was skipped and why, so this doesn't look identical to "the reconcile job silently isn't running at all."

Bug 2 — server keypair silently regenerates on update if server.privateKey/publicKey are omitted

Steps to reproduce:

  1. Create an amneziawg inbound (note settings.server.publicKey from the response).
  2. POST /panel/api/inbounds/update/{id} with a settings.server object that sets obfuscation params (jc/jmin/jmax/etc.) but omits privateKey/publicKey entirely (only touching unrelated fields, e.g. toggling randomTrailers).
  3. GET /panel/api/inbounds/get/{id} afterward.

Expected: the existing server keypair is preserved, since the caller didn't ask to change it — matching how e.g. a VLESS client's UUID isn't rotated by an unrelated field edit.

Actual: settings.server.publicKey/privateKey are silently replaced with a brand-new keypair on every update call that doesn't explicitly re-send the current keys. This instantly invalidates every already-distributed client .conf for that inbound (wrong server public key), with no warning anywhere in the API response or logs.

Suggested fix: on update, if server.privateKey/publicKey are empty/absent in the request body, load and keep the currently-stored values instead of generating a new pair. Only regenerate on an explicit "regenerate keys" action (mirroring how most other protocol fields already work — omitting a field on update shouldn't implicitly mean "replace with a fresh random value").

Why this matters together

Both bugs share the same shape: a value that's fine to omit conceptually ("leave empty for default/auto/unchanged") is instead either fatal (bug 1) or destructively regenerated (bug 2), and neither failure mode is observable in logs. Anyone driving this API programmatically (or scripting bulk client management) will lose inbounds or break existing clients without any error to act on. Happy to provide the exact curl reproduction sequences (payloads + responses) if useful.

Originally created by @ARBlazeAG on GitHub (Sep 4, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6407 ### Environment - 3x-ui dev channel, reproduced on `dev+38dd9bcc` and re-confirmed unchanged on `dev+3ef06b70` (2026-09-04), after upstream commits `e95fe80f` (fix(amneziawg): avoid manager lock inversion) and `bd1c27b0` (fix(amneziawg): H1-H4 generator + queue-depth throughput fixes) had already landed. - Reproduced entirely through the REST API (`POST /panel/api/inbounds/add`, `POST /panel/api/inbounds/update/{id}`), not the web UI. ### Bug 1 — empty `allowedIPs` on a client silently drops the entire AmneziaWG instance **Steps to reproduce:** 1. `POST /panel/api/inbounds/add` with `protocol: "amneziawg"`, a valid `settings.server` block, and one client in `settings.clients` with `allowedIPs: []` (empty array) and otherwise-valid keys. 2. API responds `200 OK`, `"success": true`, and the inbound is saved with `enable: true`. 3. Wait past the `@every 10s` `AmneziaWGJob` reconcile cycle. 4. Check `POST /panel/api/server/amneziawglogs/{count}` → `{"peers":[],"events":[],"running":false}`. 5. `ss -ulnp` on the host confirms no UDP socket was ever opened for that inbound's port. 6. `journalctl -u x-ui` has zero lines mentioning the inbound, the interface, or any error — nothing to diagnose by. **Expected:** either the documented auto-assignment behaviour (`amneziawg.mdx`: "Leave empty to auto-assign") actually happens server-side when creating/updating via the API, or the API rejects the empty `allowedIPs` with a clear validation error at save time. **Actual:** the inbound is silently never brought up, with no error surfaced anywhere (API response, panel UI event log, or systemd journal). **Root cause (traced in source):** `internal/amneziawg/instance.go`, `InstanceFromInbound`: ```go for _, c := range parsed.Clients { if !c.Enable || c.PublicKey == "" || len(c.AllowedIPs) == 0 { continue } ... } if len(peers) == 0 { return Instance{}, false } ``` A client with empty `AllowedIPs` is skipped from `peers`; if that empties the whole peer list, the **entire instance** is dropped (`ok=false`). The caller, `DesiredAmneziaWGInstances` in `internal/web/service/inbound_amneziawg.go`, does not log anything when `InstanceFromInbound` returns `false` — so there's no trace at any log level explaining why an *enabled* inbound never starts. The "leave empty to auto-assign" behaviour documented in `amneziawg.mdx` appears to only be implemented client-side in the React form (which fills the field before submit), not enforced or auto-filled server-side, so any non-UI API consumer silently loses the whole inbound. **Suggested fix:** either (a) implement the documented auto-assignment at the API/DB layer (next free host in the interface's subnet) so it's consistent regardless of caller, or (b) at minimum, log a `Warning` in `AmneziaWGJob.Run` / `DesiredAmneziaWGInstances` naming the inbound id/tag that was skipped and why, so this doesn't look identical to "the reconcile job silently isn't running at all." ### Bug 2 — server keypair silently regenerates on `update` if `server.privateKey`/`publicKey` are omitted **Steps to reproduce:** 1. Create an amneziawg inbound (note `settings.server.publicKey` from the response). 2. `POST /panel/api/inbounds/update/{id}` with a `settings.server` object that sets obfuscation params (jc/jmin/jmax/etc.) but **omits** `privateKey`/`publicKey` entirely (only touching unrelated fields, e.g. toggling `randomTrailers`). 3. `GET /panel/api/inbounds/get/{id}` afterward. **Expected:** the existing server keypair is preserved, since the caller didn't ask to change it — matching how e.g. a VLESS client's UUID isn't rotated by an unrelated field edit. **Actual:** `settings.server.publicKey`/`privateKey` are silently replaced with a brand-new keypair on every `update` call that doesn't explicitly re-send the current keys. This instantly invalidates every already-distributed client `.conf` for that inbound (wrong server public key), with no warning anywhere in the API response or logs. **Suggested fix:** on update, if `server.privateKey`/`publicKey` are empty/absent in the request body, load and keep the currently-stored values instead of generating a new pair. Only regenerate on an explicit "regenerate keys" action (mirroring how most other protocol fields already work — omitting a field on update shouldn't implicitly mean "replace with a fresh random value"). ### Why this matters together Both bugs share the same shape: a value that's fine to omit *conceptually* ("leave empty for default/auto/unchanged") is instead either fatal (bug 1) or destructively regenerated (bug 2), and neither failure mode is observable in logs. Anyone driving this API programmatically (or scripting bulk client management) will lose inbounds or break existing clients without any error to act on. Happy to provide the exact `curl` reproduction sequences (payloads + responses) if useful.
bsakaguchi 2026-10-31 20:38:57 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Sep 4, 2026):

Both are real and both are still present at the tip (3ef06b70), but your causal reading needs two corrections: the "leave empty to auto-assign" behaviour is implemented server-side — just on a different endpoint than the one you used — and the second problem is sharper than "keys are not preserved", because privateKey-without-publicKey silently blanks the server public key entirely.


Bug 1 — empty allowedIPs accepted at save, then silently dropped at reconcile

Confirmed. The save path for /panel/api/inbounds/add and /update/{id} never checks that a client ended up with a usable address:

// internal/web/service/inbound_amneziawg.go:264-268 (normalizeAmneziaWGSettings)
normalized, err := normalizeWireguardAllowedIPs(c.AllowedIPs)
if err != nil {
    return fmt.Errorf("amneziawg: client %q: %w", c.Email, err)
}
c.AllowedIPs = normalized

normalizeWireguardAllowedIPs skips blanks and returns an empty slice with a nil error (internal/web/service/client_wireguard.go:136-140), so [] survives validation. Then internal/amneziawg/instance.go:39 skips the peer and :50-52 drops the instance:

if !c.Enable || c.PublicKey == "" || len(c.AllowedIPs) == 0 {
    continue
}
...
if len(peers) == 0 {
    return Instance{}, false
}

DesiredAmneziaWGInstances swallows the false at internal/web/service/inbound_amneziawg.go:62-65 (a bare continue), and AmneziaWGJob.Run only logs when the query fails (internal/web/job/amneziawg_job.go:32-35). Your "zero lines in the journal" observation matches the code exactly.

Where your attribution is off: "Leave empty to auto-assign" is not from amneziawg.mdx — it is the client-form hint pages.clients.amneziaWgAllowedIPsHint (internal/web/translation/en-US.json:874, rendered at frontend/src/pages/clients/ClientFormModal.tsx:1253). And it is not frontend-only: the allocation runs in Go, in defaultAmneziaWGClients (internal/web/service/client_amneziawg.go:70-87), whose sole caller is AddInboundClient (internal/web/service/client_inbound_apply.go:409). That is the /panel/api/clients/add path, documented at frontend/src/pages/api-docs/endpoints.ts:1031-1036 ("Per-protocol secrets are generated server-side when omitted… plus allowedIPs: one free /32…").

So the gap is specific: the whole-inbound endpoints do not run that allocator, and do not reject an empty allowedIPs either.

Workaround today — create the inbound with "clients": [], then attach clients through the endpoint that does allocate:

curl -sk -X POST "$PANEL/panel/api/clients/add" \
  -H 'Content-Type: application/json' \
  -d '{"client":{"email":"alice@example.com","enable":true},"inboundIds":[7]}'

Or send an explicit allowedIPs (e.g. ["10.8.1.2/32"]) inside inbounds/add.


Bug 2 — a server block without privateKey gets a brand-new random keypair

Confirmed, with a caveat about why it happens, and one failure mode you did not hit that is worse.

// internal/web/service/inbound_amneziawg.go:196-200
} else if parsed.Server.PrivateKey == "" {
    if err := fillAmneziaWGServerKeys(parsed.Server); err != nil {
        return err
    }
}

fillAmneziaWGServerKeys (:152-160) overwrites both PrivateKey and PublicKey. UpdateInbound calls the normalizer at internal/web/service/inbound.go:1476, seventeen lines before it loads oldInbound at :1493, so there is nothing stored to fall back to at that point. Nothing in internal/web/controller/inbound.go:226-257 merges either.

The caveat: /panel/api/inbounds/update/{id} is a documented whole-row replace, not a patch — frontend/src/pages/api-docs/endpoints.ts:63 says so in a comment ("/inbounds/update replaces the whole row, so it takes the same payload as /add") and :296 repeats it ("Replace an inbound's configuration. Body shape mirrors /add"). Your VLESS analogy does not hold: the same call with clients omitted deletes every client and its client_traffics row (internal/web/service/inbound.go:1886-1901). Under those semantics, an omitted field being lost is the rule, not the exception.

What is still a defect is that the lost keypair is replaced with a fresh random value instead of being rejected — the function's own comment (:163-164) scopes that generation to "first save", but the code runs it identically on every update. And the gate is asymmetric in a way that is worse than what you reported: it fires only on PrivateKey == "", so a payload that sends privateKey but omits publicKey passes validation untouched (ValidateConfigValue at internal/amneziawg/params.go:281-288 only rejects control characters) and leaves the server public key empty. Every .conf built from it then carries a blank line:

// frontend/src/pages/clients/amneziawgConfig.ts:104
lines.push('[Peer]', `PublicKey = ${server?.publicKey || ''}`);

There is no code anywhere that derives the server's publicKey from its privateKey — wgutil.PublicKeyFromPrivate is used for clients only (internal/web/service/client_amneziawg.go:63-69), whose comment states the opposite intent for peers: "Existing values are never overwritten, so an edit never rotates keys."

Workaround today — read the inbound back and re-send its stored settings verbatim. GET /panel/api/inbounds/get/{id} does not redact privateKey (GetInboundDetail, internal/web/service/inbound.go:1332-1342, returns the raw row); the redaction you may have seen applies only to GET /panel/api/inbounds/options (inboundAmneziaWGServer, :437-439).


Verdict: Confirmed bug
Severity: High
Confidence: High
Root cause: (1) normalizeAmneziaWGSettings, internal/web/service/inbound_amneziawg.go:264-268 — the per-client loop canonicalizes allowedIPs but never rejects or allocates an empty one, so internal/amneziawg/instance.go:39 skips the peer and :50-52 drops the whole instance, with the only two observers (inbound_amneziawg.go:62-65, internal/web/job/amneziawg_job.go:32-35) staying silent. Triggered by any /panel/api/inbounds/add|update/{id} payload whose amneziawg clients all carry an empty allowedIPs; the panel UI never hits it because its client form posts to /panel/api/clients/add, which allocates via defaultAmneziaWGClients (client_amneziawg.go:70-87). (2) normalizeAmneziaWGSettings, internal/web/service/inbound_amneziawg.go:196-200 — fillAmneziaWGServerKeys is gated only on PrivateKey == "" and runs before UpdateInbound loads the stored row (inbound.go:1476 vs :1493), so an update whose server block omits privateKey mints a new keypair, and one that sends privateKey without publicKey leaves the public key blank. Both introduced by effcccce "feat(amneziawg): add native AmneziaWG protocol support (#6105)" (2026-08-24), the commit that created both files.
Already fixed: Still present on the default branch (3ef06b70). git log -- internal/amneziawg/instance.go and -- internal/web/service/inbound_amneziawg.go each return only effcccce; nothing has touched either path since.
Duplicate of: None. Related: #6372 (WG/AWG peer data lost on a client edit) — same class of silent peer-credential loss, different path (client_inbound_apply.go, per-inbound peer fields), not a shared root cause.
Evidence: internal/amneziawg/instance.go:39,50-52; internal/web/service/client_wireguard.go:136-140 (empty in → empty out, nil error); internal/web/service/inbound_amneziawg.go:62-65,152-160,163-164,196-200,264-268; internal/web/job/amneziawg_job.go:32-35; internal/web/service/inbound.go:1332-1342,1476,1493,1886-1901; internal/web/service/client_amneziawg.go:38-39,63-69,70-87; internal/web/service/client_inbound_apply.go:409; internal/amneziawg/params.go:281-288; frontend/src/pages/clients/amneziawgConfig.ts:104; frontend/src/pages/api-docs/endpoints.ts:63,296,1031-1036; internal/web/translation/en-US.json:874. No test pins either behaviour: internal/web/service/inbound_amneziawg_test.go covers allowedIPs canonicalization (TestNormalizeAmneziaWGSettings_CanonicalizesClientAllowedIPs) and newline injection (..._RejectsInjectedClientAllowedIPs), but nothing for an empty list, and TestNormalizeAmneziaWGSettings_GeneratesFull31Set only asserts the empty-settings/first-save path.
Not determined: Nothing material. I could not run the panel here, so the ss -ulnp and journalctl observations are yours, not mine — but they are what the cited code paths predict, so I did not treat them as needing independent confirmation.

Suggested fix: In normalizeAmneziaWGSettings, treat an amneziawg client whose allowedIPs normalizes to empty as a validation error naming the client, the same way the injection and collision checks already do, rather than letting a dead peer reach InstanceFromInbound. For the server block, derive publicKey from privateKey when only the private half was sent, and gate fillAmneziaWGServerKeys on "no keys at all" so a half-supplied pair fails loudly instead of producing a blank PublicKey =.

@MHSanaei — flagging this one: silent, unlogged loss of an AmneziaWG inbound on one path, and silent rotation/blanking of the server keypair on the other, both reachable from the documented REST API.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5540242561 --> @github-actions[bot] commented on GitHub (Sep 4, 2026): Both are real and both are still present at the tip (`3ef06b70`), but your causal reading needs two corrections: the "leave empty to auto-assign" behaviour **is** implemented server-side — just on a different endpoint than the one you used — and the second problem is sharper than "keys are not preserved", because `privateKey`-without-`publicKey` silently blanks the server public key entirely. --- ## Bug 1 — empty `allowedIPs` accepted at save, then silently dropped at reconcile Confirmed. The save path for `/panel/api/inbounds/add` and `/update/{id}` never checks that a client ended up with a usable address: ```go // internal/web/service/inbound_amneziawg.go:264-268 (normalizeAmneziaWGSettings) normalized, err := normalizeWireguardAllowedIPs(c.AllowedIPs) if err != nil { return fmt.Errorf("amneziawg: client %q: %w", c.Email, err) } c.AllowedIPs = normalized ``` `normalizeWireguardAllowedIPs` skips blanks and returns an empty slice with a `nil` error (`internal/web/service/client_wireguard.go:136-140`), so `[]` survives validation. Then `internal/amneziawg/instance.go:39` skips the peer and `:50-52` drops the instance: ```go if !c.Enable || c.PublicKey == "" || len(c.AllowedIPs) == 0 { continue } ... if len(peers) == 0 { return Instance{}, false } ``` `DesiredAmneziaWGInstances` swallows the `false` at `internal/web/service/inbound_amneziawg.go:62-65` (a bare `continue`), and `AmneziaWGJob.Run` only logs when the *query* fails (`internal/web/job/amneziawg_job.go:32-35`). Your "zero lines in the journal" observation matches the code exactly. **Where your attribution is off:** "Leave empty to auto-assign" is not from `amneziawg.mdx` — it is the client-form hint `pages.clients.amneziaWgAllowedIPsHint` (`internal/web/translation/en-US.json:874`, rendered at `frontend/src/pages/clients/ClientFormModal.tsx:1253`). And it is *not* frontend-only: the allocation runs in Go, in `defaultAmneziaWGClients` (`internal/web/service/client_amneziawg.go:70-87`), whose sole caller is `AddInboundClient` (`internal/web/service/client_inbound_apply.go:409`). That is the `/panel/api/clients/add` path, documented at `frontend/src/pages/api-docs/endpoints.ts:1031-1036` ("Per-protocol secrets are generated server-side when omitted… plus `allowedIPs`: one free `/32`…"). So the gap is specific: the whole-inbound endpoints do not run that allocator, and do not reject an empty `allowedIPs` either. **Workaround today** — create the inbound with `"clients": []`, then attach clients through the endpoint that does allocate: ```bash curl -sk -X POST "$PANEL/panel/api/clients/add" \ -H 'Content-Type: application/json' \ -d '{"client":{"email":"alice@example.com","enable":true},"inboundIds":[7]}' ``` Or send an explicit `allowedIPs` (e.g. `["10.8.1.2/32"]`) inside `inbounds/add`. --- ## Bug 2 — a `server` block without `privateKey` gets a brand-new random keypair Confirmed, with a caveat about *why* it happens, and one failure mode you did not hit that is worse. ```go // internal/web/service/inbound_amneziawg.go:196-200 } else if parsed.Server.PrivateKey == "" { if err := fillAmneziaWGServerKeys(parsed.Server); err != nil { return err } } ``` `fillAmneziaWGServerKeys` (`:152-160`) overwrites **both** `PrivateKey` and `PublicKey`. `UpdateInbound` calls the normalizer at `internal/web/service/inbound.go:1476`, seventeen lines *before* it loads `oldInbound` at `:1493`, so there is nothing stored to fall back to at that point. Nothing in `internal/web/controller/inbound.go:226-257` merges either. **The caveat:** `/panel/api/inbounds/update/{id}` is a documented whole-row replace, not a patch — `frontend/src/pages/api-docs/endpoints.ts:63` says so in a comment ("`/inbounds/update` replaces the whole row, so it takes the same payload as `/add`") and `:296` repeats it ("Replace an inbound's configuration. Body shape mirrors `/add`"). Your VLESS analogy does not hold: the same call with `clients` omitted deletes every client *and* its `client_traffics` row (`internal/web/service/inbound.go:1886-1901`). Under those semantics, an omitted field being lost is the rule, not the exception. What is still a defect is that the lost keypair is replaced with a fresh **random** value instead of being rejected — the function's own comment (`:163-164`) scopes that generation to "first save", but the code runs it identically on every update. And the gate is asymmetric in a way that is worse than what you reported: it fires only on `PrivateKey == ""`, so a payload that sends `privateKey` but omits `publicKey` passes validation untouched (`ValidateConfigValue` at `internal/amneziawg/params.go:281-288` only rejects control characters) and leaves the server public key **empty**. Every `.conf` built from it then carries a blank line: ```ts // frontend/src/pages/clients/amneziawgConfig.ts:104 lines.push('[Peer]', `PublicKey = ${server?.publicKey || ''}`); ``` There is no code anywhere that derives the server's `publicKey` from its `privateKey` — `wgutil.PublicKeyFromPrivate` is used for clients only (`internal/web/service/client_amneziawg.go:63-69`), whose comment states the opposite intent for peers: *"Existing values are never overwritten, so an edit never rotates keys."* **Workaround today** — read the inbound back and re-send its stored settings verbatim. `GET /panel/api/inbounds/get/{id}` does **not** redact `privateKey` (`GetInboundDetail`, `internal/web/service/inbound.go:1332-1342`, returns the raw row); the redaction you may have seen applies only to `GET /panel/api/inbounds/options` (`inboundAmneziaWGServer`, `:437-439`). --- Verdict: Confirmed bug Severity: High Confidence: High Root cause: (1) `normalizeAmneziaWGSettings`, `internal/web/service/inbound_amneziawg.go:264-268` — the per-client loop canonicalizes `allowedIPs` but never rejects or allocates an empty one, so `internal/amneziawg/instance.go:39` skips the peer and `:50-52` drops the whole instance, with the only two observers (`inbound_amneziawg.go:62-65`, `internal/web/job/amneziawg_job.go:32-35`) staying silent. Triggered by any `/panel/api/inbounds/add|update/{id}` payload whose amneziawg clients all carry an empty `allowedIPs`; the panel UI never hits it because its client form posts to `/panel/api/clients/add`, which allocates via `defaultAmneziaWGClients` (`client_amneziawg.go:70-87`). (2) `normalizeAmneziaWGSettings`, `internal/web/service/inbound_amneziawg.go:196-200` — `fillAmneziaWGServerKeys` is gated only on `PrivateKey == ""` and runs before `UpdateInbound` loads the stored row (`inbound.go:1476` vs `:1493`), so an update whose `server` block omits `privateKey` mints a new keypair, and one that sends `privateKey` without `publicKey` leaves the public key blank. Both introduced by `effcccce` "feat(amneziawg): add native AmneziaWG protocol support (#6105)" (2026-08-24), the commit that created both files. Already fixed: Still present on the default branch (`3ef06b70`). `git log -- internal/amneziawg/instance.go` and `-- internal/web/service/inbound_amneziawg.go` each return only `effcccce`; nothing has touched either path since. Duplicate of: None. Related: #6372 (WG/AWG peer data lost on a client edit) — same class of silent peer-credential loss, different path (`client_inbound_apply.go`, per-inbound peer fields), not a shared root cause. Evidence: `internal/amneziawg/instance.go:39,50-52`; `internal/web/service/client_wireguard.go:136-140` (empty in → empty out, `nil` error); `internal/web/service/inbound_amneziawg.go:62-65,152-160,163-164,196-200,264-268`; `internal/web/job/amneziawg_job.go:32-35`; `internal/web/service/inbound.go:1332-1342,1476,1493,1886-1901`; `internal/web/service/client_amneziawg.go:38-39,63-69,70-87`; `internal/web/service/client_inbound_apply.go:409`; `internal/amneziawg/params.go:281-288`; `frontend/src/pages/clients/amneziawgConfig.ts:104`; `frontend/src/pages/api-docs/endpoints.ts:63,296,1031-1036`; `internal/web/translation/en-US.json:874`. No test pins either behaviour: `internal/web/service/inbound_amneziawg_test.go` covers `allowedIPs` canonicalization (`TestNormalizeAmneziaWGSettings_CanonicalizesClientAllowedIPs`) and newline injection (`..._RejectsInjectedClientAllowedIPs`), but nothing for an empty list, and `TestNormalizeAmneziaWGSettings_GeneratesFull31Set` only asserts the empty-settings/first-save path. Not determined: Nothing material. I could not run the panel here, so the `ss -ulnp` and `journalctl` observations are yours, not mine — but they are what the cited code paths predict, so I did not treat them as needing independent confirmation. Suggested fix: In `normalizeAmneziaWGSettings`, treat an amneziawg client whose `allowedIPs` normalizes to empty as a validation error naming the client, the same way the injection and collision checks already do, rather than letting a dead peer reach `InstanceFromInbound`. For the server block, derive `publicKey` from `privateKey` when only the private half was sent, and gate `fillAmneziaWGServerKeys` on "no keys at all" so a half-supplied pair fails loudly instead of producing a blank `PublicKey =`. @MHSanaei — flagging this one: silent, unlogged loss of an AmneziaWG inbound on one path, and silent rotation/blanking of the server keypair on the other, both reachable from the documented REST API. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Sign in to join this conversation.
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
MHSanaei/3x-ui#4340
No description provided.