Versuch in SQL einzubrechen?

Nobby

Unwichtig
Hallo auch,

seit gestern abend habe ich folgende Einträge in der auth.log, wäre jemand so nett und würde mich aufklären, was das bedeutet, da ich Einträge dieser Art noch nie hatte und mir kein Reim sich darauf erschliesst und ich den starken Verdacht habe, dass es mich nun auch einmal "erwischt" hat!

Code:
Feb 24 22:37:09 h1848xxx sshd[3868]: pam_unix(sshd:auth): check pass; user unknown
Feb 24 22:37:09 h1848xxx sshd[3868]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=h1977577.stratoserver.net 
Feb 24 22:37:10 h1848xxx sshd[3868]: Failed password for invalid user guest from 85.214.235.117 port 44880 ssh2
Feb 24 22:39:01 h1848xxx CRON[3873]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 24 22:39:01 h1848xxx CRON[3873]: pam_unix(cron:session): session closed for user root
Feb 24 22:45:01 h1848xxx CRON[3943]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 24 22:45:01 h1848xxx CRON[3943]: pam_unix(cron:session): session closed for user root
Feb 24 22:45:56 h1848xxx sshd[3946]: Invalid user david from 85.214.235.117

Code:
Feb 25 05:11:46 h1848xxx postfix/smtpd[9595]: sql auxprop plugin using sqlite3 engine 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin Parse the username webmaster 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin try and connect to a host 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin trying to open db '/plesk/passwd.db' on host 'localhost' 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin Parse the username webmaster 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin try and connect to a host 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin trying to open db '/plesk/passwd.db' on host 'localhost' 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin Parse the username webmaster 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin try and connect to a host 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin trying to open db '/plesk/passwd.db' on host 'localhost' 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: begin transaction
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin create statement from userPassword webmaster h1848xxx.stratoserver.net 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin doing query SELECT `userPassword` FROM domains d, users u WHERE u.name='webmaster' and d.name='h1848xxx.stratoserver.net' and d.status=0 and u.status=0 and u.dom_id=d.id; 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql_sqlite3 plugin: no result found
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin create statement from cmusaslsecretPLAIN webmaster h1848xxx.stratoserver.net 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql plugin doing query SELECT `cmusaslsecretPLAIN` FROM domains d, users u WHERE u.name='webmaster' and d.name='h1848xxx.stratoserver.net' and d.status=0 and u.status=0 and u.dom_id=d.id; 
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: sql_sqlite3 plugin: no result found
Feb 25 05:11:49 h1848xxx postfix/smtpd[9595]: commit transaction

Code:
Feb 25 10:45:01 h1848xxx CRON[12153]: pam_unix(cron:session): session opened for user root by (uid=0)
Feb 25 10:45:01 h1848xxx CRON[12153]: pam_unix(cron:session): session closed for user root
Feb 25 10:52:31 h1848xxx sshd[12165]: Accepted password for root from 80.142.24.196 port 49356 ssh2
Feb 25 10:52:31 h1848xxx sshd[12165]: pam_unix(sshd:session): session opened for user root by (uid=0)
Feb 25 10:52:31 h1848xxx sshd[12165]: subsystem request for sftp

Debian6 mit Plesk 10.4.4
Root-Login nicht erlaubt
ssh-Port verlegt

Ausser einer statischen HTML-Seite für einen befreundeten Tättoowierer, einer Domain für mich zum testen/basteln für Templatedesign und einer Subdomain für einen bei JTL gehosteten Shop mit einem Forum (wbb-lite) läuft nichts weiteres, da der Rest des Platzes nur für Filmtrailer dient, welche ich dort ablege und im (gehosteten) Shop einbinde.

Was ist (macht)das und was kann ich dagegen unternehmen??

Gruss Nobby
 
Die Postfix-Logs sind normales Grundrauschen, aber Deine sshd_config muss nachgebessert werden. Bitte poste Deine vollständige sshd_config.
 
Die sshd_config und/oder die ssh_config?

sshd_config:

Code:
# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
 
Code:
Feb 25 10:52:31 h1848xxx sshd[12165]: Accepted password for root from 80.142.24.196 port 49356 ssh2
Feb 25 10:52:31 h1848xxx sshd[12165]: pam_unix(sshd:session): session opened for user root by (uid=0)
Feb 25 10:52:31 h1848xxx sshd[12165]: subsystem request for sftp


Root-Login nicht erlaubt

Das widerspricht sich - und der SSH-Port ist laut Config auch nicht verlegt.
 
Code:
PermitRootLogin yes

Root-Login sollte man nicht erlauben. Dafür aber Key-Auth aktivieren. Deine Config passt aber irgend wie nicht zu den Logs.
 
Uahrgs, ich bin fest der Meinung ich habe rootlogin auf no und den Port habe ich verlegt nach 180!

Kann das mit dem letzten Pleskupdate zusammenhängen? Das Update auf 10.4.4 war gestern morgen.

@tomasini: wie muss ich das verstehen die config passt nicht zu den Logs?
 
Ich habe mich da eventl. etwas missverständlich ausgedrückt. Laut Config ist Root-Access aktiv und SSH lauscht auf den Default-Port 22. Darüber hinaus bedeutet der Log-Auszug, den wstuemer gepostet hat, dass sich heute morgen jemand via SFTP von einer Telekom-IP auf deinen Server connectet hat. Wenn das nicht du warst und sonst auch niemand das Root-Passwort kennt, würde ich das jetzt als Problem ansehen.

Generell sollte man m.M. SSH immer so konfigurieren.

- Keinen Root-Login erlauben
- Login per Passwort ebenfalls nicht erlauben
- Login nur per Public Key erlauben

Den Port zu verlegen ist m.M. reine Kosmetik. Die Logs werden dadurch etwas kleiner. Echte Sicherheit bringt das aber nicht wirklich, da ich den verlegten Port via Portscan sehr leicht herausfinden kann. Von so Dingen wie Fail2bain halte ich übrigens auch nichts. Einen echten Sicherheitsgewinn würdest du dadurch erzielen, indem du z.B. zusätzlich OpenVPN benutzt und SSH auf eine nicht-öffentliche IP legst. Somit wäre SSH von außen gar nicht mehr "sichtbar".
 
Okay, ich sehe das dann grösstenteils mal als falschen Alarm an, denn die Telekom-IP 80.142.24.196 ist meine:o

Die nächsten Schritte also sind die angegebenen Schritte Rootlogin, kein Passwort und PublicKey, wobei ich mir zu 100% sicher bin den Root-Login auf no gestellt zu haben.

Und dann wäre da noch OpenVPN, da müsste ich mich aber erst einlesen.

Ich danke für die Hilfe, lieber einmal zu viel als zu wenig nachgefragt;)
 
Bitte umgehend UsePAM kommentieren und den SSHd restarten:
Code:
#UsePAM yes
Wer hat Dir erzähhlt, dass UsePAM eine tolle Idee ist?
 
Den Root-Login zu sperren erschwert etliche automatisierte Prozesse massiv.
Meiner Meinung reicht es, wenn man den Login nur per Pub-Key erlaubt.
 
Den Root-Login habe ich jetzt gesperrt, und sitze gerade beider Anmerkung von Joe von wegen UsePAM yes und gute Idee. Angemerkt, es hat mir niemand gesagt dass es eine gute Idee ist es auf yes zu lassen, das ist wohl standart bei Plesk bzw. Debian.

Allerdings blicke ich das noch nicht, das ist etwas zu viel Fachchinesisch welches ich noch nie gehört habe und versuche lokal mich da "hereinzubasteln".
 
UsePAM hebelt alle Deine anderen sicherheitsrelevanten Einstellungen aus, daher sollst Du eine Raute davor setzen und den SSHd restarten.
 
Back
Top