I want to rate limit ssh connections per IP to a server running firewalld.
Suppose my sshd listens on port 2222, and I want to limit ssh connections per IP to 3 per minute. I tried:
sudo firewall-cmd --add-rich-rule \
'rule port port="2222" protocol="tcp" accept limit value="3/m"'
Then on another machine I ran:
ssh myserver echo hello; \
ssh myserver echo hello; \
ssh myserver echo hello; \
ssh myserver echo hello; \ # should fail, but actually logs in
ssh myserver echo hello # should fail, but actually logs in
...
It logs in each time. There is no rate limiting.
Where is my mistake?