Jump to content



Attempted logins σε fedora


Recommended Posts

Η ιστορία έχει ως εξής: Αποφάσισα να στήσω ένα web server στο virtual machine που μου δίνει το grnet μέσω της πλατφόρμας okeanos, και ως λειτουργικό σύστημα επέλεξα το Fedora, έκανα yum update & yum upgrade, κουράστηκα :p, και το άφησα για τη Δευτέρα (σήμερα). Σήμερα πάω να κάνω login με το putty, username root, password τάδε, και μου εμφανίζει μήνυμα

 

Quote

There were κάτι χιλιάδες failed login attempts since the last successful login

 

γράφω στο terminal

 

tail -f /var/log/secure

και μου πετάει ένα κατεβατό:

 

Spoiler
Quote

Oct  3 14:02:46 snf-723758 sshd[31953]: Failed password for root from 221.229.172.76 port 12076 ssh2
Oct  3 14:02:47 snf-723758 unix_chkpwd[31991]: password check failed for user (root)
Oct  3 14:02:47 snf-723758 sshd[31953]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:02:48 snf-723758 sshd[31953]: Failed password for root from 221.229.172.76 port 12076 ssh2
Oct  3 14:02:51 snf-723758 sshd[31953]: Received disconnect from 221.229.172.76: 11:  [preauth]
Oct  3 14:02:51 snf-723758 sshd[31953]: Disconnected from 221.229.172.76 [preauth]
Oct  3 14:02:51 snf-723758 sshd[31953]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.229.172.76  user=root
Oct  3 14:02:54 snf-723758 sshd[31989]: Accepted password for root from 88.197.13.228 port 56080 ssh2
Oct  3 14:02:54 snf-723758 systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0)
Oct  3 14:02:54 snf-723758 sshd[31989]: pam_unix(sshd:session): session opened for user root by (uid=0)
Oct  3 14:03:24 snf-723758 unix_chkpwd[32163]: password check failed for user (root)
Oct  3 14:03:24 snf-723758 sshd[32148]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.229.172.76  user=root
Oct  3 14:03:24 snf-723758 sshd[32148]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:03:25 snf-723758 sshd[32148]: Failed password for root from 221.229.172.76 port 21487 ssh2
Oct  3 14:03:26 snf-723758 unix_chkpwd[32169]: password check failed for user (root)
Oct  3 14:03:26 snf-723758 sshd[32148]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:03:28 snf-723758 sshd[32148]: Failed password for root from 221.229.172.76 port 21487 ssh2
Oct  3 14:03:29 snf-723758 unix_chkpwd[32179]: password check failed for user (root)
Oct  3 14:03:29 snf-723758 sshd[32148]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:03:30 snf-723758 sshd[32148]: Failed password for root from 221.229.172.76 port 21487 ssh2
Oct  3 14:03:31 snf-723758 sshd[32148]: Received disconnect from 221.229.172.76: 11:  [preauth]
Oct  3 14:03:31 snf-723758 sshd[32148]: Disconnected from 221.229.172.76 [preauth]
Oct  3 14:03:31 snf-723758 sshd[32148]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.229.172.76  user=root
Oct  3 14:04:06 snf-723758 unix_chkpwd[32317]: password check failed for user (root)
Oct  3 14:04:06 snf-723758 sshd[32297]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.229.172.76  user=root
Oct  3 14:04:06 snf-723758 sshd[32297]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:04:08 snf-723758 sshd[32297]: Failed password for root from 221.229.172.76 port 60657 ssh2
Oct  3 14:04:08 snf-723758 unix_chkpwd[32318]: password check failed for user (root)
Oct  3 14:04:08 snf-723758 sshd[32297]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:04:10 snf-723758 sshd[32297]: Failed password for root from 221.229.172.76 port 60657 ssh2
Oct  3 14:04:11 snf-723758 unix_chkpwd[32329]: password check failed for user (root)
Oct  3 14:04:11 snf-723758 sshd[32297]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:04:13 snf-723758 sshd[32297]: Failed password for root from 221.229.172.76 port 60657 ssh2
Oct  3 14:04:13 snf-723758 sshd[32297]: Received disconnect from 221.229.172.76: 11:  [preauth]
Oct  3 14:04:13 snf-723758 sshd[32297]: Disconnected from 221.229.172.76 [preauth]
Oct  3 14:04:14 snf-723758 sshd[32297]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.229.172.76  user=root
Oct  3 14:04:17 snf-723758 lightdm: pam_unix(lightdm-greeter:session): session closed for user lightdm
Oct  3 14:04:17 snf-723758 lightdm: pam_unix(lightdm:session): session opened for user root by (uid=0)
Oct  3 14:04:38 snf-723758 polkitd[629]: Registered Authentication Agent for unix-session:6 (system bus name :1.156 [/usr/libexec/polkit-mate-authentication-agent-1], object path /org/mate/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Oct  3 14:04:47 snf-723758 unix_chkpwd[467]: password check failed for user (root)
Oct  3 14:04:47 snf-723758 sshd[452]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.229.172.76  user=root
Oct  3 14:04:47 snf-723758 sshd[452]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:04:50 snf-723758 sshd[452]: Failed password for root from 221.229.172.76 port 14319 ssh2
Oct  3 14:04:50 snf-723758 unix_chkpwd[489]: password check failed for user (root)
Oct  3 14:04:50 snf-723758 sshd[452]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:04:52 snf-723758 sshd[452]: Failed password for root from 221.229.172.76 port 14319 ssh2
Oct  3 14:04:53 snf-723758 unix_chkpwd[521]: password check failed for user (root)
Oct  3 14:04:53 snf-723758 sshd[452]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:04:55 snf-723758 sshd[452]: Failed password for root from 221.229.172.76 port 14319 ssh2
Oct  3 14:04:56 snf-723758 sshd[452]: Received disconnect from 221.229.172.76: 11:  [preauth]
Oct  3 14:04:56 snf-723758 sshd[452]: Disconnected from 221.229.172.76 [preauth]
Oct  3 14:04:56 snf-723758 sshd[452]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.229.172.76  user=root
Oct  3 14:05:29 snf-723758 unix_chkpwd[773]: password check failed for user (root)
Oct  3 14:05:29 snf-723758 sshd[759]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.229.172.76  user=root
Oct  3 14:05:29 snf-723758 sshd[759]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:05:31 snf-723758 sshd[759]: Failed password for root from 221.229.172.76 port 18704 ssh2
Oct  3 14:05:32 snf-723758 unix_chkpwd[786]: password check failed for user (root)
Oct  3 14:05:32 snf-723758 sshd[759]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:05:34 snf-723758 sshd[759]: Failed password for root from 221.229.172.76 port 18704 ssh2
Oct  3 14:05:35 snf-723758 unix_chkpwd[805]: password check failed for user (root)
Oct  3 14:05:35 snf-723758 sshd[759]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Oct  3 14:05:37 snf-723758 sshd[759]: Failed password for root from 221.229.172.76 port 18704 ssh2
Oct  3 14:05:37 snf-723758 sshd[759]: Received disconnect from 221.229.172.76: 11:  [preauth]
Oct  3 14:05:37 snf-723758 sshd[759]: Disconnected from 221.229.172.76 [preauth]
Oct  3 14:05:37 snf-723758 sshd[759]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.229.172.76  user=root

 

 

Τι κάνω εγώ από εδώ και πέρα; Απ'ότι καταλαβαίνω είναι brute force attack.

Εννοείται ότι το password που μου έδωσε το okeanos το έχω αλλάξει σε ένα 20 χαρακτήρων με πεζά, κεφαλαία, αριθμούς, σύμβολα.

Το okeanos μου έχει δώσει ένα server key και ένα public key, τα οποία όμως δεν ξέρω πως να τα χρησιμοποιήσω :p

 

ΥΓ το μηχάνημα δεν έχει τίποτα πάνω του, ακόμα. Μόνο το λειτουργικό

Link to comment
Share on other sites

Έχεις αρκετές επιλογές. Η εύκολη είναι να κόβεις το ssh από όλες εκτός συγκεκριμένες διευθύνσεις. Εάν θέλεις να έχεις πρόσβαση από παντού, μπορείς να σκεφτείς την επιλογή VPN. Μία άλλη επιλογή είναι να επιτρέψεις στο ssh να συνδέεται μόνο με certificates και όχι username/pass. Μία τρίτη είναι να ρυθμίσεις firewall να ρίχνει πακέτα όταν έχεις αριθμό συνδέσεων από συγκεκριμένη IP > από κάποιο αριθμό/μονάδα χρόνου (πχ για > 100 συνδέσεις σε 5 λεπτά, κάνε drop για 10 λεπτά).

Ακόμη και τίποτα να μην κάνεις, οι πιθανότητες να στο χακάρουν με τον κωδικό που έχεις βάλει είναι μικρές.

Έγινε επεξεργασία από minast
typo
  • Like 1
Link to comment
Share on other sites

Ξεκινάω ανάποδα, γιατί τέτοιος είμαι :p

 

11 minutes ago, minast said:

Ακόμη και τίποτα να μην κάνεις, οι πιθανότητες να στο χακάρουν με τον κωδικό που έχεις βάλει είναι μικρές.

 

Βασικός σκοπός μου, με την όλη διαδικασία, είναι να μάθω, οπότε δε θέλω να το αφήσω έτσι :)

 

11 minutes ago, minast said:

Μία άλλη επιλογή είναι να επιτρέψεις στο shh να συνδέεται μόνο με certificates και όχι username/pass

 

Αυτή η επιλογή μ'αρέσει. Έχει να κάνει με τα keys που μου έδωσε το okeanos; (ένα server key χχ:xx:xx:xx:xx:xx:xx κι ένα public key ssh-rsa μπλα μπλα μπλα)

 

Επίσης, συνδέομαι με root. Σωστό ή λάθος; Είναι συνετό να φτιάξω έναν (super)user για να στήσω το server ή δεν κάνει διαφορά;

Link to comment
Share on other sites

Τα πιστοποιητικά είναι εύκολα, αλλά θέλει προσοχή να μην τα χάσεις και κλειδωθείς έξω (εάν κόψεις εντελώς το user/pass).

https://support.ssh.com/manuals/server-admin/40/Server_Authentication_with_Certificates.html

Εν γένει καλό είναι να μην εκθέτεις τον root, αλλά να φτιάξεις έναν χρήστη που θα μπορεί να κάνει sudo και να διαχειρίζεσαι από εκεί το μηχάνημα. Δεν αυξάνει πάρα πολύ την απομακρυσμένη ασφάλεια, αλλά είναι καλή πρακτική και σε υποχρεώνει να προσέχεις τί τρέχεις ως root.

  • Like 2
Link to comment
Share on other sites

Πρώτα αλλάζεις τη θύρα που ακούει ο SSH server.

Προσθέτεις νέο χρήστη, τον βάζεις στους sudoers και αφαιρείς από τον root την δυνατότητα απομακρυσμένης σύνδεσης στον ssh.

Και εννοείται απαγορεύεις την χρήση κωδικών παρά μόνο public-private key pairs.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Δημιουργία...

Important Information

Ο ιστότοπος theLab.gr χρησιμοποιεί cookies για να διασφαλίσει την καλύτερη εμπειρία σας κατά την περιήγηση. Μπορείτε να προσαρμόσετε τις ρυθμίσεις των cookies σας , διαφορετικά θα υποθέσουμε ότι είστε εντάξει για να συνεχίσετε.