basforge

Search titles, text and the “If it doesn’t work” cases.

    RU

    Proxmox host port 8006 and SSH — from your own network only

    The Proxmox web UI on port 8006 is root to every guest at once: consoles, disks, backups. Don’t forward it to the outside, and on a rented server with a public address close it right after install: pveproxy lets in only your own addresses, and you get in through an SSH tunnel. Plus a second factor for root@pam.

    At home the rule is simple: don’t forward the host’s ports 8006 and 22 on the router. Proxmox is reachable from the home network, and from outside only through something already open and protected, such as SSH on another machine (SSH tunnels).

    A rented server with Proxmox is a different case: after install, 8006 and 22 are open to the whole internet, and bots find them within hours. Close them in two layers.

    Whom pveproxy answers at all. The /etc/default/pveproxy file:

    ALLOW_FROM="127.0.0.1,10.0.0.0/24"
    DENY_FROM="all"
    POLICY="allow"
    systemctl restart pveproxy

    127.0.0.1 is for the tunnel, 10.0.0.0/24 is the internal network, if there is one. From other addresses the connection to 8006 is established, but pveproxy refuses before the login page. Open the UI through a tunnel:

    ssh -L 8006:127.0.0.1:8006 [email protected]
    # in the browser: https://127.0.0.1:8006

    Host SSH — key only (sshd_config), and port 22 itself — from your own addresses via the Proxmox firewall (Datacenter › Firewall, Proxmox networking) or the provider’s firewall.

    A second factor for root@pam. Datacenter › Permissions › Two Factor › Add › TOTP: a code from a phone app on every web UI login. Save the Recovery Keys too — without them a lost phone locks you out of the web UI, leaving only the console.

    For scripts and Terraform use not the root password but an API token of a separate user with rights only to what’s needed: Datacenter › Permissions › API Tokens. A token is revoked with one button and opens neither SSH nor the host console.

    If it doesn’t work

    After editing /etc/default/pveproxy the UI doesn’t open even through the tunnel

    Cause
    ALLOW_FROM lacks the address the tunnel comes from: for a tunnel to the host itself that’s 127.0.0.1.
    Fix
    From the console or over SSH, add 127.0.0.1 to ALLOW_FROM and run systemctl restart pveproxy.

    How to check

    From an address that isn’t in ALLOW_FROM (a phone on mobile data):

    curl -sk -o /dev/null -w '%{http_code}\n' https://203.0.113.10:8006/
    # not 200: pveproxy refused before the login page

    Through the tunnel, https://127.0.0.1:8006 opens the login page and asks for a TOTP code after the password.