How To Install sshguard on Fedora 34

sshguard is Protects hosts from brute-force attacks against SSH and other services

Introduction

In this tutorial we learn how to install sshguard on Fedora 34.

What is sshguard

Sshguard protects hosts from brute-force attacks against SSH and other services. It aggregates system logs and blocks repeat offenders using one of several firewall backends. Sshguard can read log messages from standard input or monitor one or more log files. Log messages are parsed, line-by-line, for recognized patterns. If an attack, such as several login failures within a few seconds, is detected, the offending IP is blocked. Offenders are unblocked after a set interval, but can be semi-permanently banned using the blacklist option.

We can use yum or dnf to install sshguard on Fedora 34. In this tutorial we discuss both methods but you only need to choose one of method to install sshguard.

Install sshguard on Fedora 34 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install sshguard using dnf by running the following command:

sudo dnf -y install sshguard

Install sshguard on Fedora 34 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install sshguard using yum by running the following command:

sudo yum -y install sshguard

How To Uninstall sshguard on Fedora 34

To uninstall only the sshguard package we can use the following command:

sudo dnf remove sshguard

sshguard Package Contents on Fedora 34

/etc/sshguard.whitelist
/usr/lib/.build-id
/usr/lib/.build-id/2d
/usr/lib/.build-id/2d/14a2723ea825c66126d057aa42ebae1a2d2eeb
/usr/lib/.build-id/bf
/usr/lib/.build-id/bf/2bdd8420ac6646138f19839678097a8e7ec10a
/usr/lib/.build-id/c2
/usr/lib/.build-id/c2/dfc15ec6908bc6ebdf0df9477d21bd6b009197
/usr/lib/systemd/system/sshguard.service
/usr/libexec/sshguard
/usr/libexec/sshguard/sshg-blocker
/usr/libexec/sshguard/sshg-fw-firewalld
/usr/libexec/sshguard/sshg-fw-hosts
/usr/libexec/sshguard/sshg-fw-ipfilter
/usr/libexec/sshguard/sshg-fw-ipfw
/usr/libexec/sshguard/sshg-fw-ipset
/usr/libexec/sshguard/sshg-fw-iptables
/usr/libexec/sshguard/sshg-fw-nft-sets
/usr/libexec/sshguard/sshg-fw-null
/usr/libexec/sshguard/sshg-fw-pf
/usr/libexec/sshguard/sshg-logtail
/usr/libexec/sshguard/sshg-parser
/usr/sbin/sshguard
/usr/share/doc/sshguard
/usr/share/doc/sshguard/CONTRIBUTING.rst
/usr/share/doc/sshguard/README.rst
/usr/share/doc/sshguard/examples
/usr/share/doc/sshguard/examples/sshguard.conf.sample
/usr/share/doc/sshguard/examples/whitelistfile.example
/usr/share/licenses/sshguard
/usr/share/licenses/sshguard/COPYING
/usr/share/man/man7/sshguard-setup.7.gz
/usr/share/man/man8/sshguard.8.gz
/var/lib/sshguard
/etc/sshguard.whitelist
/usr/lib/.build-id
/usr/lib/.build-id/56
/usr/lib/.build-id/56/7077bbc25c9dba8decf82df5162d7d64d8eddb
/usr/lib/.build-id/7d
/usr/lib/.build-id/7d/4e056a5985a3a9d6e3898e5d78e5d3d8f7a7c2
/usr/lib/.build-id/fe
/usr/lib/.build-id/fe/17a6f0329b422004bff9f96c9e6345cf6a141a
/usr/lib/systemd/system/sshguard.service
/usr/libexec/sshguard
/usr/libexec/sshguard/sshg-blocker
/usr/libexec/sshguard/sshg-fw-firewalld
/usr/libexec/sshguard/sshg-fw-hosts
/usr/libexec/sshguard/sshg-fw-ipfilter
/usr/libexec/sshguard/sshg-fw-ipfw
/usr/libexec/sshguard/sshg-fw-ipset
/usr/libexec/sshguard/sshg-fw-iptables
/usr/libexec/sshguard/sshg-fw-nft-sets
/usr/libexec/sshguard/sshg-fw-null
/usr/libexec/sshguard/sshg-fw-pf
/usr/libexec/sshguard/sshg-logtail
/usr/libexec/sshguard/sshg-parser
/usr/sbin/sshguard
/usr/share/doc/sshguard
/usr/share/doc/sshguard/CONTRIBUTING.rst
/usr/share/doc/sshguard/README.rst
/usr/share/doc/sshguard/examples
/usr/share/doc/sshguard/examples/sshguard.conf.sample
/usr/share/doc/sshguard/examples/whitelistfile.example
/usr/share/licenses/sshguard
/usr/share/licenses/sshguard/COPYING
/usr/share/man/man7/sshguard-setup.7.gz
/usr/share/man/man8/sshguard.8.gz
/var/lib/sshguard

References

Summary

In this tutorial we learn how to install sshguard on Fedora 34 using yum and dnf.