SSH brute force
-
- Posts: 86
- Joined: 2004-04-04 17:23
SSH brute force
Habe seit ein Paar wochen tonnenweise SSH brute force dinger in den secure logs (sind jeden Tag mehrere MB gross deswegen). Glücklicherweise sind die activen account mit riesen-passwörtern versehen.
Gibt es irgendwas, womit man die idioten nach dem 3. Versuch von derselben IP oder so für 1 Stunde blockieren kann?
Gibt es irgendwas, womit man die idioten nach dem 3. Versuch von derselben IP oder so für 1 Stunde blockieren kann?
-
- Posts: 5923
- Joined: 2004-05-23 12:53
Re: SSH brute force
Ja -> SuFu.Manarak wrote:Gibt es irgendwas, womit man die idioten nach dem 3. Versuch von derselben IP oder so für 1 Stunde blockieren kann?
-
- Posts: 104
- Joined: 2004-03-24 14:09
Re: SSH brute force
Schau Dir mal das hier an:Manarak wrote:Gibt es irgendwas, womit man die idioten nach dem 3. Versuch von derselben IP oder so für 1 Stunde blockieren kann?
http://www.sectoor.de/ssh-brute-force-filter.sh.txt
entsprechende Einstellungen darin vornehmen bevor Du es nutzt.
Gruesse,
Darkman
-
- Posts: 86
- Joined: 2004-04-04 17:23
Re: SSH brute force
Danke - ich bekomme jedoch "iptables has no recent module support" als fehlermeldung zurück.
Du must wissen, ich verwende Plesk als Adminhilfe.
Du must wissen, ich verwende Plesk als Adminhilfe.
-
- Posts: 1117
- Joined: 2002-09-27 00:54
- Location: Hannover
-
- Posts: 86
- Joined: 2004-04-04 17:23
Re: SSH brute force
Hallo Alexander
Danke für das Script - es scheint zu funktionieren?
Ich musste noch IPC-shareable installieren.
Dann habe ich das Script per Kommandozeile aufgerufen.
.ipblock wurde im /tmp angelegt.
Muss ich sonst noch was unternehmen?
Wird der IP Blocker bei einem Reboot auch wieder gestartet?
Danke für das Script - es scheint zu funktionieren?
Ich musste noch IPC-shareable installieren.
Dann habe ich das Script per Kommandozeile aufgerufen.
.ipblock wurde im /tmp angelegt.
Muss ich sonst noch was unternehmen?
Wird der IP Blocker bei einem Reboot auch wieder gestartet?
-
- Posts: 1117
- Joined: 2002-09-27 00:54
- Location: Hannover
Re: SSH brute force
Nein, wenn der nicht mit in die rc.d Sctipte eingetragen wird.
-
- Posts: 774
- Joined: 2004-04-26 15:57
Re: SSH brute force
Warum verwendest du nicht einfach ein paar Preshared Keys mit einen Otto Normal User und schaltest das ganz Passwortsystem ab, dann kann man nur noch mit den Preshared Keys auf die Kiste und dazu braucht man (wenn eingestellt) auch das Passwort, jeder der normales Passwortsystem versucht wird gleich abgewiesen. Noch eine Stufe härter ist dann Portknocking, aber nutz mal die Suchfunktion, das wurde hier schon so oft besprochen, sicher deine Kiste lieber wirklich statt dir um ein paar Script Kiddies Sorgen zu machen.
-
- Posts: 1117
- Joined: 2002-09-27 00:54
- Location: Hannover
Re: SSH brute force
Und jeder Benutzer ist gewillt (oder kann) Keys benutzern ? Nicht wirklich...
-
- Posts: 774
- Joined: 2004-04-26 15:57
Re: SSH brute force
Wenn man Putty nutzt ist das kein Aufwand. Die Keys erstellen, das Passwort festlegen in den Keys und den Nutzer sicher zusenden. Der macht mit Putty nur ein Profil und muss wie immer sein PW eingeben, da ist nicht viel Aufwand dahinter.
-
- Posts: 2138
- Joined: 2002-12-15 00:10
- Location: Bergheim
Re: SSH brute force
Ich denke auch, im Normalfall sind SSH Keys auch für Windows-Otto-Normal User kein Problem. Leute die zu Hause Linux einsetzten, werden das sowieso begrüßen.
Schwierig wird es erst, wenn man unterwegs mal drauf will und halt nicht immer Usb Stick oß mit sich rum schleppt.
Schwierig wird es erst, wenn man unterwegs mal drauf will und halt nicht immer Usb Stick oß mit sich rum schleppt.
-
- Posts: 470
- Joined: 2002-05-14 13:02
- Location: Karlsruhe City
Re: SSH brute force
Damit sie ihren Private Key, für den sie keine Phrase angegeben haben, überall hinkopieren? Nein danke. ;)
Gruss,
Out
Gruss,
Out
-
- Posts: 774
- Joined: 2004-04-26 15:57
Re: SSH brute force
Passphrase muss schon sein ;)
-
- Posts: 16
- Joined: 2005-10-21 12:01
Re: SSH brute force
Ich habe bei mir fail2ban installiert. Gibt es für Debian als Paket, sonst direkt bei fail2ban.sourceforge.net. Die Konfiguration ist relativ einfach und leicht erweiterbar. Ich überwache damit brute force attacks auf ssh, apache und proftpd und habe es so eingestellt, daß eine IP nach drei Fehlversuchen für eine Stunde gesperrt wird. Das hilft!
-
- Posts: 70
- Joined: 2005-11-23 00:56
Re: SSH brute force
hier noch mehr
http://www.csc.liv.ac.uk/~greg/sshdfilter/
http://nodomain.cc/archives/190-SSH-Bru ... oppen.html
http://denyhosts.sourceforge.net/
http://www.csc.liv.ac.uk/~greg/sshdfilter/
http://nodomain.cc/archives/190-SSH-Bru ... oppen.html
http://denyhosts.sourceforge.net/
What steps can I take to make sshd more secure?
OpenSSH has many settings that can be adjusted in order to increase security. You may wish to refer to OpenSSH security websites or to the many books on the subject. However, here are some things that you may wish to consider based on my experience:
1. Disable logins to root. This can be accomplished by setting the PermitRootLogin setting in the sshd_config file (typically, /etc/ssh/sshd_config).
PermitRootLogin no
2. Disable password logins entirely by editing the PasswordAuthentication setting. By doing so, each user with access to the server will need to create ssh keys (which is beyond the scope of this document).
PasswordAuthentication no
3. Run sshd on a different port. By default, sshd runs on port 22. Most sshd hackers will only attack port 22 so if you run sshd on a different port, the chances of being compromised are reduced dramatically. However, by running sshd on an alternate port requires each user to be aware of this (so if your server is accessed by many user accounts then this solution might not be feasible). To run sshd on an alternate port simply edit the sshd_config and set the Port setting appropriately:
Port 9922
To access yourserver running on port 9922 you would connect using the -p command line option:
$ ssh -p 9922 yourserver
Alternatively, you can edit your $HOME/.ssh/config file or your site-wide /etc/ssh/ssh_config file and add an entry similar to:
Host yourserver
Port 9922
4. Install DenyHosts!
Note: After saving changes to the sshd_config file you will need to restart the sshd server for these settings to take effect
-
- Posts: 1500
- Joined: 2002-12-04 10:22
- Location: 4. Server von rechts, 2. Reihe von oben
Re: SSH brute force
Hallo Leute,
ich habe aktuell gerade ne brute force am Hals, bekomme jedoch weder das erstgenannte Skript zum laufen, noch Alexanders, beide mit den bereits genannten Fehlern.
@Alex
Wo bekomme ich diesen IPC-Shareable für SuSE 9.1 her ??
Gruß Outi
ich habe aktuell gerade ne brute force am Hals, bekomme jedoch weder das erstgenannte Skript zum laufen, noch Alexanders, beide mit den bereits genannten Fehlern.
@Alex
Wo bekomme ich diesen IPC-Shareable für SuSE 9.1 her ??
Gruß Outi
-
- Posts: 1500
- Joined: 2002-12-04 10:22
- Location: 4. Server von rechts, 2. Reihe von oben
Re: SSH brute force
Wie kann ich den aktuellen BF stoppen ??
Gruß Outi
Gruß Outi
-
- Posts: 5923
- Joined: 2004-05-23 12:53
Re: SSH brute force
Outlaw wrote:Wie kann ich den aktuellen BF stoppen ??
Code: Select all
/etc/init.d/sshd stop
-
- Posts: 1500
- Joined: 2002-12-04 10:22
- Location: 4. Server von rechts, 2. Reihe von oben
Re: SSH brute force
Danke, hat sich erledigt, der BF hat aufgehört.
Naja, wenn ich den SSHD stoppe, komme ich ja selbst nicht mehr rein .... ;):D
Hab bei der Gelegenheit noch eine weitere Attacke von heute Nacht entdeckt, die erfolglos blieb. Sonst nix weiter in den Logs, alls paletti ....
Gruß Outi
Naja, wenn ich den SSHD stoppe, komme ich ja selbst nicht mehr rein .... ;):D
Hab bei der Gelegenheit noch eine weitere Attacke von heute Nacht entdeckt, die erfolglos blieb. Sonst nix weiter in den Logs, alls paletti ....
Gruß Outi
-
- Posts: 1500
- Joined: 2002-12-04 10:22
- Location: 4. Server von rechts, 2. Reihe von oben
Re: SSH brute force
Sehr interesante Geschichte das, werde mir mal alle Punkte nacheinander vornehmen.tommbutu wrote:hier noch mehr
http://www.csc.liv.ac.uk/~greg/sshdfilter/
http://nodomain.cc/archives/190-SSH-Bru ... oppen.html
http://denyhosts.sourceforge.net/
What steps can I take to make sshd more secure?
OpenSSH has many settings that can be adjusted in order to increase security. You may wish to refer to OpenSSH security websites or to the many books on the subject. However, here are some things that you may wish to consider based on my experience:
1. Disable logins to root. This can be accomplished by setting the PermitRootLogin setting in the sshd_config file (typically, /etc/ssh/sshd_config).
PermitRootLogin no
2. Disable password logins entirely by editing the PasswordAuthentication setting. By doing so, each user with access to the server will need to create ssh keys (which is beyond the scope of this document).
PasswordAuthentication no
3. Run sshd on a different port. By default, sshd runs on port 22. Most sshd hackers will only attack port 22 so if you run sshd on a different port, the chances of being compromised are reduced dramatically. However, by running sshd on an alternate port requires each user to be aware of this (so if your server is accessed by many user accounts then this solution might not be feasible). To run sshd on an alternate port simply edit the sshd_config and set the Port setting appropriately:
Port 9922
To access yourserver running on port 9922 you would connect using the -p command line option:
$ ssh -p 9922 yourserver
Alternatively, you can edit your $HOME/.ssh/config file or your site-wide /etc/ssh/ssh_config file and add an entry similar to:
Host yourserver
Port 9922
4. Install DenyHosts!
Note: After saving changes to the sshd_config file you will need to restart the sshd server for these settings to take effect
Danke für die Hinweise.
Gruß Outi
-
- Posts: 1117
- Joined: 2002-09-27 00:54
- Location: Hannover
Re: SSH brute force
perl -MCPAN -e "install IPC::Shareable"
-
- Posts: 774
- Joined: 2004-04-26 15:57
Re: SSH brute force
@Outlaw
Du kannst einfach den sshd stoppen, sollange du noch eingeloggt bist wird die Verbindung nicht getrennt. Ein kleiner Cronjob der dann den Dienst irgendwann wieder startet ist ja schnell geschrieben. Aber wer Keys nutzt, dem kann das relativ egal sein ;)
Du kannst einfach den sshd stoppen, sollange du noch eingeloggt bist wird die Verbindung nicht getrennt. Ein kleiner Cronjob der dann den Dienst irgendwann wieder startet ist ja schnell geschrieben. Aber wer Keys nutzt, dem kann das relativ egal sein ;)
-
- Posts: 48
- Joined: 2005-12-07 12:25
- Location: Luckau
Re: SSH brute force
Von dieser Methode mit dem iptables-recent-Modul bin ich ja nicht sehr begeistert. Es hat mich manchmal direkt bei der ersten Verbindung ausgesperrt und nach dem Sperr-Timeout kam ich trotzdem nicht rein. Manchmal hat es abrer auch funktioniert, wie es sollte :roll: