Firewall API

Multi-backend firewall management supporting firewalld, ufw, nftables, and iptables.

All endpoints are prefixed with /api/firewall. Admin only.


Core Operations

MethodPathDescription
GET/firewallGet all rules
GET/firewall/backendDetect active backend
GET/firewall/servicesAvailable services
POST/firewall/savePersist rules
GET/firewall/rawRaw iptables output
GET/firewall/exportExport rules

iptables Rules

MethodPathDescription
POST/firewall/ruleAppend rule
PUT/firewall/ruleInsert/replace rule
DELETE/firewall/rule/:chain/:numDelete rule
PUT/firewall/policySet chain policy
POST/firewall/chainCreate chain
DELETE/firewall/chain/:chainDelete chain
PUT/firewall/chain/:chain/renameRename chain
POST/firewall/flush/:chainFlush chain

firewalld Zones

MethodPathDescription
POST/firewall/zone/serviceAdd service to zone
DELETE/firewall/zone/serviceRemove service
POST/firewall/zone/portAdd port to zone
DELETE/firewall/zone/portRemove port
POST/firewall/zone/rich-ruleAdd rich rule
DELETE/firewall/zone/rich-ruleRemove rich rule
PUT/firewall/zone/defaultSet default zone
PUT/firewall/zone/masqueradeToggle masquerade
POST/firewall/zone/icmp-blockAdd ICMP block
DELETE/firewall/zone/icmp-blockRemove ICMP block

Monitoring

MethodPathDescription
GET/firewall/statsLive rule stats
GET/firewall/conntrackConnection tracking
GET/firewall/top-talkersTop bandwidth consumers
GET/firewall/logFirewall log

Backend Detection

NexusPanel auto-detects the active firewall in priority order:

  1. firewalldfirewall-cmd --state
  2. ufwufw status
  3. nftablesnft list ruleset
  4. iptablesiptables -L
  5. none — No firewall detected

Part of NexusPanel API Reference

← Back to Documentation