Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have very little experience in security matters, so I would appreciate any input.
Noticed these two notifications in /var/log/messages today:
Code:
Mar 23 10:57:41 slack sshd[12012]: Did not receive identification string from 172.**.***.254
Mar 23 13:24:57 slack sshd[17393]: Failed password for root from 172.**.***.254 port 1459 ssh2
I don't recognize the ip. Is this harmless or should I be concerned?
that's normal when you have a box connected to the internet (be it directly or through any other means).
some machines out there run port scanners and then (or w/o running scanners before maybe as well *shrug*) run a bot program
to try a combination of usernames & passwords, or only passwords with un=root.
Depending how your machine is set up, it's a risk or not.
external root login is usually disabled, but I think sshd though allows it by default, so have to change that in config.
I have very little experience in security matters, so I would appreciate any input.
Noticed these two notifications in /var/log/messages today:
Code:
Mar 23 10:57:41 slack sshd[12012]: Did not receive identification string from 172.**.***.254
Mar 23 13:24:57 slack sshd[17393]: Failed password for root from 172.**.***.254 port 1459 ssh2
I don't recognize the ip. Is this harmless or should I be concerned?
Something like this will get rid of repeated attempts:
Code:
iptables -A INPUT -i eth0 -p tcp -m tcp --dport 22 -m state --state NEW -m recent --update --seconds 360 --hitcount 3 --name SSHATTEMPTS --rsource -j DROP
iptables -A INPUT -i eth0 -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name SSHATTEMPTS --rsource
Something like this will reject further attempts from that location:
Code:
iptables -I INPUT -s 124.38.246.51 -j DROP
Of course you need to save those somewhere that will be executed on startup if you want them to persist between reboots.
As the other person who replied mentioned, this is a common occurrence for any machine on the internet, if you move the ssh port to something in the normal dataport range you might have better luck not getting port scanned and turning off root logins for ssh is always advisable unless you have a specific need for it.
Mar 23 10:57:41 slack sshd[12012]: Did not receive identification string from 172.**.***.254
Mar 23 13:24:57 slack sshd[17393]: Failed password for root from 172.**.***.254 port 1459 ssh2
I don't recognize the ip. Is this harmless or should I be concerned?
Not harmless. To implement the "disable root login" suggestions, add the following directive to sshd_config and then reload sshd.
Code:
PermitRootLogin no
Going forward, ssh to your server as a regular user and then su to root.
to get rid of those attempts, i always disable root login in sshd config and install denyhosts (1).
Denyhosts reads the logs then it blocks the ip addresses that try to login with incorrect user or pass via ssh. it uses /etc/hosts.deny
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.