No files matched your search
@@ -0,0 +1,83 @@
|
||||
# WGTools Architecture
|
||||
|
||||
## Components
|
||||
|
||||
### Web application
|
||||
|
||||
`app/main.py` runs a FastAPI application under Uvicorn. It provides:
|
||||
|
||||
- server-rendered HTML pages;
|
||||
- authenticated JSON API endpoints;
|
||||
- local user/session handling;
|
||||
- orchestration of privileged operations through the helper.
|
||||
|
||||
### Privileged helper
|
||||
|
||||
`scripts/wgtools-helper` contains the privileged operating-system integration.
|
||||
|
||||
It reads and changes WireGuard state, routes, firewall/NAT, backups and server provisioning. Keeping this code in a separate readable file makes privileged behavior easier to audit.
|
||||
|
||||
### Telegram service
|
||||
|
||||
`app/telegram_bot.py` runs as a separate systemd service. It reads Telegram configuration from the same local WGTools state and uses the Telegram Bot API only when enabled.
|
||||
|
||||
### Built-in HTTPS
|
||||
|
||||
The normal `wgtools.service` starts `scripts/wgtools-web`. By default it launches Uvicorn over HTTP on the configured WGTools port. When built-in HTTPS is enabled, the same launcher serves TLS directly on TCP `443` with the Let’s Encrypt `fullchain.pem` and `privkey.pem`; no reverse proxy is bundled.
|
||||
|
||||
Certificate issuance uses the Certbot client from the WGTools virtual environment with standalone HTTP-01 validation on TCP `80`. A dedicated `wgtools-certbot-renew.timer` checks renewal automatically while built-in HTTPS is active, and its deploy hook restarts the WGTools web service after a successful renewal so Uvicorn reloads the certificate. `/etc/letsencrypt` remains host-level state and is deliberately not removed by the normal WGTools uninstaller.
|
||||
|
||||
### WGTools Nodes
|
||||
|
||||
Nodes use a dedicated hidden `wgnode0` WireGuard transport and do not depend on the WGTools web listener.
|
||||
|
||||
- The HUB listens on one numeric Nodes port over **UDP** for WireGuard and independently over **TCP** for the Node control socket.
|
||||
- Initial pairing uses pinned TLS on the TCP socket. A one-time join code contains a random secret plus the SHA-256 fingerprint of the HUB Node-control certificate, so the Spoke verifies the HUB identity before sending the secret.
|
||||
- The Spoke supplies the public HUB `host:port`; that same endpoint becomes the WireGuard endpoint. The HUB does not need to know its own public web or panel URL.
|
||||
- After `wgnode0` is up, sync/leave control requests are sent to the HUB transport address (normally `10.254.240.1`) through the WireGuard tunnel. The HUB accepts steady-state requests only from the transport IP assigned to that Node.
|
||||
- The optional panel URL is metadata only for the **Open panel** button and is never used for pairing, routing or synchronization.
|
||||
- Each Node automatically exports its configured interface VPN pools plus configured Site-to-Site peer remote networks. Export membership is configuration-driven rather than handshake-driven.
|
||||
- For traffic originating from a remote Node's ordinary VPN client pool and terminating in a locally published network, the receiving Node provides destination-scoped return-path MASQUERADE. Site-to-Site/custom LAN sources remain routed without this NAT.
|
||||
- The HUB control certificate/private key are mirrored into the SQLite Node state so a full `.wgtbackup` restore preserves the identity pinned by existing Spokes.
|
||||
|
||||
### Update job
|
||||
|
||||
The administrator uploads a trusted `.bin` release archive from **Settings → About**. The helper validates the archive, version and required files, then schedules a one-shot systemd job outside the web-service cgroup. No upstream release server is queried.
|
||||
|
||||
Before replacement, the updater creates a full state backup and a separate rollback archive containing the current `/opt/wgtools` application, helper, environment file and systemd units. On installation failure it attempts to restore the previous application. Packages are not cryptographically signed; their origin must be verified by the administrator.
|
||||
|
||||
### Storage
|
||||
|
||||
- `/var/lib/wgtools/wgtools.db` — users, preferences, Telegram settings and WGTools-managed metadata.
|
||||
- `/var/lib/wgtools/session.key` — session-signing secret.
|
||||
- `/var/lib/wgtools/backups/` — automatic WireGuard configuration backups.
|
||||
- `/var/lib/wgtools/migration-backups/` — pre-restore safety backups.
|
||||
- `/var/lib/wgtools/update-backups/` — pre-update state backups and application rollback archives (last few copies retained).
|
||||
- `/var/lib/wgtools/update-status.json` — local progress/result of the latest update job.
|
||||
- `/etc/wireguard/*.conf` — actual WireGuard interface configurations.
|
||||
- `/etc/wgtools/https.env` and `/etc/wgtools/https.json` — built-in HTTPS runtime/state when configured.
|
||||
- `/etc/letsencrypt/live/wgtools/` — host-level Let’s Encrypt certificate/key lineage for built-in HTTPS.
|
||||
|
||||
## Configuration ownership
|
||||
|
||||
WGTools distinguishes between:
|
||||
|
||||
- **server-owned rules** — generated from the main Server settings;
|
||||
- **site-to-site routes** — owned by a specific peer and edited through Clients;
|
||||
- **WGTools-generated client policy** — for modes such as Full Tunnel except local networks;
|
||||
- **custom user rules** — explicitly created in the Server firewall/routes UI;
|
||||
- **advanced/raw configuration** — preserved for direct `wg0.conf` editing.
|
||||
|
||||
This ownership model prevents a row from being edited in one screen while a different screen silently believes it owns the same configuration.
|
||||
|
||||
## Apply strategy
|
||||
|
||||
Peer-only operations can use live WireGuard synchronization where possible.
|
||||
|
||||
Changes involving interface addresses, routing, PostUp/PostDown or other `wg-quick` behavior can require a WireGuard restart. WGTools creates backups before risky operations and attempts rollback when apply fails.
|
||||
|
||||
## Trust boundary
|
||||
|
||||
The browser is not trusted with filesystem/root access. Requests are authenticated by the web application, which then invokes a constrained helper action. The helper validates action arguments before running system changes.
|
||||
|
||||
Because the services currently run as root, a vulnerability in the application can have high impact. Deploy WGTools only on trusted management networks and keep dependencies and WGTools updated.
|
||||
@@ -0,0 +1,48 @@
|
||||
# Maintainer Release Checklist
|
||||
|
||||
1. Update `VERSION`.
|
||||
2. Update `CHANGELOG.md`.
|
||||
3. Confirm the top-level `install.sh` still resolves the latest stable published GitHub Release by default (do not hard-code the new tag).
|
||||
4. Run local validation:
|
||||
|
||||
```bash
|
||||
python3 -m compileall -q app scripts/wgtools-helper
|
||||
python3 -m json.tool app/locales/en.json >/dev/null
|
||||
python3 -m json.tool app/locales/ru.json >/dev/null
|
||||
bash -n install.sh scripts/install.sh scripts/uninstall.sh
|
||||
python3 -m unittest discover -s tests -v
|
||||
```
|
||||
|
||||
5. Search the repository for secrets/personal infrastructure before publishing.
|
||||
6. Before tagging: deploy the exact candidate archive to a disposable Debian/Ubuntu VM. Confirm the installer reaches and completes `[8/8]`, including helper snapshot and migration backup smoke tests, without disrupting WireGuard. This is required in addition to the mocked public-bootstrap unit test.
|
||||
7. Commit and push to `main`.
|
||||
8. Create an annotated tag, for example:
|
||||
|
||||
```bash
|
||||
git tag -a v0.40.4 -m "WGTools v0.40.4"
|
||||
git push origin v0.40.4
|
||||
```
|
||||
|
||||
9. Create a GitHub Release from that tag and paste the relevant changelog section.
|
||||
10. After publishing, test the public one-line installer on clean Debian and Ubuntu VMs, and confirm it reaches `[8/8]`.
|
||||
11. Test backup/restore and a real client connection before marking the release stable.
|
||||
12. From an installed release that already contains the updater, test **Settings → About → Check for updates / Update WGTools** against the new published release. Verify the pre-update backups, temporary web restart and final version.
|
||||
13. For the first updater-capable release, a full end-to-end update test can be performed on a disposable VM by installing the release code, temporarily lowering only `/opt/wgtools/VERSION`, then updating back to the real published release. Never use this trick on production.
|
||||
|
||||
## Public project discovery / SEO
|
||||
|
||||
The WGTools admin panel is private software and must not be indexed. The HTML templates carry `noindex,nofollow,noarchive,nosnippet`, rendered HTML adds `X-Robots-Tag`, and `/robots.txt` disallows crawling. Verify this before a public release.
|
||||
|
||||
For the public GitHub repository, use a concise natural-language description rather than keyword stuffing:
|
||||
|
||||
> Self-hosted WireGuard web UI and server management panel for Debian/Ubuntu — clients, Site-to-Site, routing/NAT, Nodes, VPS Relay, monitoring, backups, HTTPS and Telegram.
|
||||
|
||||
Recommended GitHub topics:
|
||||
|
||||
`wireguard`, `wireguard-ui`, `wireguard-manager`, `vpn`, `self-hosted`, `debian`, `ubuntu`, `network-management`, `site-to-site-vpn`, `homelab`, `fastapi`, `systemd`
|
||||
|
||||
Recommended release title:
|
||||
|
||||
`WGTools v0.40.4 — WireGuard Web UI and Server Manager`
|
||||
|
||||
Before publishing, search the repository and screenshots for personal domains/IPs, passwords, tokens, private keys, QR codes and environment-specific hostnames. Keep screenshot filenames and alt text descriptive so GitHub/readme previews remain understandable to both users and search engines.
|
||||
@@ -0,0 +1,38 @@
|
||||
# WGTools localization status (v0.40.4)
|
||||
|
||||
WGTools supports seven interface languages, now with full **key parity**:
|
||||
|
||||
| Language | Present keys | Total source keys | Missing keys |
|
||||
| --- | ---: | ---: | ---: |
|
||||
| English (en) | 1098 | 1098 | 0 |
|
||||
| Русский (ru) | 1098 | 1098 | 0 |
|
||||
| Deutsch (de) | 1098 | 1098 | 0 |
|
||||
| Français (fr) | 1098 | 1098 | 0 |
|
||||
| Italiano (it) | 1098 | 1098 | 0 |
|
||||
| Español (es) | 1098 | 1098 | 0 |
|
||||
| Polski (pl) | 1098 | 1098 | 0 |
|
||||
|
||||
Each key has a non-empty translation, and `{variables}` are validated against English.
|
||||
The three distributed copies of each locale JSON file must remain byte-for-byte identical.
|
||||
Fallback to English remains active for any new key added in future versions.
|
||||
|
||||
**Important:** machine-assisted translations need in-app layout checks and ideally
|
||||
review by native speakers before declaring linguistic QA complete. Key parity is
|
||||
not a substitute for human proofreading. Confirm widths, wrapping and safety prompts
|
||||
in Settings (HTTPS, backup/restore, MFA, Telegram), Server, Clients, Nodes and VPS.
|
||||
|
||||
## Help articles
|
||||
|
||||
Help articles are **not part of the 1098 interface-string keys**. They use
|
||||
`app/core/help_content.py` (reference RU/EN texts) and additional dedicated
|
||||
`app/core/help_locales/{de,fr,it,es,pl}.json` files.
|
||||
|
||||
All seven languages have the same four Help sections and 40 topics. The
|
||||
five new language editions use locally written, concise explanations of the
|
||||
same features and retain technical examples and security warnings.
|
||||
`tests/test_help_localization.py` verifies every language is loaded and
|
||||
matches the reference section/topic structure, so missing files cannot
|
||||
silently ship as English Help again.
|
||||
|
||||
Linguistic QA and line-breaking on actual mobile/desktop browsers remain
|
||||
recommended before publishing as stable.
|
||||
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 29 KiB |