Skip to content

Security model

What it protects, and what it cannot.

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.md

Warning

The agent token is equivalent to a root password

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.

Enforced by the agent

These hold without any configuration on your part.

built in

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.

built in

Per-client failure lockout

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.

built in

Resolved-path confinement

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.

built in

Credential deny-list

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.

built in

Secrets sealed at rest

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.

built in

Audit trail

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.

Left to you

No amount of application code covers these. If they are not done, the list above does not save you.

your job

Terminate TLS yourself

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.

your job

Gate the network path

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.

If this happens, then what

Worth thinking through before you open port 443.

ScenarioImpactWhat stands in the way
Someone guesses or brute-forces the agent tokenFull 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 transitFull 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 tokenThey 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 rootAttempted 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/shadowAttempted 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.

Hardening checklist

Run through this before the console is reachable from anywhere but localhost.

hardening
# 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-agent

Reporting a vulnerability

Please 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.