Po nasazení Proxmox VE hosta není nijak ošetřena bezepčnost z pohledu přístupů ze sítě ke službám jako je SSH, správa PVE atd. Proxmox obsahuje firewall postavený na tradičních iptables. Existuje ale možnost použít modernější a flexibilnější nftables.
Nevýhodou nftables je, že nelze udělat „cluster wide“ konfiguraci přes všechny uzly Proxmox clusteru a musíte konfiguraci udělat per host. Na druhou stranu, pokud uděláte chybu, neostavíte celý cluster ale jen jediný uzel.
Začínáme. Nejprve v GUI zapněte použití firewallu a povolte nftables.

Nyní je třeba vytvořit konfigurační soubory /etc/nftables.conf. Nadefinujme si skupinz IP adres a protokolů, aby se konfigurace zjednodušila.
- steppingstone_hosts (192.168.1.36, 192.168.1.28 ) – servery, z nichž bude umožněno přistupovat na PVE hosty pomocí web gui (TCP(8006) nebo SSH (TCP/22)
- pve_hosts (192.168.1.16, 192.168.1.17, 192.168.1.7) – PVE hosti v clusteru
- mgmt_hosts (192.168.1.19) – servery pro monitoring
I služby a porty sdružíme do skupin. Následuje ukázkový /etc/nftables.conf, který omezuje komunikaci pro správu pouze na oprávněné stepping stone hosty. Více o nftables jsem psal v tomto článku.
Dále omezujeme komunikaci mezi PVE hosty a pro monitoring (zde snmp) přístup z monitoring serveru. Abychom měli přehled o případných pokusech o přístup ke správě, jsou vložena dvě pravidla logující takové pokusy.
# drop any existing nftables ruleset
flush ruleset
# a common table for both IPv4 and IPv6
table inet filter {
# protocols to allow
set allowed_protocols {
type inet_proto
elements = { icmp, icmpv6 }
}
# interfaces to accept any traffic on
set allowed_interfaces {
type ifname
elements = { "lo" }
}
# stepping stone hosts
set steppingstone_hosts {
type ipv4_addr
elements = { 192.168.1.36, 192.168.1.28 }
}
# PVE hosts
set pve_hosts {
type ipv4_addr
elements = { 192.168.1.16, 192.168.1.17, 192.168.1.7}
}
# monitoring hosts
set mgmt_hosts {
type ipv4_addr
elements = { 192.168.1.19 }
}
# restricted services to allow
set allowed_restricted_tcp_dports {
type inet_service
flags interval
elements = { ssh, 8006, 5900-5999, 3128 }
}
# pve internal communications
set allowed_pve_tcp_dports {
type inet_service
flags interval
elements = { ssh, 8006, 3128, 5900-5999 }
}
set allowed_pve_udp_dports {
type inet_service
flags interval
elements = { 5404-54059 }
}
# mgmt udp services to allow
set allowed_mgmt_udp_dports {
type inet_service
elements = { snmp }
}
# mgmt tcp services to allow
set allowed_mgmt_tcp_dports {
type inet_service
elements = { nrpe }
}
# this chain gathers all accept conditions
chain allow {
ct state established,related accept
meta l4proto @allowed_protocols accept
iifname @allowed_interfaces accept
tcp dport @allowed_restricted_tcp_dports ip saddr @steppingstone_hosts accept
tcp dport @allowed_pve_tcp_dports ip saddr @pve_hosts accept
udp dport @allowed_pve_udp_dports ip saddr @pve_hosts accept
udp dport @allowed_mgmt_udp_dports ip saddr @mgmt_hosts accept
tcp dport @allowed_mgmt_tcp_dports ip saddr @mgmt_hosts accept
tcp dport ssh log prefix "[nftables] - Inboud SSH Connection Denied: " counter drop
tcp dport 8006 log prefix "[nftables] - Inboud SSH Connection Denied: " counter drop
# log prefix "[nftables] Inboud Connection Denied: " counter drop
}
# base-chain for traffic to this host
chain INPUT {
type filter hook input priority filter + 20
policy accept
jump allow
reject with icmpx type port-unreachable
}
}
Aby logování fungovalo, vytvořte soubor /etc/rsyslog.d/nftables.conf.
:msg, contains, "[nftables]" -/var/log/nftables.log
& stop
Ověřte, že rsyslog daemon běží a případně jej aktivujte.
systemctl status rsyslog
systemctl enable --now rsyslog
Pokud tato konfigurace bude na jednom hostu fungovat, můžete ji nasadit na zbývající uzly clusteru.
Samozřejmě tuto konfiguraci lze vylepšit, ale po ilustraci snad postačuje.