8 ms·
Haven't tried it for myself -- but looking at the code, it appears that the last rule needs to be changed to port 22 for SSH to work.
by covertgeek 13y ago
Haven't tried it for myself -- but looking at the code, it appears that the last rule needs to be changed to port 22 for SSH to work.
- ck2 13y agoSSH should be immediately moved off port 22 in virtually any install. The amount of toxic traffic hitting that port is scary.
- gmuslera 13y agoIf you think someone could get in thru the ssh port (exploiting an undisclosed vulnerability or with brute force password cracking) moving it elsewhere is not a long term solution. fail2ban is good to avoid brute force attacks, but portknocking with i.e. fwknop will be safer in more situations. If a service is not meant for the public then they shouldn't be able to even notice that is there.
- MertsA 13y agofail2ban and other programs that just grep a log file are a horrible idea as most of them can't properly parse a log entry and it's possible to inject an arbitrary ip address into the log file one way or another. I'm not sure if there are any outstanding exploits for the latest version of fail2ban right now but the whole concept of searching through log files that are in a format that can change at any time, aren't delimited properly, and subject to the sysadmin customizing is a precarious one at best. Even if fail2ban and others were perfect, all it would take is the sysadmin customizing the log format to include some random field and all the sudden it's possible for an attacker to block every IP address with one request. Source: http://seclists.org/fulldisclosure/2007/Jun/138 http://seclists.org/fulldisclosure/2007/Jun/138 A better alternative is something like pam_abl which only protects logins to a user on the system but with it ssh is essentially unbruteforceable.
- yrro 13y agoDoes pam_abl work when you're not using PAM for authentication--only for authorization ("account") and session management? e.g., when UsePAM is enabled, but ChallengeResponseAuthentication and PasswordAuthentication are disabled. I believe this is the problem with using pam_tally2. Then again, if you're only allowing PubkeyAuthentication then maybe you don't care about brute force login attempts so much.
- thirsteh 13y agoIf you're worried about that, it probably shouldn't be publicly accessible in the first place. Yes, moving ports helps, but it's not a real defense. It just lowers bandwidth costs and prevents some not-so-harmful attacks (from people who don't know whether what they've compromised has any value.) At the very least, use public-key authentication instead of password authentication for SSH.
- erichurkman 13y agoOne nice side bonus to moving to non-standard SSH ports? Your log files are a lot less noisy.
- ck2 13y agoYou then also can easily detect bad behavior by watching failed connect attempts to port 22.
- pepve 13y agoIt's indeed a large amount of traffic. But it's not scary. None of it will get through if your SSH software is up to date, you have it configured properly, and user accounts are managed sanely. The attacks to be scared of are those that are actually targeted at you. And they will find the port SSH is running on either way.
- Shish2k 13y ago> None of it will get through if your SSH software is up to date, you have it configured properly, and user accounts are managed sanely. So in the majority of cases, traffic will get through? :P
- kamaln7 13y agoOr perhaps firewall your server properly so only people who are meant to connect to port 22 can connect to it?
- brokenparser 13y agoOh I know, we could use iptables!
- herge 13y agoEvery time somebody suggests this, you should not say it's for security purposes, but to reduce the load on a server.
- qu4z-2 13y agoAnd to reduce load on the person checking the logs.
- D9u 13y agoNot scary if you disable password logins, implement PKI, and limit logins to specific addresses. I get a kick out of viewing all the failed attempts in /var/log/auth Added bonus is adding all those bad guy addresses to my blacklists.
- est 13y agopassive port knocking should be standard.