0.022
thk thk Πεμ. 15 Ιαν. 2009 13:04 tags λίνουξ 1 views 7 σχόλια
I had a problem last night as I saw sshd processes on my server hit 100% CPU.
It was late so I thought it was something I ve done and so I rebooted debian (after 270+ days). But this morning the same thing was going on. And then it struck me: Someone was trying to login through ssh .
To see if someone is trying to login through ssh do a :
tail -f /var/log/auth.log
 The reason I am writing all these is because the solution was so sweet and simple.
Yes it is debian at it's glory with one of the best tools written for linux.
Call it aptitude or apt-get.
In this case all I was needed to do was a
apt-get install denyhosts

And then a tail -f on auth.log showed:

Jan 15 12:49:50 debian sshd[21281]: Failed password for root from 65.75.189.23 port 41225 ssh2
Jan 15 12:49:50 debian sshd[21283]: (pam_unix) authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=65.75.189.23  user=root
Jan 15 12:49:52 debian sshd[21283]: Failed password for root from 65.75.189.23 port 41351 ssh2
Jan 15 12:49:53 debian sshd[21300]: refused connect from ::ffff:65.75.189.23 (::ffff:65.75.189.23

Denyhosts is a python (again) script that monitors unsuccesful login attempts and then denies access to ssh for these by putting attackers' ip in /etc/hosts.deny.
You can read more :
http://www.howtoforge.com/preventing_ssh_dictionary_attacks_with_denyhosts
And by the way on debian etch denyhosts is installed as a daemon and you have not to configure anything.
Bye bye.


από koukos koukos 2009-01-15 14:53
mr.Smartass to mr.Invader :
Reset your router and try again...

(whooops )
από thk thk 2009-01-15 15:16
koukos wrote :
mr.Smartass to mr.Invader :
Reset your router and try again...

(whooops )
denyhosts run as daemon.Invader mus reset router all time. invaders must die (new single by prodigy). [sorry if offended u]
από koukos koukos 2009-01-15 17:58
thk wrote :
denyhosts run as daemon.Invader mus reset router all time. invaders must die (new single by prodigy). [sorry if offended u]
Δηλαδή τι ? Κάθε ssh σύνδεση που πάει να γίνει την απορρίπτει και την μπλοκάρει ? Ο admin δεν συμμετέχει πουθενά στην έγκριση ή μη της σύνδεσης ?
Αυτό μπορεί να λειτουργήσει πολύ άσχημα..
Εκτός κι αν πχ στις 'x' αποτυχημένες συνδέσεις μπαίνει το block.

[no offend !? where did that one come from ?]

από thk thk 2009-01-16 00:17
koukos wrote :
Δηλαδή τι ? Κάθε ssh σύνδεση που πάει να γίνει την απορρίπτει και την μπλοκάρει ? Ο admin δεν συμμετέχει πουθενά στην έγκριση ή μη της σύνδεσης ?
Αυτό μπορεί να λειτουργήσει πολύ άσχημα..
Εκτός κι αν πχ στις 'x' αποτυχημένες συνδέσεις μπαίνει το block.

[no offend !? where did that one come from ?]

Ψαχνει καθε τόσο τα logs /var/log/auth.log και αν δεί συνεχομενες αποτυχημενες προσπαθειες τρως πόρτα. Τωρα ποσες πρεπει να ναι αυτές ή τι αλλα κριτηρια έχει δε το ψαξα. Εγω ευχαριστώ τον τυπο που το γραψε οπως και τον τυπο που  εγραψε το apt-get γιατι ειχα ενα προβλημα και εγραψα apt-get install denyhosts και μετά δεν υπηρχε πρόβλημα. Αλλο πραμα το linux στο server και τελείως άλλο στο desktop. Βεβαια αν με κλειδωσει ποτε απ'εξω θα βλαστημησουν την ωρα και τη στιγμη που αποφασισαν να γραψουν open source.
από koukos koukos 2009-01-16 01:35
Ρίξε μια ματιά εδώ
από koukos koukos 2009-01-16 01:37
koukos wrote :
Ρίξε μια ματιά εδώ
και btw αυτός είναι καθηγητής στην Ασοεε
από thk thk 2009-01-16 04:17
koukos wrote :
koukos wrote :
Ρίξε μια ματιά εδώ
και btw αυτός είναι καθηγητής στην Ασοεε
Δηλαδή πηγαν να ασφαλίσουν έναν computer που τον είχαν αφήσει ετσι και αλλιώς σε public access.
Παλια ειχα γοητευθει πολυ απο το security ειχα σκασει και πολλα λεφτα να αγοράσω βιβλία . Εχω κανει και  brute force attack αλλα καλυπτομαι νομικα γιατι ήταν στα πλαισια εργασιας .Βεβαια αδεια δεν ειχα παρει και με βρηκαν και μου βαλανε χερι. Μαλλον αυτο που χτυπαγε τον server ειναι virus που κολλαει σε apache . Tο ip που με χτυπαγε τρεχει apache και λεει CENTOS (  65.75.189.23 ) .Εντωμεταξύ τιθεται και αλλο ερωτημα απο ενα απο τα πολλα services που σου διχνει που ειναι το ip,  αυτο με πεταει με google maps σε ενα σπιτι.Τι? Τοσο εξελιγμένος είναι ο μεγαλος αδερφος στο αμερικα που δινεις ip και σε οδηγει σπίτι? εδω αμα δωσεις το δικο μου σε παει στα γραφεια της vivodi.
  Τα βιβλια του Καβουρα και του Κιουντουζη ήταν τα πιο ωραία στη ΑΣΟΕΕ γιατι σου παραλληλιζαν τη πληροφορικη με την αληθινή ζωή.
Σας αφηνω γιατι με το svn merge to xaos megalonei sta programmata mu.