Score:0

Configuring sshguard for more than one port

cn flag

I am running sshd on more than one port, say 22 and 2222.

I have installed sshguard to the system. How can I configure it to guard against attacks on all the ports defined in sshd's configuration?

Note: I am using UFW and the ssh ports are open to public IPv4 and IPv6.

Score:0
cn flag

It turns out that the ports to be filtered are defined in the line ending with sshguard in the file /etc/ufw/before.rules:

$ sudo grep -C1 :sshguard /etc/ufw/before.rules
# hand off control for sshd to sshguard
:sshguard - [0:0]
-A ufw-before-input -p tcp --dport 22 -j sshguard

So, editing the line ending with sshguard, like this, should do the trick:

-A ufw-before-input -p tcp -m multiport --dports 22,2222 -j sshguard


However, I haven't found a similar entry for IPv6.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.