configure_snmp_agent: on a firewalld host udp/161 stays blocked #77

Closed
opened 2026-11-12 11:14:30 +00:00 by christianmanivong · 0 comments
Owner

Priority: P2 (SNMP stays dead on every firewalld host, RHEL/Oracle/Fedora, and the fix reports success)

Seen on: an Oracle Linux 9 host managed over a WireGuard interface. netOrk raises snmp_no_data. snmpd runs, listens on udp/161 and allows netOrk's address (written by netOrk's own SNMP fix). An snmpget from netOrk's worker gets no answer, while ping and SSH work.

Cause: _allow_snmp_sources only knows ufw and iptables. On a firewalld host iptables (iptables-nft) is installed too, so the step inserts an iptables INPUT ... --dport 161 -j ACCEPT rule. firewalld has its own nftables table, which rejects the packet anyway (a drop in any base chain wins), and the rule is not persistent either. The step still reports udp/161 open.

An interface in no firewalld zone (here the WireGuard interface) is handled by the default zone, which only admits ssh.

Fix: when systemctl is-active firewalld reports active, add a rich rule per allowed source (rule family=... source address=... port port="161" protocol="udp" accept) to the default zone and every active zone, at runtime and --permanent, each only if missing; no --reload (it would drop Docker's runtime rules). Branch fix/snmp-firewalld.

Priority: P2 (SNMP stays dead on every firewalld host, RHEL/Oracle/Fedora, and the fix reports success) **Seen on:** an Oracle Linux 9 host managed over a WireGuard interface. netOrk raises `snmp_no_data`. snmpd runs, listens on udp/161 and allows netOrk's address (written by netOrk's own SNMP fix). An `snmpget` from netOrk's worker gets no answer, while ping and SSH work. **Cause:** `_allow_snmp_sources` only knows ufw and iptables. On a firewalld host `iptables` (iptables-nft) is installed too, so the step inserts an iptables `INPUT ... --dport 161 -j ACCEPT` rule. firewalld has its own nftables table, which rejects the packet anyway (a drop in any base chain wins), and the rule is not persistent either. The step still reports `udp/161 open`. An interface in no firewalld zone (here the WireGuard interface) is handled by the default zone, which only admits ssh. **Fix:** when `systemctl is-active firewalld` reports `active`, add a rich rule per allowed source (`rule family=... source address=... port port="161" protocol="udp" accept`) to the default zone and every active zone, at runtime and `--permanent`, each only if missing; no `--reload` (it would drop Docker's runtime rules). Branch `fix/snmp-firewalld`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-linux#77