Hmm, ja jsem to kdysi postavil na tomhle principu:
Ignoruj input chain, posilam protoze tohle dela hezke seznamy v realnem case.
# Stage 1: first attempt — tag for 1 minute
add chain=input protocol=tcp dst-port=22 connection-state=new \
src-address-list=!ssh_stage2 \
action=add-src-to-address-list \
address-list=ssh_stage1 \
address-list-timeout=1m \
comment="SSH stage1 — first attempt"
# Stage 2: second attempt within stage1 window — escalate for 1 hour
add chain=input protocol=tcp dst-port=22 connection-state=new \
src-address-list=ssh_stage1 \
action=add-src-to-address-list \
address-list=ssh_stage2 \
address-list-timeout=1h \
comment="SSH stage2 — repeated attempt"
# Drop anyone in stage2 (active brute-force)
add chain=input src-address-list=ssh_stage2 action=drop \
comment="drop SSH brute-force attackers"