From Wikipedia, the free encyclopedia

Developer(s)Phil Schwartz
Stable release
3.1 / 16 September 2015; 7 years ago (2015-09-16)
Written inPython
Operating systemLinux, FreeBSD
TypeSecurity / HIPS

DenyHosts is a log-based intrusion-prevention security tool for SSH servers written in Python. It is intended to prevent brute-force attacks on SSH servers by monitoring invalid login attempts in the authentication log and blocking the originating IP addresses. DenyHosts is developed by Phil Schwartz, who is also the developer of Kodos Python Regular Expression Debugger.


DenyHosts checks the end of the authentication log for recent failed login attempts. It records information about their originating IP addresses and compares the number of invalid attempts to a user-specified threshold. If there have been too many invalid attempts it assumes a dictionary attack is occurring and prevents the IP address from making any further attempts by adding it to /etc/hosts.deny on the server. DenyHosts 2.0 and above support centralized synchronization, so that repeat offenders are blocked from many computers. The site gathers statistics from computers running the software.

DenyHosts is restricted to connections using IPv4. It does not work with IPv6.

DenyHosts may be run manually, as a daemon, or as a cron job.


In July 2007, The Register reported that from May until July that year, "compromised computers" at Oracle UK were listed among the ten worst offenders for launching brute force SSH attacks on the Internet, according to public DenyHosts listings. After an investigation, Oracle denied suggestions that any of its computers had been compromised.[1]


Daniel B. Cid wrote a paper showing that DenyHosts, as well the similar programs Fail2ban and BlockHosts, were vulnerable to remote log injection, an attack technique similar to SQL injection, in which a specially crafted user name is used to trigger a block against a site chosen by the attacker.[2] This was fixed in version 2.6.[3]

Forks and descendants[edit]

Since there had been no further development by the original author Phil Schwartz after the release of version 2.6 (December 2006) and claimed version 2.7 (November 2008)[4] for which no actual downloadable package is available,[5] development was first continued in February 2012 by Matt Ruffalo in a GitHub repository.[6] An independent and separate fork was started at the almost-identically named DenyHost SourceForge project site with the release of a different version 2.7 in May 2014.[7] After version 2.9, the new SourceForge project has merged with the earlier GitHub repository,[8] and newer versions are available via both means.

The software that runs the centralized synchronization server which DenyHosts versions 2.0 and above can use, has never been released. Independent synchronization server software has been developed by Jan-Pascal van Best since June 2015.[9]

See also[edit]


  1. ^ John Leyden, Oracle refutes 'SSH hacking' slur. Mystery over bogus DenyHosts listing, 21 July 2007
  2. ^ Daniel B. Cid, Attacking Log Analysis tools
  3. ^ DenyHosts, Changelog
  4. ^ DenyHosts, Changelog
  5. ^ DenyHosts, SourceForge download folder
  6. ^ DenyHosts GitHub repository initial commit; current status
  7. ^ fork, Changelog
  8. ^ News page
  9. ^ DenyHosts_Sync GitHub repository initial commit; current status

General references

  • Carla Schroder, Linux Networking Cookbook, O'Reilly, 2007, pp. 223–226, ISBN 0-596-10248-8
  • Ken Leyba, Protect your server with Deny Hosts, 2008-01-28, Free Software Magazine issue 21
  • Daniel Bachfeld, 24 July 2009, Protecting SSH from brute force attacks. DenyHosts, H-online

External links[edit]