Every week someone posts on r/Proxmox asking about security best practices — and with good reason. The default Proxmox VE installation is functional but not hardened. On a fresh install, the web UI listens on port 8006 without rate limiting, SSH accepts password authentication, and the built-in firewall is disabled.
If your hypervisor gets compromised, every VM and container on it is compromised too. Proxmox runs as root, so a breach means full host access.
This guide covers seven concrete hardening steps that apply to Proxmox VE 8.x — the same measures used in production environments, adapted for homelab budgets:
- Enable and configure the Proxmox firewall
- Set up TOTP two-factor authentication
- Install and configure Fail2ban for the web UI
- Harden SSH access
- Confine services with AppArmor
- Enable automatic security updates
- Audit and verify the configuration
Step 1 — Enable and Configure the Proxmox Firewall
Proxmox ships with a three-layer firewall model: datacenter, node, and VM/CT. The datacenter layer sets the default policy for all nodes, and each node can override. This is your first and most important layer.
Enable the Datacenter Firewall
|
|
Verify it is active:
|
|
Expected output: Status: enabled/running
Define Datacenter Default Rules
Edit /etc/pve/firewall/dc.fw:
|
|
Replace 10.0.20.0/24 with your management subnet. The
+pveproxy macro expands to the default Proxmox web UI ports
(8006 for HTTPS, 8007 for PBS). Important notes:
- Do not set
policy_in: DROPuntil you have tested your rules. Start withACCEPT, add your allow rules, then switch toDROP. - Always keep SSH access open from at least one IP range. If you lock yourself out, you will need IPMI or physical console access.
- The firewall processes rules top-down. Place the
ESTABLISHED,RELATEDaccept rule first.
Apply Firewall Rules per Node
Each node inherits the datacenter policy but can add
node-specific rules. Create /etc/pve/nodes/srv1/host.fw:
|
|
Apply the rules without rebooting:
|
|
Verify Firewall Rules
|
|
Step 2 — Enable TOTP Two-Factor Authentication
Password-only access to the Proxmox web UI is a single point of failure. Proxmox VE 8.x supports TOTP (Time-based One-Time Password) natively — no third-party module needed.
Enable TOTP for root
|
|
This command generates a QR code in the terminal and outputs the TOTP secret (base32). Scan the QR code with your authenticator app (Authy, Google Authenticator, Bitwarden, 2FAS).
If the QR code does not render cleanly, you can get the raw secret:
|
|
Copy the base32 secret and add it manually to your authenticator app.
Verify TOTP Works
Log out of the web UI and log back in as root@pam. You should
see a second field for the TOTP code after entering your
password.
Test from the CLI:
|
|
This prompts for your password, then the TOTP code.
Enable TOTP for Regular Users
Do not log in as root for daily administration. Create
individual users and enforce 2FA on those too:
|
|
Create a Backup Code
TOTP recovery is not built into Proxmox. Protect yourself by creating a backup authentication method:
|
|
Scan the new QR code with a second device or save the secret offline. Alternatively, use the Proxmox Datacenter Manager to maintain a secondary access path.
⚠️ Warning: If you lose access to your TOTP device and have no backup, you will need console access to disable TOTP:
|
|
Step 3 — Install and Configure Fail2ban
The Proxmox web UI and API have no built-in rate limiting. A bot can hammer the login endpoint indefinitely. Fail2ban fills this gap by monitoring the Proxmox auth log and temporarily banning IPs after repeated failures.
Install Fail2ban
|
|
Create the Proxmox Jail
Create /etc/fail2ban/jail.d/proxmox.conf:
|
|
This configuration bans an IP for 1 hour after 3 failed login
attempts within 10 minutes. Adjust bantime and maxretry to
your tolerance — 3600 seconds (1 hour) is reasonable for a
homelab. Production environments often use 24 hours.
Create the Filter Definition
Create /etc/fail2ban/filter.d/proxmox.conf:
|
|
This matches the two most common failure patterns in
/var/log/pveproxd.log. Test it:
|
|
You should see a match count. If it shows zero, check the log format with:
|
|
Add an SSH Jail (Optional but Recommended)
Create /etc/fail2ban/jail.d/sshd.conf:
|
|
Start and Enable Fail2ban
|
|
You should see both proxmox and sshd jails listed. Check the
Proxmox jail specifically:
|
|
Step 4 — Harden SSH Access
SSH is the most common attack vector on any Linux server. Proxmox nodes are no exception.
Disable Password Authentication
Edit /etc/ssh/sshd_config.d/hardening.conf:
|
|
Apply the changes:
|
|
Before you close your current SSH session, open a second terminal and test that key-based authentication still works:
|
|
Keep the first session open until you have confirmed the new session works.
Change the SSH Port (Optional)
Changing the SSH port from 22 reduces automated attack noise:
|
|
Update your firewall rules and Fail2ban jail to match, then restart SSH. This is security through obscurity — it stops bots but not targeted attacks. Pair it with key-only auth for real security.
Generate and Deploy Ed25519 Keys
If you are still using RSA 2048-bit keys, upgrade today:
|
|
Ed25519 keys are faster, smaller, and more secure than RSA.
The -a 100 flag runs 100 KDF rounds on the key for extra
protection of the private key at rest.
Step 5 — Confine Services with AppArmor
Proxmox ships with AppArmor profiles for key services, but they are not always enforced by default on all installations.
Check AppArmor Status
|
|
Look for these Proxmox-related profiles:
lxc-container-defaultlxc-container-default-with-nestingpve-firewallpveproxy
Enable AppArmor Enforcement
If a profile is in complain mode instead of enforce:
|
|
Verify:
|
|
All profiles should show “enforce” mode, not “complain.”
Audit AppArmor Denials
AppArmor denials log to the kernel ring buffer:
|
|
Or check syslog:
|
|
If a legitimate service triggers denials, update the profile
or add a local override in
/etc/apparmor.d/local/. Do not disable AppArmor.
Step 6 — Enable Automatic Security Updates
Proxmox does not install security updates automatically by default. In a homelab where you do not log in daily, this means known CVEs can sit unpatched for weeks.
Install Unattended-Upgrades
|
|
Configure for Proxmox
Edit /etc/apt/apt.conf.d/50unattended-upgrades:
|
|
Key points for Proxmox:
- Include
pve-no-subscriptionin the allowed origins. Without it, Proxmox-specific packages (pve-kernel, qemu-server) will never be auto-updated. - Set
Automatic-Reboottofalse— a kernel update should never reboot your hypervisor silently. Reboot manually during your maintenance window. - Enable
Remove-Unused-Kernel-Packagesto keep/bootfrom filling up with old kernels.
Configure Automatic Download
Edit /etc/apt/apt.conf.d/20auto-upgrades:
|
|
Test the Configuration
|
|
Step 7 — Audit and Verify
Run a quick audit to confirm everything is in place:
|
|
Save this as /root/proxmox-audit.sh and run it monthly:
|
|
Summary
A hardened Proxmox host is not difficult to achieve, but it requires deliberate configuration of layers that Proxmox leaves open by default:
| Layer | Default | Hardened |
|---|---|---|
| Firewall | Disabled | Datacenter DROP policy, management-subnet-only |
| Authentication | Password only | TOTP two-factor |
| Rate limiting | None | Fail2ban, 3 attempts → 1h ban |
| SSH | Password + root login | Key-only, restricted users, ed25519 |
| Service confinement | Complain (some) | Enforce mode |
| Updates | Manual | Daily security, manual reboot |
| Audit | None | Monthly audit script |
Each step builds on the others. The firewall limits who can reach the services. 2FA protects against credential theft. Fail2ban blocks brute-force attempts at the network level. SSH hardening eliminates password guessing entirely. AppArmor contains any service compromise. And automatic updates ensure known vulnerabilities are patched before they are exploited.
Start with the firewall and SSH hardening — those two steps alone eliminate 90% of common attack vectors. Add 2FA and Fail2ban next. Then schedule automatic updates and run a monthly audit.
Your hypervisor is the foundation of your entire homelab. Hardening it is not optional — it is the single most impactful security improvement you can make.