DenyHosts is an intrusion prevention utility designed to protect SSH servers against repeated authentication failures. It analyses authentication logs, identifies the accounts being targeted, and maintains records of unsuccessful login attempts originating from individual hosts.
The software distinguishes between attempts to access valid accounts, nonexistent accounts, and the root account. Administrators can configure different blocking thresholds for these categories, applying stricter policies to particularly sensitive accounts.
DenyHosts was originally designed around TCP Wrappers and its hosts.deny access control file. This blocking mechanism is unsuitable for modern OpenSSH installations that no longer support TCP Wrappers. The software also provides alternatives based on the operating system’s firewall, which should be considered when configuring protection on contemporary systems.
This is free and open source software.
Key Features
- Parses SSH authentication logs to distinguish successful and unsuccessful login attempts.
- Maintains separate statistics for valid users, invalid users, and offending hosts.
- Identifies successful logins from hosts associated with previous authentication failures.
- Configurable thresholds for blocking addresses targeting different account categories.
- Supports blocking through hosts.deny, iptables, and PF.
- Automatically expires blocked hosts according to configurable retention periods.
- Maintains historical records of authentication failures between executions.
- Tracks log file offsets and detects log rotation.
- Optional email notifications reporting newly blocked hosts and suspicious logins.
- Optional synchronisation with a central server to exchange information about offending hosts.
- Supports hostname resolution for recorded IP addresses.
- Operates as a background daemon or through scheduled execution.
- Cross-platform support – runs on Linux and BSD operating systems.
Website: github.com/denyhosts/denyhosts
Support:
Developer: Phil Schwartz
License: GNU General Public License v2.0
DenyHosts is written in Python. Learn Python with our recommended free books and free tutorials.
Related Software
| Intrusion Prevention for SSH | |
|---|---|
| Fail2Ban | Intrusion prevention software framework written in Python |
| CrowdSec | Modern and collaborative behavior detection engine |
| SSHGuard | Protects hosts from brute-force attacks against SSH and other services |
| denyhosts | Helps thwart SSH server attacks |
| IPBan | Detects repeated failed logins |
| CSF | ConfigServer Security & Firewall |
| reaction | Daemon that scans program outputs for repeated patterns, and takes action |
| BFD | Log-based security tool that detects authentication failures |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.