Skip to content

Security, account lifecycle, notifications/webhooks/backups, relays and WireGuard speed - #19

Merged
iamfarhad merged 28 commits into
mainfrom
feat/v3-features
Oct 29, 2026
Merged

iamfarhad merged 28 commits into
mainfrom
feat/v3-features

Conversation

@iamfarhad

Copy link
Copy Markdown
Owner

Adds nine features for sellers, operators and admins, plus WireGuard speed tuning. The four feature groups were built in parallel, merged here, and checked together.

Security (migration 0024)

  • Login lockout: progressive lockout per username and per IP; returns 429 with Retry-After; lockouts are written to the audit log.
  • TOTP two-factor: hashed recovery codes and replay protection. A super admin can reset an admin's 2FA.
  • Passkeys (WebAuthn): passwordless sign-in. A passkey can also be the second step after a password.
  • Admin IP allowlist: the panel refuses a list that would lock out the admin saving it. wgpanel clear-ip-allowlist is the break-glass command.
  • UI: a new Security page for every role, including resellers.

Account lifecycle (migration 0025)

  • On-hold accounts: the expiry clock starts at the first handshake, with an optional deadline.
  • Scheduled quota reset: daily, weekly, monthly or yearly. It never charges reseller credit twice.
  • Plan templates: global or reseller-owned, usable through template_id on create.
  • Bulk operations: POST /api/v1/accounts/bulk supports create, renew, suspend, enable, delete and reset-usage. Each item is checked against reseller limits.
  • UI: checkbox selection with an action bar, plus bulk create with a CSV export.

Events (migration 0026)

  • Event bus: emits node, account, reseller and backup events, with dedupe.
  • Notifications: Telegram, email and an in-panel center with a bell. A banner shows when a channel is broken.
  • Webhooks:
    • HMAC-signed requests with retries and backoff.
    • A delivery log, redeliver and test.
    • An SSRF guard that is re-checked when connecting and on redirects.
    • Resellers can manage their own.
  • Scheduled off-box backups: to Telegram and S3-compatible storage (small SigV4 client), with retention.

Relays and speed (migration 0027)

  • Multiple entry endpoints per node: direct or relay, with priority, TCP health checks and a per-endpoint MTU. Configs pick the best healthy one.
  • Public subscription page /s/{token}: usage, expiry, QR, config download and install steps, Persian by default. GET /api/v1/sub/{token} still serves configs to clients and bots.
  • Bot API limits: Redis token-bucket rate limit (429 with X-RateLimit-* headers) and cursor pagination on the accounts list.
  • Configurable client MTU.
  • MSS clamping in the node container.
  • Host tuning: wgpanel tune and the installers apply BBR + fq, larger buffers, conntrack sizing and UDP GRO forwarding.

Integration fixes

  • One shared clientIP helper. Two branches had each added their own.
  • Fixed invalid YAML in openapi.yaml, and added TestOpenAPIParses so CI catches it next time.
  • Notification channels and webhooks are now included in panel backups.
  • The build moves to Go 1.26, because go-webauthn requires it.
  • The subscription page's used/total pair was reversed in RTL.

Testing

  • gofmt and go vet are clean.
  • go test ./... passes against a fresh TimescaleDB and Redis, covering every package and every new integration test.
  • npm run lint shows warnings only, and npm run build passes.
  • shellcheck is clean on the deploy scripts.
  • I checked every new page in Chrome, in English and Persian, light and dark, including the reseller view and the mobile subscription page. There were no console errors and no failed API calls.

🤖 Generated with Claude Code

farhadzand and others added 28 commits October 29, 2026 23:36
…ation 0026

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… templates, bulk endpoint

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…subscription info API, rate limiting and cursor paging

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g, client MTU; back up node_endpoints

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…scheduled backups

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gration tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lowlist settings, 2FA admin status (en + fa)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…U and Bot API rate settings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…edis

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e in accounts, Persian strings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r host tuning, README sections

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	frontend/src/App.tsx
#	frontend/src/locales/fa.ts
…channel and scheduled-backup settings, Persian strings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ork tuning

# Conflicts:
#	backend/internal/httpapi/reseller_gate_test.go
#	deploy/wgpanel
#	frontend/src/App.tsx
#	frontend/src/lib/apiErrors.ts
#	frontend/src/locales/fa.ts
#	frontend/src/pages/AccountsPage.tsx
The security and rate-limit branches each added clientIP with the same proxy
rule. Keep the security one (also unmaps IPv4-mapped addresses and trusts
link-local proxies) and keep the rate-limit test cases under a new name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	backend/cmd/api/main.go
#	backend/internal/httpapi/accounts.go
#	backend/internal/httpapi/reseller_gate_test.go
#	backend/internal/httpapi/server.go
#	frontend/src/App.tsx
#	frontend/src/lib/apiErrors.ts
#	frontend/src/locales/fa.ts
#	frontend/src/pages/DashboardLayout.tsx
#	frontend/src/pages/SettingsPage.tsx
An unquoted colon in the bulk-results description made openapi.yaml unparsable,
which breaks the in-panel API Docs page. Quote it, and add TestOpenAPIParses so
invalid YAML or a path added twice by two branches fails CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Channels, webhooks and the webhook settings are configuration an admin would
otherwise have to re-enter after a restore. Their secrets use the same key as
account keys. Event state, the feed, delivery logs and the backup schedule stay
out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
go-webauthn (passkeys) requires Go 1.26, so the go.mod bump left the API and node
Dockerfiles on an image that refuses to build. CI already follows go.mod.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In Persian the used/total traffic pair rendered reversed (10.0 GB / 56.7 MB)
because each value was isolated but the pair wasn't. The accounts list said
'1 nodes'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iamfarhad
iamfarhad merged commit 157f198 into main Oct 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant