Timing-safe token comparison
The bearer token is compared as a SHA-256 digest through timingSafeEqual, so response latency does not leak how much of a guess was correct.
Security model
VPSGUI runs shell commands, installs packages, drives systemd and Docker, and reads and writes files. No version of that is low-risk. This page is written for someone deciding whether to expose it, not to reassure them.
docs/SECURITY.mdWarning
Anyone who can reach the agent while holding that token owns the machine. Store it the way you would store a root password: out of version control, out of image layers, out of any frontend bundle, and only ever sent over TLS.
These hold without any configuration on your part.
The bearer token is compared as a SHA-256 digest through timingSafeEqual, so response latency does not leak how much of a guess was correct.
Repeated bad tokens lock out the offending client, keyed on the real remote address. The forwarded-for header is only trusted for its rightmost hop, and only from loopback.
Every file operation resolves the target with realpath and re-checks it against the configured roots afterwards, so a symlink planted mid-path cannot escape.
Shadow files, private keys, the agent token file and the encrypted secret store are refused by the file reader even when they sit inside an allowed root.
Stored secrets are encrypted with AES-256-GCM under a key that never leaves the host, and stay masked in every list response until an explicit reveal call.
Privileged calls are recorded with their caller, path and outcome, and are readable from the console so you can reconstruct what the agent was asked to do.
No amount of application code covers these. If they are not done, the list above does not save you.
The token is a bearer header. VPSGUI cannot protect it on the wire - put a certificate in front of the UI before you sign in from outside the machine.
There is no user database and no RBAC. A VPN, firewall allowlist or authenticating proxy is what stands between the internet and root on your box.
Worth thinking through before you open port 443.
| Scenario | Impact | What stands in the way |
|---|---|---|
| Someone guesses or brute-forces the agent token | Full control of the host. | Tokens are generated with a CSPRNG and compared in constant time, and repeated failures lock the client out. Keep the length the installer chose. |
| The token is sniffed in transit | Full control of the host. | It is a bearer header, so TLS is the only thing protecting it. VPSGUI cannot encrypt a connection you terminated as plain HTTP. |
| Someone reaches the console without a token | They see the sign-in gate; every privileged call answers 401. | The gate is not authentication. Treat network reachability as the real control and put a VPN or authenticating proxy in front. |
| A symlink is planted inside an allowed file root | Attempted read or write outside the root. | Paths are resolved with realpath and re-checked against the roots after resolution, so the traversal is refused. |
| A file root is set to / and someone requests /etc/shadow | Attempted credential disclosure. | Shadow files, private keys, the token file and the encrypted secret store are on a deny-list the reader enforces regardless of configured roots. |
Run through this before the console is reachable from anywhere but localhost.
# 1. Never publish the agent port. It listens on loopback by default.
sudo ss -lntp | grep 46509 # expect 127.0.0.1:46509, not 0.0.0.0
# 2. Terminate TLS before signing in from anywhere but the box itself.
sudo certbot --nginx -d vps.example.com
# 3. Restrict who can even reach the console.
sudo ufw allow from 10.8.0.0/24 to any port 443 proto tcp
sudo ufw deny 443/tcp
# 4. Rotate the token by editing agent.env and restarting the agent.
sudo nano /opt/vpsgui/agent/agent.env
sudo pm2 restart vpsgui-agentPlease do not open a public issue for a security bug in the agent. Contact the maintainer through notgamerpratham.com first, and give the fix a chance to ship before disclosure.