Deneyhosts riegelt nicht immer schnell genug ab !?!

rethus

Registered User
Hallo,
also zuerst einmal habe ich denyhosts so konfiguriert, das ich bei jedem einbruchsversuch ne Email bekomme.

Heute hab ich die /var/log/messages geprüft und folgende Einträge gefunden:
May 16 07:13:29 <meinServer> sshd[17416]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!
May 16 07:13:29 <meinServer> sshd[17422]: Invalid user webmaster from 63.87.29.213
May 16 07:13:30 <meinServer> sshd[17418]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!
May 16 07:13:31 <meinServer> sshd[17424]: Invalid user admin from 63.87.29.213
May 16 07:13:32 <meinServer> sshd[17420]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!
May 16 07:13:33 <meinServer> sshd[17422]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!
May 16 07:13:34 <meinServer> sshd[17424]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!

May 16 07:13:34 <meinServer> sshd[17430]: Invalid user ftpuser from 63.87.29.213

May 16 07:13:35 <meinServer> sshd[17426]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!

May 16 07:13:36 <meinServer> sshd[17432]: Invalid user testuser from
63.87.29.213


May 16 07:13:37 <meinServer> sshd[17428]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!

May 16 07:13:37 <meinServer> sshd[17434]: Invalid user testuser from 63.87.29.213

May 16 07:13:38 <meinServer> sshd[17430]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!

May 16 07:13:38 <meinServer> sshd[17436]: Invalid user test from 63.87.29.213

May 16 07:13:39 <meinServer> sshd[17432]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!

May 16 07:13:39 <meinServer> sshd[17439]: Invalid user guestuser from 63.87.29.213

May 16 07:13:41 <meinServer> sshd[17434]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!

May 16 07:13:41 <meinServer> sshd[17441]: Invalid user test01 from 63.87.29.213
May 16 07:13:42 <meinServer> sshd[17443]: Invalid user test2 from 63.87.29.213
May 16 07:13:43 <meinServer> sshd[17447]: Invalid user test3 from 63.87.29.213

Wobei der Eintrag:
May 16 07:13:29 <meinServer> sshd[17416]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN​
ab 7:01 jede Sekunde erscheint, bis (wie oben kursiv hervorgehoben) die ersten Einträge erscheinen, das ein unerlaubter benutzername verwendet wurde...

Mich irritieren dabei 2 Sachen:

  1. Wie kommen die Unmengen von Einträgen á la
    May 16 07:13:29 <meinServer> sshd[17416]: reverse mapping checking getaddrinfo for user213.idexx.com failed - POSSIBLE BREAKIN ATTEMPT!​
    zustande, ohne das deneyhosts die blockt...

  1. Warum hat er letztendlich erst nach der 10. "Invalid User"-Meldung geblockt... eingestellt ist es nach der 5.
 
rethus said:
Wie kommen die Unmengen von Einträgen zustande, ohne das deneyhosts die blockt...
IMHO bedeutet die Meldung, daß jemand versucht hat, sich mit Deinem sshd zu verbinden. Wenn in der sshd_config VerifyReverseMapping
eingeschaltet ist, macht der sshd erstmal einen Reverse-Lookup auf die IP-Adresse, und auf das Ergebnis wiederum einen Lookup, um zu prüfen, daß der Name zur selben Adresse aufgelöst werden kann. Klappt das nicht -- wie in diesem Fall -- gibt es obige Warnmeldung im Log. Da der sshd in dem Fall die Verbindung sofort wieder kappt, besteht keine Gefahr. Der Angreifer kommt nicht einmal bis zum Login- oder Paßwort-Prompt, kann also auch keinen Wörterbuchangriff o.ä. durchführen.

rethus said:
Warum hat er letztendlich erst nach der 10. "Invalid User"-Meldung geblockt... eingestellt ist es nach der 5.
Weil denyhosts nur alle x Sekunden (default 30) das Log scannt. Im "schlimmsten Fall" hat ein Angreifer diese Zeitspanne Zeit für seinen Angriff. Entweder die Zeitspanne in der Denyhosts Konfiguration verringern, oder wie ich es gemacht habe die Syncronisation aktivieren, wodurch Du schnell eine Liste von bekannten angreifenden IPs in der hosts.deny hast und in diesem Fall die IP sofort abgewiesen wird.

Gruß flyingoffice
 
Ich befürchte daran kann es nicht liegen, denn heute habe ich folgenden Log gesehen:
Code:
Sep  4 10:43:43 <servername> sshd[32682]: Invalid user admin from 210.252.131.99
Sep  4 10:43:46 <servername> sshd[32684]: Invalid user test from 210.252.131.99
<-- Schanipp -->
  hier noch viele andere Zugriffsversuche, herausgenommen, da zuviel unnötiger text 
<-- Schanipp -->
Sep  4 11:44:59 <servername> sshd[17968]: Invalid user danny from 210.252.131.99
Sep  4 11:45:01 <servername> sshd[17976]: Invalid user filip from 210.252.131.99
Sep  4 11:45:04 <servername> sshd[18030]: Invalid user stephanie from 210.252.131.99

Der Einbruchsversuch dauerte als über eine Stunde.

Woran kann das liegen, das der nicht abriegelt?

ein ps aux|grep denyhost ergibt bei mir:
Code:
/usr/bin/python /usr/bin/denyhosts.py --daemon --config=/usr/share/denyhosts/denyhosts.cfg

Das ist die Datei deneyhosts.cfg:
Code:
       ############ THESE SETTINGS ARE REQUIRED ############

########################################################################
#
# SECURE_LOG: the log file that contains sshd logging info
# if you are not sure, grep "sshd:" /var/log/*
#
# The file to process can be overridden with the --file command line
# argument
#
# Redhat or Fedora Core:
#SECURE_LOG = /var/log/secure
#
# Mandrake, FreeBSD or OpenBSD: 
#SECURE_LOG = /var/log/auth.log
#
# SuSE:
SECURE_LOG = /var/log/messages
#
########################################################################

########################################################################
# HOSTS_DENY: the file which contains restricted host access information
#
# Most operating systems:
HOSTS_DENY = /etc/hosts.deny
#
# Some BSD (FreeBSD) Unixes:
#HOSTS_DENY = /etc/hosts.allow
#
# Another possibility (also see the next option):
#HOSTS_DENY = /etc/hosts.evil
#######################################################################


########################################################################
# PURGE_DENY: removed HOSTS_DENY entries that are older than this time
#             when DenyHosts is invoked with the --purge flag
#
#      format is: i[dhwmy]
#      Where 'i' is an integer (eg. 7) 
#            'm' = minutes
#            'h' = hours
#            'd' = days
#            'w' = weeks
#            'y' = years
#
# never purge:
#PURGE_DENY = 
#
# purge entries older than 1 week
#PURGE_DENY = 1w
#
# purge entries older than 2 days
PURGE_DENY = 2d
#######################################################################


#######################################################################
# BLOCK_SERVICE: the service name that should be blocked in HOSTS_DENY
# 
# man 5 hosts_access for details
#
# eg.   sshd: 127.0.0.1  # will block sshd logins from 127.0.0.1
#
# To block all services for the offending host:
#BLOCK_SERVICE = ALL
# To block only sshd:
BLOCK_SERVICE  = sshd
# To only record the offending host and nothing else (if using
# an auxilary file to list the hosts).  Refer to: 
# [url=http://denyhosts.sourceforge.net/faq.html#aux]DenyHosts Frequently Asked Questions[/url]
#BLOCK_SERVICE =    
#
#######################################################################


#######################################################################
#
# DENY_THRESHOLD_INVALID: block each host after the number of failed login 
# attempts has exceeded this value.  This value applies to invalid
# user login attempts (eg. non-existent user accounts)
#
DENY_THRESHOLD_INVALID = 3
#
#######################################################################

#######################################################################
#
# DENY_THRESHOLD_VALID: block each host after the number of failed 
# login attempts has exceeded this value.  This value applies to valid
# user login attempts (eg. user accounts that exist in /etc/passwd) except
# for the "root" user
#
DENY_THRESHOLD_VALID = 3
#
#######################################################################

#######################################################################
#
# DENY_THRESHOLD_ROOT: block each host after the number of failed 
# login attempts has exceeded this value.  This value applies to 
# "root" user login attempts only.
#
DENY_THRESHOLD_ROOT = 1
#
#######################################################################


#######################################################################
#
# DENY_THRESHOLD_RESTRICTED: block each host after the number of failed 
# login attempts has exceeded this value.  This value applies to 
# usernames that appear in the WORK_DIR/restricted-usernames file only.
#
DENY_THRESHOLD_RESTRICTED = 1
#
#######################################################################


#######################################################################
#
# WORK_DIR: the path that DenyHosts will use for writing data to
# (it will be created if it does not already exist).  
#
# Note: it is recommended that you use an absolute pathname
# for this value (eg. /home/foo/denyhosts/data)
#
WORK_DIR = /usr/share/denyhosts/data
#
#######################################################################

#######################################################################
#
# SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS
#
# SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES|NO
# If set to YES, if a suspicious login attempt results from an allowed-host
# then it is considered suspicious.  If this is NO, then suspicious logins 
# from allowed-hosts will not be reported.  All suspicious logins from 
# ip addresses that are not in allowed-hosts will always be reported.
#
SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES
######################################################################

######################################################################
#
# HOSTNAME_LOOKUP
#
# HOSTNAME_LOOKUP=YES|NO
# If set to YES, for each IP address that is reported by Denyhosts,
# the corresponding hostname will be looked up and reported as well
# (if available).
#
#HOSTNAME_LOOKUP=YES
#
######################################################################


######################################################################
#
# LOCK_FILE
#
# LOCK_FILE=/path/denyhosts
# If this file exists when DenyHosts is run, then DenyHosts will exit
# immediately.  Otherwise, this file will be created upon invocation
# and deleted upon exit.  This ensures that only one instance is
# running at a time.
#
# Redhat/Fedora:
LOCK_FILE = /var/lock/subsys/denyhosts
#
# Debian
#LOCK_FILE = /var/run/denyhosts.pid
#
# Misc
#LOCK_FILE = /tmp/denyhosts.lock
#
######################################################################


       ############ THESE SETTINGS ARE OPTIONAL ############


#######################################################################
#
# ADMIN_EMAIL: if you would like to receive emails regarding newly
# restricted hosts and suspicious logins, set this address to 
# match your email address.  If you do not want to receive these reports
# leave this field blank (or run with the --noemail option)
#
ADMIN_EMAIL = [email]info@suther.de[/email]
#
#######################################################################

#######################################################################
#
SMTP_HOST = localhost
SMTP_PORT = 25
SMTP_FROM = DenyHosts <nobody@localhost>
SMTP_SUBJECT = Einbruchsversuch >> DenyHosts Report 
#SMTP_USERNAME=foo
#SMTP_PASSWORD=bar
#
#######################################################################

######################################################################
#
# ALLOWED_HOSTS_HOSTNAME_LOOKUP
#
# ALLOWED_HOSTS_HOSTNAME_LOOKUP=YES|NO
# If set to YES, for each entry in the WORK_DIR/allowed-hosts file,
# the hostname will be looked up.  If your versions of tcp_wrappers
# and sshd sometimes log hostnames in addition to ip addresses
# then you may wish to specify this option.
# 
#ALLOWED_HOSTS_HOSTNAME_LOOKUP=NO
#
######################################################################

###################################################################### 
# 
# AGE_RESET_VALID: Specifies the period of time between failed login
# attempts that, when exceeded will result in the failed count for 
# this host to be reset to 0.  This value applies to login attempts 
# to all valid users (those within /etc/passwd) with the 
# exception of root.  If not defined, this count will never
# be reset.
#
# See the comments in the PURGE_DENY section (above) 
# for details on specifying this value or for complete details 
# refer to:  [url=http://denyhosts.sourceforge.net/faq.html#timespec]DenyHosts Frequently Asked Questions[/url]
#
AGE_RESET_VALID=3d
#
######################################################################

###################################################################### 
# 
# AGE_RESET_ROOT: Specifies the period of time between failed login
# attempts that, when exceeded will result in the failed count for 
# this host to be reset to 0.  This value applies to all login 
# attempts to the "root" user account.  If not defined,
# this count will never be reset.
#
# See the comments in the PURGE_DENY section (above) 
# for details on specifying this value or for complete details 
# refer to:  [url=http://denyhosts.sourceforge.net/faq.html#timespec]DenyHosts Frequently Asked Questions[/url]
#
AGE_RESET_ROOT=25d
#
######################################################################

###################################################################### 
# 
# AGE_RESET_RESTRICTED: Specifies the period of time between failed login
# attempts that, when exceeded will result in the failed count for 
# this host to be reset to 0.  This value applies to all login 
# attempts to entries found in the WORK_DIR/restricted-usernames file.  
# If not defined, the count will never be reset.
#
# See the comments in the PURGE_DENY section (above) 
# for details on specifying this value or for complete details 
# refer to:  [url=http://denyhosts.sourceforge.net/faq.html#timespec]DenyHosts Frequently Asked Questions[/url]
#
AGE_RESET_RESTRICTED=25d
#
######################################################################


###################################################################### 
# 
# AGE_RESET_INVALID: Specifies the period of time between failed login
# attempts that, when exceeded will result in the failed count for 
# this host to be reset to 0.  This value applies to login attempts 
# made to any invalid username (those that do not appear 
# in /etc/passwd).  If not defined, count will never be reset.
#
# See the comments in the PURGE_DENY section (above) 
# for details on specifying this value or for complete details 
# refer to:  [url=http://denyhosts.sourceforge.net/faq.html#timespec]DenyHosts Frequently Asked Questions[/url]
#
AGE_RESET_INVALID=10d
#
######################################################################


######################################################################
#
# RESET_ON_SUCCESS: If this parameter is set to "yes" then the
# failed count for the respective ip address will be reset to 0
# if the login is successful.  
#
# The default is RESET_ON_SUCCESS = no
#
#RESET_ON_SUCCESS = yes
#
#####################################################################


######################################################################
#
# 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 it's only argument.
#
#PLUGIN_DENY=/usr/bin/true
#
######################################################################


######################################################################
#
# PLUGIN_PURGE: If set, this value should point to an executable
# program that will be invoked when a host is removed from the
# HOSTS_DENY file.  This executable will be passed the host
# that is to be purged as it's only argument.
#
#PLUGIN_PURGE=/usr/bin/true
#
######################################################################

######################################################################
#
# USERDEF_FAILED_ENTRY_REGEX: if set, this value should contain
# a regular expression that can be used to identify additional
# hackers for your particular ssh configuration.  This functionality
# extends the built-in regular expressions that DenyHosts uses.
# This parameter can be specified multiple times.
# See this faq entry for more details:
#    [url=http://denyhosts.sf.net/faq.html#userdef_regex]DenyHosts Frequently Asked Questions[/url]
#
#USERDEF_FAILED_ENTRY_REGEX=
#
#
######################################################################




   ######### THESE SETTINGS ARE SPECIFIC TO DAEMON MODE  ##########



#######################################################################
#
# DAEMON_LOG: when DenyHosts is run in daemon mode (--daemon flag)
# this is the logfile that DenyHosts uses to report it's status.
# To disable logging, leave blank.  (default is: /var/log/denyhosts)
#
DAEMON_LOG = /var/log/denyhosts
#
# disable logging:
#DAEMON_LOG = 
#
######################################################################

#######################################################################
# 
# DAEMON_LOG_TIME_FORMAT: when DenyHosts is run in daemon mode 
# (--daemon flag) this specifies the timestamp format of 
# the DAEMON_LOG messages (default is the ISO8061 format:
# ie. 2005-07-22 10:38:01,745)
#
# for possible values for this parameter refer to: man strftime
#
# Jan 1 13:05:59   
#DAEMON_LOG_TIME_FORMAT = %b %d %H:%M:%S
#
# Jan 1 01:05:59 
#DAEMON_LOG_TIME_FORMAT = %b %d %I:%M:%S
#
###################################################################### 

#######################################################################
# 
# DAEMON_LOG_MESSAGE_FORMAT: when DenyHosts is run in daemon mode 
# (--daemon flag) this specifies the message format of each logged
# entry.  By default the following format is used:
#
# %(asctime)s - %(name)-12s: %(levelname)-8s %(message)s
#
# Where the "%(asctime)s" portion is expanded to the format
# defined by DAEMON_LOG_TIME_FORMAT
#
# This string is passed to python's logging.Formatter contstuctor.
# For details on the possible format types please refer to:
# [url=http://docs.python.org/lib/node357.html]6.29.6 Formatter Objects[/url]
#
# This is the default:
#DAEMON_LOG_MESSAGE_FORMAT = %(asctime)s - %(name)-12s: %(levelname)-8s %(message)s
#
#
###################################################################### 

 
#######################################################################
#
# DAEMON_SLEEP: when DenyHosts is run in daemon mode (--daemon flag)
# this is the amount of time DenyHosts will sleep between polling
# the SECURE_LOG.  See the comments in the PURGE_DENY section (above)
# for details on specifying this value or for complete details
# refer to:    [url=http://denyhosts.sourceforge.net/faq.html#timespec]DenyHosts Frequently Asked Questions[/url]
# 
#
DAEMON_SLEEP = 10s
#
#######################################################################

#######################################################################
#
# DAEMON_PURGE: How often should DenyHosts, when run in daemon mode,
# run the purge mechanism to expire old entries in HOSTS_DENY
# This has no effect if PURGE_DENY is blank.
#
DAEMON_PURGE = 5h
#
#######################################################################


   #########   THESE SETTINGS ARE SPECIFIC TO     ##########
   #########       DAEMON SYNCHRONIZATION         ##########


#######################################################################
#
# Synchronization mode allows the DenyHosts daemon the ability
# to periodically send and receive denied host data such that 
# DenyHosts daemons worldwide can automatically inform one
# another regarding banned hosts.   This mode is disabled by
# default, you must uncomment SYNC_SERVER to enable this mode.
#
# for more information, please refer to: 
#        http:/denyhosts.sourceforge.net/faq.html#sync 
#
#######################################################################


#######################################################################
#
# SYNC_SERVER: The central server that communicates with DenyHost
# daemons.  Currently, denyhosts.net is the only available server
# however, in the future, it may be possible for organizations to
# install their own server for internal network synchronization
#
# To disable synchronization (the default), do nothing. 
#
# To enable synchronization, you must uncomment the following line:
SYNC_SERVER = [url]http://xmlrpc.denyhosts.net:9911[/url]
#
#######################################################################

#######################################################################
#
# SYNC_INTERVAL: the interval of time to perform synchronizations if
# SYNC_SERVER has been uncommented.  The default is 1 hour.
# 
#SYNC_INTERVAL = 1h
#
#######################################################################


#######################################################################
#
# SYNC_UPLOAD: allow your DenyHosts daemon to transmit hosts that have
# been denied?  This option only applies if SYNC_SERVER has
# been uncommented.
# The default is SYNC_UPLOAD = yes
#
#SYNC_UPLOAD = no
SYNC_UPLOAD = yes
#
#######################################################################


#######################################################################
#
# SYNC_DOWNLOAD: allow your DenyHosts daemon to receive hosts that have
# been denied by others?  This option only applies if SYNC_SERVER has
# been uncommented.
# The default is SYNC_DOWNLOAD = yes
#
#SYNC_DOWNLOAD = no
SYNC_DOWNLOAD = yes
#
#
#
#######################################################################

#######################################################################
#
# SYNC_DOWNLOAD_THRESHOLD: If SYNC_DOWNLOAD is enabled this paramter
# filters the returned hosts to those that have been blocked this many
# times by others.  That is, if set to 1, then if a single DenyHosts
# server has denied an ip address then you will receive the denied host.
# 
# See also SYNC_DOWNLOAD_RESILIENCY
#
#SYNC_DOWNLOAD_THRESHOLD = 10
#
# The default is SYNC_DOWNLOAD_THRESHOLD = 3 
#
SYNC_DOWNLOAD_THRESHOLD = 2
#
#######################################################################

#######################################################################
#
# SYNC_DOWNLOAD_RESILIENCY:  If SYNC_DOWNLOAD is enabled then the
# value specified for this option limits the downloaded data
# to this resiliency period or greater.
#
# Resiliency is defined as the timespan between a hackers first known 
# attack and it's most recent attack.  Example:
# 
# If the centralized   denyhosts.net server records an attack at 2 PM 
# and then again at 5 PM, specifying a SYNC_DOWNLOAD_RESILIENCY = 4h 
# will not download this ip address.
#
# However, if the attacker is recorded again at 6:15 PM then the 
# ip address will be downloaded by your DenyHosts instance.  
#
# This value is used in conjunction with the SYNC_DOWNLOAD_THRESHOLD 
# and only hosts that satisfy both values will be downloaded.  
# This value has no effect if SYNC_DOWNLOAD_THRESHOLD = 1 
#
# The default is SYNC_DOWNLOAD_RESILIENCY = 5h (5 hours)
#
# Only obtain hackers that have been at it for 2 days or more:
#SYNC_DOWNLOAD_RESILIENCY = 2d
#
# Only obtain hackers that have been at it for 5 hours or more:
SYNC_DOWNLOAD_RESILIENCY = 2h
#
#######################################################################

Mod: Bitte in Zukunft die CODE-Tags nutzen
 
Last edited by a moderator:
Was steht denn in der besagen Zeit in /var/log/denyhosts?

Gruß flyingoffice
 
Da stehen nur neue vom Server gezogene IP-Adressen:
Code:
2006-09-04 10:17:19,143 - denyhosts   : INFO     received new hosts: ['195.146.234.139', '203.200.89.8', '192.83.182.20', '211.124.158.182', '85.214.28.188
', '80.109.196.185', '85.94.64.166', '200.244.97.131', '211.202.2.160', '80.65.131.2', '61.95.172.140', '195.66.85.94', '203.112.203.196', '61.162.230.146'
]
2006-09-04 11:17:57,722 - sync        : INFO     received 10 new hosts
2006-09-04 11:17:57,723 - denyhosts   : INFO     received new hosts: ['203.112.203.196', '62.20.84.67', '70.224.129.67', '220.194.56.173', '218.247.185.222
', '82.192.40.158', '59.120.41.92', '217.172.178.119', '200.243.156.5', '59.15.60.139']

MOD: Und nocheinmal... BITTE die CODE-Tags nutzen. Sprich anstatt [IDENT] nutzt du
Code:
![/I][/COLOR]
 
Last edited by a moderator:
Da fällt mir nicht wirklich viel ein :( . Die Konfig sieht, soweit ich sie überflogen habe. ok aus. Welche Version von Denyhosts hast Du installiert?

Gruß flyingoffice
 
Naja, ich glaube nicht das es an der Versio liegt, denn zuvor hatte es funktioniert - scheint mir zumindest so...

Wie kann ich den Fehler denn eingrenzen?
 
Problem weiter eingegrenzt

Nun scheine ich herrausgefunden zu haben, warum deneyhost nicht abriegelt.
Und zwar versucht da jemand mit unterschiedlichen Namen den Login zu knacken.

Deneyhost riegelt aber nur ab, wenn ein bestimmter Benutzername mehrfach ein falsches Passwort eingegeben hat.

Kann man das script nicht so erweitern, dass wenn eine IP-Adresse mehrfach hintereinander die Rückmeldung "Invalid user gregg from 206.161.192.210" bekommen hat, das diese IP dann auch gesperrt wird?
 
Dieses Verhalten konnte ich bei mir nicht beobachten. Auch bei unterschiedlichen Benutzernamen und gleicher IP wird geblockt. Siehe auch meine Logauszüge.

Gruß flyingoffice
 
Woran kann das denn dann liegen?
Kann es sein, das ich eine Konfigurationseinstellung falsch gemacht habe?
 
Ich habe mal Deine und meine Konfiguration verglichen. Folgende Unterschiede sind mir aufgefallen (nicht enthalten sind differenzen in Zeitangaben)

Code:
[B][COLOR="Red"]#ich[/COLOR][/B]
HOSTNAME_LOOKUP=YES
SYNC_INTERVAL = 1h
#SYNC_UPLOAD = yes

[B][COLOR="Red"]#Du[/COLOR][/B]
#HOSTNAME_LOOKUP=YES
#SYNC_INTERVAL = 1h
SYNC_UPLOAD = yes

Nicht wirklich große Unterschiede. Ob HOSTNAME_LOOKUP ggf. bei Dir eine Besserung bring, vermag ich nicht zu sagen. Du kannst es ja mal ausprobieren und berichten. Wie sieht denn Deine daemon-control in /usr/share/denyhosts aus?

Code:
[B][COLOR="Red"]#ich[/COLOR][/B]
DENYHOSTS_BIN   = "/usr/bin/denyhosts.py"
DENYHOSTS_LOCK  = "/var/lock/subsys/denyhosts"
DENYHOSTS_CFG   = "/usr/share/denyhosts/denyhosts.cfg"

Gruß flyingoffice
 
Code:
#!/usr/bin/env python
# denyhosts     Bring up/down the DenyHosts daemon
#
# chkconfig: 2345 98 02
# description: Activates/Deactivates the
#    DenyHosts daemon to block ssh attempts
#
###############################################

###############################################
#### Edit these to suit your configuration ####
###############################################

DENYHOSTS_BIN   = "/usr/bin/denyhosts.py"
DENYHOSTS_LOCK  = "/var/lock/subsys/denyhosts"
DENYHOSTS_CFG   = "/usr/share/denyhosts/denyhosts.cfg"


###############################################
####         Do not edit below             ####
###############################################

import os, sys, signal, time

# make sure 'ps' command is accessible (which should be
# in either /usr/bin or /bin.  Modify the PATH so
# popen can find it
env = os.environ.get('PATH', "")
os.environ['PATH'] = "/usr/bin:/bin:%s" % env

STATE_NOT_RUNNING = -1
STATE_LOCK_EXISTS = -2

def usage():
    print "Usage: %s {start [args...] | stop | restart [args...] | status | debug | condrestart [args...] }" % sys.argv[0]
    print
    print "For a list of valid 'args' refer to:"
    print "$ denyhosts.py --help"
    print
    sys.exit(0)


def getpid():
    try:
        fp = open(DENYHOSTS_LOCK, "r")
        pid = int(fp.readline().rstrip())
        fp.close()
    except Exception, e:
        return STATE_NOT_RUNNING


    if os.access("/proc", os.F_OK):
        # proc filesystem exists, look for pid
        if os.access(os.path.join("/proc", str(pid)), os.F_OK):
           return pid
        else:
            return STATE_LOCK_EXISTS
    else:
        # proc filesystem doesn't exist, use 'ps'
        p = os.popen("ps -p %d" % pid, "r")
        p.readline() # get the header line
        pid_running = p.readline()
        # pid_running will be '' if no process is found
        if pid_running:
            return pid
        else:
            return STATE_LOCK_EXISTS


def start(*args):
    cmd = "%s --daemon " % DENYHOSTS_BIN
    if args: cmd += ' '.join(args)

    print "starting DenyHosts:   ", cmd

    os.system(cmd)


def stop():
    pid = getpid()
    if pid >= 0:
        os.kill(pid, signal.SIGTERM)
        print "sent DenyHosts SIGTERM"
    else:
        print "DenyHosts is not running"

def debug():
    pid = getpid()
    if pid >= 0:
        os.kill(pid, signal.SIGUSR1)
        print "sent DenyHosts SIGUSR1"
    else:
        print "DenyHosts is not running"

def status():
    pid = getpid()
    if pid == STATE_LOCK_EXISTS:
        print "%s exists but DenyHosts is not running" % DENYHOSTS_LOCK
    elif pid == STATE_NOT_RUNNING:
        print "Denyhosts is not running"
    else:
        print "DenyHosts is running with pid = %d" % pid
def condrestart(*args):
    pid = getpid()
    if pid >= 0:
        restart(*args)


def restart(*args):
    stop()
    time.sleep(1)
    start(*args)


if __name__ == '__main__':
    cases = {'start':       start,
             'stop':        stop,
             'debug':       debug,
             'status':      status,
             'condrestart': condrestart,
             'restart':     restart}

    try:
        args = sys.argv[2:]
    except:
        args = []

    try:
        # arg 1 should contain one of the cases above
        option = sys.argv[1]
    except:
        # try to infer context (from an /etc/init.d/ script, perhaps)
        procname = os.path.basename(sys.argv[0])
        infer_dict = {'K': 'stop',
                      'S': 'start'}
        option = infer_dict.get(procname[0])
        if not option:
            usage()

    try:
        if option in ('start', 'restart', 'condrestart'):
            if '--config' not in args and '-c' not in args:
                args.append("--config=%s" % DENYHOSTS_CFG)

        cmd = cases[option]
        apply(cmd, args)
    except:
        usage()
 
OK, dann zum zweiten mal die Frage nach der Version. Ich nutze zur Zeit die 2.4b. Solltest Du eine niedrigere Version einsetzen, könnte das die mögliche Ursache für Dein Probelm sein

2.4b (April 9, 2006)
===================

- fixed missing "self." in loginattempt.py

Gruß flyingoffice
 
@rethus
Ist zwar nen bissel Offtopic aber schau dir mal PortKnocking an. Damit kannst du dir Denyhosts u.a sparen und hast nie wieder Probleme mit derartigen Attacken.
 
Back
Top