Changesets, as in Jarl: configuration changes are operations that can be staged in a changeset, checked as they are added (validation and nft -c), reviewed with the diff of the ruleset, and applied together as one history entry, then on probation like any change made over the network. The web UI collects edits for review by default (pending rows, a bar with Review and Apply now, a Changes page, a switch for live edits); hc stages with -C ID or HOUSECARL_CHANGESET (checked like JARL_CHANGESET) and has hc changeset create/list/show/diff/apply/discard/remove. Undo, import and takeover refuse a changeset. --dry-run shows the ruleset's diff. Bandwidth and quotas: rate limits in bytes, per source or destination; quotas per rule or per address that reset daily, weekly, monthly on a day, or by hand, with their usage carried across reloads, saved for reboots, shown by hc quotas and on the rules page, and reset with hc rule reset-quota. Rules that count traffic are checked before established connections are accepted (so they see every packet) and can't accept. Per-address limits group IPv6 by /64 by default (--group-v4/-v6). Per-source rate meters use update. The importer turns meters, byte rates and quotas into these fields. The examples in the web UI, hc's help and the docs use documentation addresses and generic names instead of the maintainer's network. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
1.6 KiB
Plaintext
55 lines
1.6 KiB
Plaintext
table inet main { # handle 1
|
|
set ssh_meter { # handle 4
|
|
type ipv4_addr
|
|
size 65535
|
|
flags dynamic,timeout
|
|
timeout 1m
|
|
}
|
|
|
|
set ssh6_meter { # handle 5
|
|
type ipv6_addr
|
|
size 65535
|
|
flags dynamic,timeout
|
|
timeout 1m
|
|
}
|
|
|
|
set my_connlimit { # handle 6
|
|
type ipv4_addr
|
|
size 65535
|
|
flags dynamic
|
|
}
|
|
|
|
set guest_quota { # handle 7
|
|
type ipv4_addr
|
|
size 65535
|
|
flags dynamic
|
|
}
|
|
|
|
set trusted { # handle 8
|
|
type ipv4_addr
|
|
flags interval
|
|
elements = { 10.0.10.0/24 }
|
|
}
|
|
|
|
chain input { # handle 1
|
|
type filter hook input priority filter; policy drop;
|
|
ct state established,related accept # handle 9
|
|
tcp dport 22 ct state new update @ssh_meter { ip saddr limit rate over 3/minute burst 5 packets } counter packets 0 bytes 0 drop # handle 10
|
|
tcp dport 22 ct state new update @ssh6_meter { ip6 saddr & ffff:ffff:ffff:ffff:: limit rate over 3/minute burst 5 packets } counter packets 0 bytes 0 drop # handle 11
|
|
ip saddr @trusted tcp dport 22 accept # handle 12
|
|
}
|
|
|
|
chain forward { # handle 2
|
|
type filter hook forward priority filter; policy drop;
|
|
ct state new add @my_connlimit { ip saddr ct count over 20 } counter packets 0 bytes 0 drop # handle 13
|
|
iifname "lan" oifname "wan" limit rate over 10 mbytes/second burst 512 kbytes drop # handle 14
|
|
iifname "guest0" oifname "wan" add @guest_quota { ip saddr & 255.255.255.0 quota over 1000 mbytes } drop # handle 15
|
|
iifname "lan" oifname "wan" quota over 100000 mbytes drop # handle 16
|
|
iifname "lan" oifname "wan" accept # handle 17
|
|
}
|
|
|
|
chain output { # handle 3
|
|
type filter hook output priority filter; policy accept;
|
|
}
|
|
}
|