GitHub ↗

Export & Import

The buttons sit top-right on the dashboard. Export downloads the staged rule set; import replaces it. Neither touches the running firewall — that still needs an apply.

   
Export Downloads easywall-rules-<date>.json
Import Validates, then replaces the staged set entirely — it is not a merge

Import is a replacement. Anything staged that is not in the file is gone after importing. Export first if you are unsure.

The format

One array per rule type. Every field is optional; an absent or empty array means no rules of that kind.

{
  "tcp": [
    {"port": "22",  "description": "SSH",   "ssh": true},
    {"port": "443", "description": "HTTPS", "ssh": false}
  ],
  "udp":        [{"port": "53", "description": "DNS", "ssh": false}],
  "blacklist":  ["192.0.2.1", "198.51.100.0/24"],
  "whitelist":  ["203.0.113.10"],
  "forwarding": [{"protocol": "tcp", "source_port": 2222, "dest_port": 22}],
  "custom":     ["iif eth0 ip protocol udp udp dport 1194 accept"]
}
Key Shape
tcp, udp port string, description string, ssh bool
blacklist, whitelist strings — IPv4, IPv6 or CIDR
forwarding protocol "tcp" or "udp", source_port int, dest_port int
custom strings — raw nftables match expressions

What gets rejected

Import validates before staging anything. A file with one bad entry imports nothing.

  • A port outside 1–65535
  • Malformed CIDR, such as 192.168.1.1/33
  • An address that does not parse
  • A forwarding protocol other than tcp or udp

Worth doing

   
Before a risky change Export. Re-importing beats recreating twenty rules by hand
Migrating a server Export, transfer, import, apply — and verify before confirming
Version control The JSON is stable and diffs cleanly next to your Ansible or Terraform
git add easywall-rules-production.json
git commit -m "chore(firewall): open 8080 for staging"