Skip to content

Commit

Permalink
Merge pull request #59 from josev814/master
Browse files Browse the repository at this point in the history
Multiple PLUGIN_DENY Arguments
  • Loading branch information
slicer69 committed Jul 18, 2016
2 parents 11f1f6a + cd302ea commit 23b4eda
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
22 changes: 19 additions & 3 deletions DenyHosts/deny_hosts.py
Expand Up @@ -333,7 +333,16 @@ def update_hosts_deny(self, deny_hosts):
fp.write("%s\n" % output)

plugin_deny = self.__prefs.get('PLUGIN_DENY')
if plugin_deny: plugin.execute(plugin_deny, new_hosts)
if ',' in plugin_deny:
#explode plugins by ,
m_plugin_deny=plugin_deny.split(',')
#loop through multiple plugins
for m_plugin in m_plugin_deny:
if m_plugin:
plugin.execute(m_plugin.strip(), new_hosts)
else:
if plugin_deny: plugin.execute(plugin_deny, new_hosts)

if self.__iptables:
debug("Trying to create iptables rules")
try:
Expand Down Expand Up @@ -503,8 +512,15 @@ def process_log(self, logfile, offset):
self.__report.add_section(msg, new_denied_hosts)
if self.__sync_server: self.sync_add_hosts(new_denied_hosts)
plugin_deny = self.__prefs.get('PLUGIN_DENY')

if plugin_deny: plugin.execute(plugin_deny, new_denied_hosts)
if ',' in plugin_deny:
#explode plugins by ,
m_plugin_deny=plugin_deny.split(',')
#loop through multiple plugins
for m_plugin in m_plugin_deny:
if m_plugin:
plugin.execute(m_plugin.strip(), new_hosts)
else:
if plugin_deny: plugin.execute(plugin_deny, new_denied_hosts)

new_suspicious_logins = login_attempt.get_new_suspicious_logins()
if new_suspicious_logins:
Expand Down
3 changes: 2 additions & 1 deletion denyhosts.conf
Expand Up @@ -474,7 +474,8 @@ AGE_RESET_INVALID=10d
# PLUGIN_DENY: If set, this value should point to an executable
# program that will be invoked when a host is added to the
# HOSTS_DENY file. This executable will be passed the host
# that will be added as its only argument.
# that will be added as its only argument. To run multiple plugins
# separate the plugins by a comma ex /usr/bin/true,/usr/bin/false
#
#PLUGIN_DENY=/usr/bin/true
#
Expand Down

0 comments on commit 23b4eda

Please sign in to comment.