Slashdot Mirror


Coping With 1 Million SSH Authentication Failures?

An anonymous reader writes "I own a small Web development studio that specializes in open source software, primarily Drupal, WordPress, and Joomla for small businesses. Our production servers, which host about 50 sites and generate ~20K hits/week, are managed by a 3rd party that I'm sure many on Slashdot would recognize. Earlier today I was researching some problems on one of our sites and found that there have been over 1 million SSH authentication failures from ~1200 IP addresses on one of our servers over the last year. I contacted the ISP, who had promised me that server security would be actively managed, and their recommendation was, 'change the SSH port!' Of course this makes sense and may help to an extent, but it still doesn't solve the problem I'm facing: how do you manage server security on a tight budget with literally no system admin (except for me and I know I'm a n00b)? User passwords are randomly generated, we use a non-standard SSH port, and do not use any unencrypted services such as FTP. Is there a server monitoring program you would recommend? Is there an ISP or Web-based service that specializes in this?"

497 comments

  1. fail2ban by Anonymous Coward · · Score: 5, Informative

    fail2ban, key-auth

    1. Re:fail2ban by jimpop · · Score: 5, Informative

      > fail2ban, key-auth

      +1

      Change port. Use iptables to only allow access from known subnets/hosts.

    2. Re:fail2ban by sstern · · Score: 2, Informative

      Install OSSEC, too. There may be other stuff going on.

      --
      --Steve
    3. Re:fail2ban by B'Trey · · Score: 2, Informative

      And use DenyHosts

      --

      "The legitimate powers of government extend only to such acts as are injurious to others." Thomas Jefferson.

    4. Re:fail2ban by Anonymous Coward · · Score: 0

      +1
      There is no one answer and not every solution will fit everyone requirements but remember, security in layers.
      Limiting the source IP to a range of where your users would be coming from will make the biggest difference. If you have random people coming in from everywhere that obviously won't work.

    5. Re:fail2ban by Kugrian · · Score: 4, Funny

      Someone fucked up big time when they taught you html:
      [url]http://www.fail2ban.org/[/url]

    6. Re:fail2ban by Anonymous Coward · · Score: 0

      lolol

    7. Re:fail2ban by wdsci · · Score: 1

      Either DenyHosts or Fail2ban - I've looked at both and I don't know any reason to strongly prefer one over the other. They have slightly different feature sets so it depends on your preference, to some extent.

    8. Re:fail2ban by mellon · · Score: 1

      Word. I don't ever allow password-based logins on my servers. Users on my server don't even *have* passwords. Random passwords are probably pretty safe, but why take the chance? Nobody's going to guess a 2048-bit RSA key. This means I can't use sudo, but I'm okay with that - if you need root, you need the root password, and you need to be in the group that's allowed to su. But you almost certainly don't need root.

    9. Re:fail2ban by mellon · · Score: 4, Insightful

      This is really cool until you find yourself trying to log in from the same access point where somebody with a virus was attached earlier in the day. Better to just use crypto (key-based authentication only) and rate-limiting.

    10. Re:fail2ban by daveime · · Score: 3, Funny

      Because it your production server is *nix, you are probably *already* running a shitload of random scripts written by unknown cunts ?

    11. Re:fail2ban by Sandman1971 · · Score: 4, Informative

      Not only use something like DenyHost or Fail2Ban, but firewall off all IP classes from Asia, South America and any other region that you know you'll never SSH from. I can easily get the /8s and such that are in use by each region (just look up Apnic, RIPE, etc...).

      --
      It's better to burn out than to fade away
    12. Re:fail2ban by Anonymous Coward · · Score: 0

      totally agree with you. I use iptables to only allow my hosts to SSH. Also, what I do with my dedicated server is having more than one ip you can put your website in one and ssh in another then people can't guess it.

    13. Re:fail2ban by Anonymous Coward · · Score: 0

      So you have moved the problem from a server you have control over to one of your users machines.

    14. Re:fail2ban by xlotlu · · Score: 1

      This is really cool until you find yourself trying to log in from the same access point where somebody with a virus was attached earlier in the day. Better to just use crypto (key-based authentication only) and rate-limiting.

      You can mitigate that with knockd. Or if you're paranoid enough stick to knockd all the way...

      I for one left password authentication enabled in sshd, and made all user passwords unusable (passwd -l). Let the bots have their fun and waste time.

      The only improvement to this would be fail2ban with a tarpit rule...

    15. Re:fail2ban by Anonymous Coward · · Score: 2, Informative

      Or block when connections per time interval exceed a given number:
      iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP
      In this case, more than 4 attempts in a minute

    16. Re:fail2ban by venom85 · · Score: 2, Informative

      This is really cool until you find yourself trying to log in from the same access point where somebody with a virus was attached earlier in the day. Better to just use crypto (key-based authentication only) and rate-limiting.

      That depends on how you have Fail2Ban set up. If you have it set to block for a very long period of time, then yes, this would be a problem. But I have it set to just block for 10 minutes. Even if I manage to lock myself out accidentally, I only have to wait 10 minutes. That short 10 minute block is usually more than enough to make bots move on. I've had a few of them continue to hammer away after the 10 minutes are up, but in a couple years it's been a very small percentage.

      And to the guy who suggested using DenyHosts in addition to Fail2Ban, you're wasting your time. Fail2Ban performs the exact same thing as DenyHosts, but Fail2Ban does it for more services besides SSH. They're both good tools, but using them together is just unnecessary.

    17. Re:fail2ban by codeguy007 · · Score: 3, Interesting

      Nobody's going to guess a 2048-bit RSA key.

      No but they can steal if from your users' computers. It's one thing to have staff use keys when they are on your secure network but having users who are out on the web using keys when you can't control the security on their machines is only as secure as your dumbest client. Of course if they can hack and steal keys, they can probably steal passwords as well. For remote access one of the securest ways is using a security token. Every time user logs in they have to enter a different number.

    18. Re:fail2ban by gmack · · Score: 5, Informative

      fail2ban firewalls off the port for a time you specify

      DenyHosts blocks the ip in /etc/hosts.deny

      I find fail2ban to be much more effective since I can use it for more than just SSH (on my system: ftp, imap, pop3, ssh, smtp). Some of the newer botnets will attempt to crack the password using another service and then try the resulting password on ssh so it's important to have more complete coverage.

    19. Re:fail2ban by micheas · · Score: 2, Interesting

      Nobody's going to guess a 2048-bit RSA key.

      http://ftp.de.debian.org/debian/pool/main/o/openssh-blacklist/openssh-blacklist_0.4.1.tar.gz

      If the 2048 RSA key is one of these they probably will, get it, especially if they have a million chances.

    20. Re:fail2ban by X0563511 · · Score: 0, Flamebait

      You have obviously never looked at fail2ban beyond a quick scan of a summary. IPTABLES doesn't analyze logfiles, douchbag.

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
    21. Re:fail2ban by X0563511 · · Score: 2, Insightful

      Because stealing RSA/DSA SSH keys is so much more common than dictionary/brute attacks...

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
    22. Re:fail2ban by thsths · · Score: 1

      key-auth should be sufficient. The probability of guessing user name and the key is so absolutely remotely that 1 million login attempts do not get you any closer to it.

      If the attempts are a performance problem (log - sync), the easiest option is to change the port, and the next is to restrict access with fail2ban or whatever flavor you fancy. Any obscure scheme will do, including "ping first with a payload of YEAH before ssh", just do not mistake obscurity for security.

    23. Re:fail2ban by DeadboltX · · Score: 2, Interesting

      is there any advantage to fail2ban over denyhosts ?

    24. Re:fail2ban by Z00L00K · · Score: 1

      Also set up iptables to only allow for a certain frequency of connection attempts and then block the source address for further connections.

      You may of course bypass this in iptables for known addresses, so you will allow known users to log in and still have connections available if they are roaming, but when they are roaming they may get occasionally blocked by the frequency block.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    25. Re:fail2ban by agw · · Score: 1

      key-auth should be sufficient. The probability of guessing user name and the key is so absolutely remotely that 1 million login attempts do not get you any closer to it.

      Why do you think the user name would add any difficulty to this? User names are often very short and also easier to obtain by other means.

      So unless you have very secure boxes and different, long, random strings as a usernames for each of them, "guessing the username", will not be a problem.

    26. Re:fail2ban by turbidostato · · Score: 2, Interesting

      "Because stealing RSA/DSA SSH keys is so much more common than dictionary/brute attacks..."

      You seem to forget that if you are seeing those attack levels is because of user computers already rooted, so anything on the client's side it's already at the attacker disposal. What do you prefer? Seeing thousands of failed login attempts in your logs or not seeing anything because the attack succeded by taking control of the ssh keys on the client's machine?

    27. Re:fail2ban by billsf · · Score: 1

      Try sshguard if you must use port 22 for ssh.

    28. Re:fail2ban by billsf · · Score: 1

      http://www.sshguard.net/ is the URL. It got commented out by accident: Sorry.

    29. Re:fail2ban by buanzo · · Score: 1

      No, but you can always give those people an OpenVPN. By the way, the fail2ban team which I'm member of is open to ideas all the time!

      --
      Buanzo Consulting - 15 Years of GNU/Linux experience, for you.
    30. Re:fail2ban by segedunum · · Score: 1

      You need to gain some practical experience as to how key-based SSH access actually works. You obviously don't have any.

    31. Re:fail2ban by cynyr · · Score: 1

      fail2ban, key-auth

      +1

      --
      All of the above was encrypted with a Quad ROT-13 method. Unauthorized decryption is in violation of the DMCA.
    32. Re:fail2ban by TheCarp · · Score: 1

      Fail2ban is nice, I guess. I got bit by a fellow admin who set it up to never unban except by hand (it may have been a different program, but same concept)

      I would say... firewall ssh! Block any access to the port that doesn't come from a short list of "bastion" IPs. That, at least, removes failure logs from your production server IP. Of course the list should have more than one entry. (then use fail2ban on the bastions :))

      It also protects you from straight up vulnerabilities since, while your bastion host is still vulnerable, and could be used to jump to your real production server, it at least means that anyone getting to your prod server that way is actively doing it on purpose, which would constitute a problem thats out of scope for this particular problem.

      -Steve

      --
      "I opened my eyes, and everything went dark again"
    33. Re:fail2ban by krewemaynard · · Score: 1

      OSSEC is also a good option.

      --
      I saw it on Slashdot, it must be true!
    34. Re:fail2ban by phoenix321 · · Score: 1, Troll

      fail2ban firewalls off the port for a time you specify

      So I've essentially enabled anyone with a telnet client to DOS the hell out of my server - and taken out the first D of a DDOS. As TFA reported 1 million failed SSH login attempts, statistically speaking, the port will always be firewalled off, even if the blocking cool down is less than a minute.

    35. Re:fail2ban by Anonymous Coward · · Score: 0

      I second fail2ban. My buddy was having a similar problem (on a much smaller scale) he installed fail2ban and blocked tons of illegitimate login attempts from several different countries!

    36. Re:fail2ban by titten · · Score: 1

      Odds are the web server is protected by a firewall.

      If you only intend to serve web pages from this server, open port(s) 80 (and 443) on the firewall towards that host.
      To reach other services, VPN into the DMZ or another network that has access to your DMZ and initiate SSH from there.

      No SSH visible on the Internet, no SSH bot attacks.

    37. Re:fail2ban by phoenix321 · · Score: 1

      It's already in TFS: 1 million attempts over one year. Disregarding leap years and leap seconds and assuming a constant attack rate, we are looking at 1 attack for every 31.536 seconds.

      A setting a block time of as low as 30 seconds would mean DOS'ing yourself without really reducing the risk of a break in. Even 10 seconds could be a major hassle in this scenario.

      With 1 million attempts, you even run the risk of your attackers successfully completing portknocking schemes purely by chance. (Or preventing the completion of any portknocking sequences of your legitimate users simply because the next attack will be faster than the portknocking can complete)

      Banning attacking subnets is prone to knocking yourself out when people spoof the hell out of their packets. Portknocking could work, but with an attack storm underway, no one can login since the sequences are interrupted all the time.

      The only thing you can do is set up strong authentication, limits on the CPU load that sshd can cause and then just factor in the wasted clock cycles into the performance requirements of your machine.

      Make sure you get in all the time, make sure no one else can break in, make sure your server has enough resources fulfill its intended goals and then just let them hammer away on the SSH port.

    38. Re:fail2ban by phoenix321 · · Score: 2, Interesting

      The best authentication relies on two factors, what you have and what you know.

      A rooted client gives the attacker access to at least one part of that.

      A separate physical RSA token is probably the only thing to prevent that, since they work without being attached to the authenticating system and even full scale keylogging monitored by a squad of hackers in rotating shifts will not really suffice.

    39. Re:fail2ban by gmack · · Score: 2, Informative

      More accurately it blocks the attacker's IP at the firewall.

    40. Re:fail2ban by jon3k · · Score: 1

      We know the number of attempts not the number of attackers. If you assume even a modest 10 attempts per IP address that number expands to one new attacker every 5 minutes. And 100 attempts per attacker comes to nearly 1 attacker per hour.

      "Banning attacking subnets is prone to knocking yourself out when people spoof the hell out of their packets."

      Most ISPs in the world is performing some form of source based filtering at this point. It's exceptionally difficult to spoof source addresses on the current day Internet. It would be exceptionally difficult to constantly change addresses, even those available to to be routed by the attackers ISP, and from the attacks we're seeing these days, a non-issue. They're very unsophisticated brute force SSH attempts.

    41. Re:fail2ban by Anonymous Coward · · Score: 0

      IPTABLES doesn't analyze logfiles, douchbag.

      It's spelled "douchebag", moron.

    42. Re:fail2ban by dasmoo · · Score: 1

      My IP didn't show up in the country I'm in on that list.

    43. Re:fail2ban by segedunum · · Score: 1

      A rooted client gives the attacker access to at least one part of that.

      The chances of a rooted client, that can theoretically give an attacker access to a server somewhere but which they are far less likely to know about and can't attack directly, are infinitesimally smaller than an attacker getting direct access to a server somewhere that they do know about by password guessing and dictionary attacks.

      Given the context of the article this is bullshit. The theoratical arguments and weaknesses against SSH key access do not outweight the reasons for using it.

    44. Re:fail2ban by segedunum · · Score: 1

      No but they can steal if from your users' computers.

      How? How would they know what client machine to attack or steal and how would they know where it was? Additionally, would you say the chances of that are less or greater than a compromise being found via a normal dictionary attack that the article is actually talking about mitigating?

      It's one thing to have staff use keys when they are on your secure network but having users who are out on the web using keys when you can't control the security on their machines is only as secure as your dumbest client.

      Hmmmmm, and there was me thinking that users used these insecure things called 'passwords' all the time, many of which can actually be guessed without going anywhere near their client machines.

      For remote access one of the securest ways is using a security token. Every time user logs in they have to enter a different number.

      Possibly, but you're going to have to point out a way for the article submitter to be able to do that today and manage it without becoming a nightmare.

      All in all, I don't know where this thread is going to be honest. Given the alternative problems with passwords that the article submitter is presumably trying to mitigate then SSH keys are infinitely more preferable. Pointing out potential and theoretical weaknesses with them won't change that.

    45. Re:fail2ban by TClevenger · · Score: 1

      This. I still use fail2ban, but since I changed the port, I haven't had a single invalid auth attempt.

    46. Re:fail2ban by turbidostato · · Score: 1

      "You need to gain some practical experience as to how key-based SSH access actually works. You obviously don't have any."

      The point is that I *do* have practical experience on the issue. And as such I've seen attacks directed by the contents of .ssh/known_hosts (that's why the default has come lately to obfuscate its contents) and I know just too many users will use keypairs without password to protect them. Pair the two and, voila! access gained at first try.

    47. Re:fail2ban by aminorex · · Score: 1

      aye, and if you're truly paranoid, implement port knocking.

      --
      -I like my women like I like my tea: green-
    48. Re:fail2ban by merlynx · · Score: 1

      You can use tcpwrappers and have fail2ban add ip's to /etc/hosts.deny as well. I use it for dovecot too, and you can even use to block failed http-auth requests and create totally custom jail.conf files...basically, any logfile you want to set up the regex filter conditions for (like mod_sec, and bad-bots in apache). I was using the iptables mode for many of my filters, but now I use the iptables, it's a little easier to manage for me. It'll send you emails too with the ARIN whois output when it blocks an ip....

    49. Re:fail2ban by raju1kabir · · Score: 1

      Banning attacking subnets is prone to knocking yourself out when people spoof the hell out of their packets.

      Why would someone source-spoof on an SSH attack? It guarantees failure.

      --
      "Patriotism is your conviction that this country is superior to all other countries because you were born in it." -- GBS
    50. Re:fail2ban by raju1kabir · · Score: 1

      That site is really bad at calculating CIDR masks.

      --
      "Patriotism is your conviction that this country is superior to all other countries because you were born in it." -- GBS
    51. Re:fail2ban by mathew7 · · Score: 1

      I'm personally using:
      iptables with "-A INPUT -p tcp -m tcp --dport 22 -m hashlimit --hashlimit-upto 5/min --hashlimit-mode srcip --hashlimit-name sshd -j ACCEPT" and a default DROP rule.
      The only problem with this is that it does not make permanent blacklists and I don't know how much overhead the kernel does. However when I "made" this line, I was getting around 5 attempts per second from one IP.

      PS: I have a rule which accepts RELATED and ESTABLISHED packets, so the line above applies to new packets only.

    52. Re:fail2ban by Anonymous Coward · · Score: 0

      DoS protection software:

      http://protobalance.com/

      load balancers do exactly this - you can limit the number of connection attempts per second

      -paul

    53. Re:fail2ban by Anonymous Coward · · Score: 0

      DenyHosts can easily be used to cover all services.
      My denyhosts file is /etc/hosts.deniedssh

      It is however called from this line in /etc/hosts.allow (FreeBSD)
      ALL : /etc/hosts.deniedssh : severity auth.info : deny

      The denyhosts file is populated from /var/log/auth.log thus any service that properly logs authentication requests will be included.

  2. Ignore it? by Anonymous Coward · · Score: 1, Informative

    If you have a public site, it'll get scanned night and day by APNIC. If they see a banner for SSH, they'll jump on that. As long as you are using patched software and have good user security, what's the real emergency?

    1. Re:Ignore it? by MichaelSmith · · Score: 1

      Yeah this is just normal for me. I have a script which hooks into syslog and blocks offending hosts in pf but frankly I don't think it is worth the risk of doing that. Make sure sshd has a secure configuration and don't worry about the brute forcing.

    2. Re:Ignore it? by tomhudson · · Score: 4, Insightful
      There's no "brute forcing" going on. Look at the numbers.

      1 million per year over 50 sites == 20,000 per year per site, or 54 per day per site. Change the passwords every few months (and use different ones for each site).

      Further - 1,200 different remote hosts means what, 17 attempts per remote host per site per year. Probably randomly p0wned PCs that hit addresses at random, make a few attempts using default or ocmmon passwords, then move on.

    3. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Change the passwords every few months (and use different ones for each site).

      Using different passwords for each site I get, but what is the reasoning behind changing passwords every few months? If you have a good password, it won't be guessed or brute-forced. If you have a weak password, changing it to another weak password monthly won't do a thing.

      I'm really curious about this, because it is such a common recommendation. My bank even say that they only guarantee fraud losses on internet transfers if you changed your password within the last month - but they also recommend a 'system' for your password, which is to add the month number (1 to 12) to the end of your normal password! There is no way that can increase security, and several demonstrable ways it decreases security.

    4. Re:Ignore it? by tomhudson · · Score: 1

      Two reasons:

      1. A weak password can eventually be cracked by a slow, dispersed dictionary attack;
      2. This way, you don't have to worry about someone you gave the password to a year ago, or who otherwise found out about it (post-it, etc.) and now decides to do something about it because you p*ssed them off;

      Also, you're right - a "system' for your password will definitely decrease security, no question about it, since any system is by definition non-random.

    5. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      A weak password can eventually be cracked by a slow, dispersed dictionary attack;

      But changing it to another weak password has essentially no effect on the effectiveness of a dictionary attack. There is a certain probability of the attacker guessing it each attempt, and that probability doesn't change no matter how often you change your password. It doesn't matter whether the attacker is attempting passwords sequentially or randomly, the statistics works out the same.

      This way, you don't have to worry about someone you gave the password to a year ago, or who otherwise found out about it (post-it, etc.) and now decides to do something about it because you p*ssed them off;

      This I can kinda get, if you are a person who frequently gives out their passwords. I don't think I've ever done that, for any non-throwaway password. I'd temporarily change my password, and change it back again later.

      I also fail to see how anyone can maintain even a single password that they change every month, without some kind of system. Especially if it is a strong password, that takes some time&effort to remember.

    6. Re:Ignore it? by bingoUV · · Score: 1

      But changing it to another weak password has essentially no effect on the effectiveness of a dictionary attack. There is a certain probability of the attacker guessing it each attempt, and that probability doesn't change no matter how often you change your password

      Effectiveness of a dictionary attack = (probability of the attacker guessing it each attempt) * (number of attempts)

      So the statistics don't work out the same. You missed the (number of attempts) part.

      --
      Bingo Dictionary - Pragmatist, n. A myopic idealist.
    7. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Effectiveness of a dictionary attack = (probability of the attacker guessing it each attempt) * (number of attempts)

      That is, the number of attack attempts. It has nothing to do with the frequency of changing the target password.

      So the statistics don't work out the same. You missed the (number of attempts) part.

      I don't think I missed anything, read my sentence again: There is a certain probability of the attacker guessing it each attempt...

      Let me try again, with an actual example. Suppose, for simplicity, that my password is a single digit, 0 - 9. Now, if the attacker is trying to guess my password, then he has a 1/10 chance of guessing my password at each attempt. This probability is the same, no matter what sequence the attacker chooses (random or sequential, doesn't matter what sequence). It is also exactly the same probability no matter how often I change my password. A probability of 1/10 per attack means that on average it will take 5 attempts for the attacker to guess my password. Changing my password has no effect on the time taken to crack it.

      If you are not convinced of this, try it with some dice. You will find that the probability of getting a specific fixed outcome (eg, '3') is 1 in 6. You will also find that if you change your password every time (say, by rolling a second dice and using that as your new password), the probability of the attacker guessing your new password (ie, roll two dice and calculate the probability getting a double) is again 1 in 6.

    8. Re:Ignore it? by bingoUV · · Score: 1

      In my last post, I quoted your statement which demonstrated that you falsely think "Effectiveness of a dictionary attack" is the same as "probability of the attacker guessing it each attempt". This post of yours confirms that you still think so after my explanation, so obviously I need to give detailed explanation. Thankfully the examples you give also amply demonstrate your fallacy.

      Note that I am assuming a somewhat intelligent attacker, and not an absolutely naive one.

      A probability of 1/10 per attack means that on average it will take 5 attempts for the attacker to guess my password

      Absolutely wrong premises. Probability is not 1/10 per attack. It is 1/10 for the first attack, 1/9 for the second, 1/8 for the third and so on. If he chooses sequential pattern, and goes from 0-9: After the 1st failed attack, the attacker "knows" that 0 is not the password.

      Now, he can try the same password again, but he will do so only if there are significant chances of your changing the password between his 2 attempts. Typically this is false, and your argument makes it impossible because you suggest never changing the password. So my above paragraph is mostly true, and absolutely true in your case.

      Changing my password has no effect on the time taken to crack it.

      It most certainly does have an effect. There are 2 options for the attacker:
      1. From the start of his attack to its end, he can assume that password does not change. In this case, there are chances that he has already tried a password and then you have changed it. So it is possible that he has exhausted the set of possible passwords, and yet not cracked the password successfully.
      2. He can assume the password can change any time. This makes him retry the same passwords over and over again. Not sure what heuristic will serve him best here, but it is certain that this one takes more time, effort and energy of the attacker. He will make such an assumption only if he has seen sysadmins to change passwords frequently in his cracking "career". Sysadmins/sysadmin advisors like you will make life easy for crackers.

      Specifically, there are chances that a password changer sysadmin will change his password to something an attacker has already tried. And by the time the attacker retries this new password, it has become an old password.

      If you are not convinced of this, try it with some dice

      By now, I hope you have understood that this example/analogy is wrong. There is no restriction on dice to not show same number twice. But there can only be one password at a time. That you gave this example, again shows your fallacy: "each attack is independent of previous attacks". Hope I have debunked it in the above section.

      --
      Bingo Dictionary - Pragmatist, n. A myopic idealist.
    9. Re:Ignore it? by DavidTC · · Score: 1

      Erm, except you're assuming that this 'an attacker', which is a little silly.

      These are not distributed attacks, these are just a bunch of idiotic bots that connect and try stupid shit like 'passw0rd'.

      If you think otherwise, try logging the bad passwords some day. It's not some person slowly working their way through a dictionary, it's bots testing the 1000 most common passwords and usernames. As long as you don't have one of those, you're good.

      Hell, something like a 1/100th of the attempts are blank passwords. I have no idea how the hell you even have a blank ssh password. (I actually think that's some router thing.)

      You can stop 95% of the crap just by moving ssh to another port. They're very stupid bots.

      --
      If corporations are people, aren't stockholders guilty of slavery?
    10. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Absolutely wrong premises. Probability is not 1/10 per attack. It is 1/10 for the first attack, 1/9 for the second, 1/8 for the third and so on. If he chooses sequential pattern, and goes from 0-9: After the 1st failed attack, the attacker "knows" that 0 is not the password.

      That is true, but it has no substantial effect. It changes the shape of the distribution, but it doesn't have a dramatic effect on the number of attacks required, at most a factor 2. Actually I was wrong before when I suggested that the average would be unchanged, I didn't think about it enough beforehand; the correct result is that changing the password at a sufficiently fast rate gives a factor 2 improvement in the time required for an attacker to guess it. But that isn't significant.

      If you want to try this at home, pick a random number from 0-9, to simulate the password, and then start a dictionary attack in sequence (it doesn't matter which sequence, and it doesn't matter where you start from) and see how many attempts you need to get the password. You should find that you need an average of 5 attempts. Now try changing the password randomly each time, and you should see that it takes an average of 10 attempts.

      1. From the start of his attack to its end, he can assume that password does not change. In this case, there are chances that he has already tried a password and then you have changed it. So it is possible that he has exhausted the set of possible passwords, and yet not cracked the password successfully.

      Yes, this is true. That is what leads to the factor 2 saving in time.

      2. He can assume the password can change any time. This makes him retry the same passwords over and over again. Not sure what heuristic will serve him best here, but it is certain that this one takes more time, effort and energy of the attacker.

      Also true, but the extra time is only a factor 2. I think that is pretty much irrelevant.

      Just for kicks, and because I can't be bothered sitting down with a pen & paper, I tried a numerical experiment. Password from 0-1024, and I calculated the average number of times it takes to guess the password using a dictionary attack; once the complete sequence of passwords have been tried, go back to the start of the dictionary and repeat. Now vary how often a new password is generated, once every N attacks, for N=1,2,4,8,...,1024. One million repetitions of each test. The results are:

      N Average number of attacks to guess password
      1 1023.43
      2 1022.33
      4 1021.78
      8 1019.33
      32 1007.93
      64 992.064
      128 959.957
      256 895.785
      512 768.717
      1024 512.309

      So you can see that as password is changed more frequently, the number of attempts changes from (keyspace/2) for no password changes, to (keyspace) if the password is changed frequently. I'm not convinced this is worthwhile - if an attacker is going to brute-force my keys then making it a factor 2 harder is negligible. If I wanted to make my password stronger I'd do much better by not bothering to change my password and instead adding one more character to it.

    11. Re:Ignore it? by bingoUV · · Score: 1

      You are absolutely right. Except

      Erm, except you're assuming that this 'an attacker', which is a little silly.

      I didn't make any such assumption (did I give such an impression? I didn't mean to). I was only replying to the parent post, which made a general statement about non-necessity of changing a password ever.

      --
      Bingo Dictionary - Pragmatist, n. A myopic idealist.
    12. Re:Ignore it? by bingoUV · · Score: 1

      Actually I was wrong before when I suggested that the average would be unchanged

      Yeah, my main point was that. So I am almost done. I see a lot of such comments from geeks about "idiotic" policies of banks etc. to get passwords of their customers changed. I just wanted to debunk them.

      So you can see that as password is changed more frequently, the number of attempts changes from (keyspace/2) for no password changes, to (keyspace) if the password is changed frequently

      You are using "number of attempts" as a metric for the difficulty level of password cracking. Since by this metric, difficulty for the cracker is only twice, you say difficulty is only twice. But this is not the only metric for measuring the difficulty. Another metric too makes practical sense:

      Once upon a time, there was a sysadmin A. He didn't change his password for 20 years. Maximum number of password crack attempts per unit time(Max attempt flux): (keyspace/20years).

      There was another contemporary sysadmin B. He changed his password every month. Maximum number of password crack attempts per unit time (Max attempt flux): (keyspace/1month).

      Max attempt flux is 240 times for sysadmin B as compared to sysadmin A. Using this metric, one could say periodically changing the password is 240 times more secure. But even then, one would be wrong because that is just a(nother) metric. In essence, security cannot be measured though one can come-up with metrics that approximate that.

      Now, you ask, why "attempt flux" as a metric? This has practical uses. Using this attempt flux, network policies can be arrived at which take drastic measures when observed attempt flux reaches a significant fraction of max attempt flux. Too restrictive network policies, and the system is a pain to work with: think red-tape for sysadmins to get their passwords reset, accounts unblocked, IP's unblocked etc. Too permissive, and one doesn't even know that his network is being systematically "worked" upon.

      For the above policy, max attempt flux can be used as an input. Though, average attempt flux can also be used, depends upon the paranoia rampant in the system. As you say, this (average attempt flux) would be twice for the sysadmin that changes his password than the one who doesn't.

      Additionally, by keeping changing the password, one prevents long-running situations when someone has acquired (by cracking, maybe got lucky, key-logger, maybe tortured an employee, maybe used an ex-employee, lot depends on company policies) the password and he doesn't want to lock out other administrators but just silently carry on his activities and systematically delete his traces.

      Also, there was another sysadmin C: who never changed the password. Asymptotically, he will be cracked.

      At any rate, it is best not to propagate the myth that changing passwords doesn't help at all. To buy the (maybe little) extra amount of security, a sysadmin can use a random password generator every (1/2/3 months, or whatever) and memorize it, and it will not kill him but rather justify his salary.

      --
      Bingo Dictionary - Pragmatist, n. A myopic idealist.
    13. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Max attempt flux is 240 times for sysadmin B as compared to sysadmin A. Using this metric, one could say periodically changing the password is 240 times more secure.

      That is nuts. Didn't I just demonstrate that the maximum increase in safety from changing your password frequently is a factor 2? That is, even if there is a determined, systematic attacker doing a dictionary attack, then he will, on average, crack sysadmin B's password in half the time it takes to crack sysadmin A's password. Your 'attempt flux metric' is voodoo. You might as well base your IT security policy on the 'metric' of how often each sysadmin eats sushi.

      Note that to get the full factor 2 security from changing the password, you need to change it very rapidly in comparison to the time it takes the attacker to scan the keyspace. If an attacker decides to target you and puts in enough resources to scan the keyspace in one week, then the fact that you change your password every month is irrelevant. Even if it takes the attacker a month to scan the keyspace, changing your password once in that time only gives a factor 1.5 improvement in the time it takes him to crack you. If it takes the attacker a year or so to scan the keyspace, then changing your password every month gives close to the full factor 2. Big fat hairy deal.

      And all this assumes that the attacker is systematic and remembers which passwords he's already tried. If I was going to try a brute force attack, I wouldn't even bother with that, I'd just select trial passwords randomly from the dictionary. It is only going to slow me down by at most a factor 2, compared with the best I could do if the target never changes his password. But now my cracking program doesn't need to keep any state information and it's much easier to run in parallel.

      Additionally, by keeping changing the password, one prevents long-running situations when someone has acquired (by cracking, maybe got lucky, key-logger, maybe tortured an employee, maybe used an ex-employee, lot depends on company policies) the password and he doesn't want to lock out other administrators but just silently carry on his activities and systematically delete his traces.

      Ahh, I was wondering when this excuse would show up. If your computer gets pwned, then you are nuts if you think that changing your password will suddenly make your computer un-pwned. Anyone who has enough know-how to systematically delete his traces will also have enough know-how to put in a difficult-to-detect back door.

      The case of an ex-employee sniffing around but not actually damaging anything is maybe, ... maybe ..., one case where changing passwords might be useful. But this isn't really about cracking, it is about password management. If the IT policies are sensible, then the ex-employee's login will be locked out anyway. If someone else gave away a password, then yeah they should change it. So yeah if you are the kind of person that gives away your passwords, then I can see that there is an argument that you should change them frequently. But that has nothing to do with protecting against dictionary attacks.

    14. Re:Ignore it? by micheas · · Score: 1

      Two reasons:

      1. A weak password can eventually be cracked by a slow, dispersed dictionary attack;
      2. This way, you don't have to worry about someone you gave the password to a year ago, or who otherwise found out about it (post-it, etc.) and now decides to do something about it because you p*ssed them off;

      Also, you're right - a "system' for your password will definitely decrease security, no question about it, since any system is by definition non-random.

      Correct advice wrong reasoning. The reason to expire passwords and passkeys, is that by sampling encrypted content, the key can eventually be brute forced off line.

      You can be reasonably certain this will take months/years. The higher the value of the payload, the more frequently you need to change your keys,

      The other issue is that when a crypto key fails, if the data is of high value, you really want to have already changed the key, so that recently encrypted data is not compromised.

      If you change your key annually, you have one years data compromised if the key fails, if you change the key weekly, you have one weeks data exposed if the key fails.

      The general rule of thumb is never set keys for longer than ten years no matter how minimally valuable the payload.

      If you are not doing e-commerce, you can probably get away with changing your keys and passwords with your major OS upgrades. If you are doing e-commerce and storing credit card information you need someone to carefully plan out your data retention and security of that data.

      Overall, it is a good practice, but unlikely to be the reason a system gets owned, unless it is a high value target. (by high value I mean worth throwing a few million in resources to break in, be aware, that there are a handful of college students that are paid to administer many millions of dollars of idle computer resources, so the bar for being a victim is lower than you might guess).

      Enough for my late night ramblings.

    15. Re:Ignore it? by Anne+Thwacks · · Score: 1
      You might as well base your IT security policy on the 'metric' of how often each sysadmin eats sushi.

      Great Idea ... I shall order my staff to implement this tomorrow. Its far better than the policy I got from Dilbert last year!

      --
      Sent from my ASR33 using ASCII
    16. Re:Ignore it? by houghi · · Score: 1

      Change the passwords every few months (and use different ones for each site).

      Perhaps you can remember 50 secure passwords that change every few months, but unfortunately most can't. It will mean writing them down somewhere.

      --
      Don't fight for your country, if your country does not fight for you.
    17. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Also, there was another sysadmin C: who never changed the password. Asymptotically, he will be cracked.

      If his password is good, then he will get cracked after, on average, a number of attempts equal to half the size of the keyspace.

      With an 8-character (upper/lower/digit/special 72 possibilities per character) password, that gives an average of 361,102,068,154,368 attempts from the systematic attacker, trying all passwords in sequence.

      Versus sysadmin B who changes his password once a month, and will be cracked after an average of 722,204,136,308,736 attempts (assuming it takes the attacker much longer than 1 month to scan the keyspace, so that sysadmin B's password changes many times during the attack window).

      Do you think that difference is important? I definitely do not.

    18. Re:Ignore it? by agw · · Score: 1

      Also, you're right - a "system' for your password will definitely decrease security, no question about it, since any system is by definition non-random.

      The most hilarious "system" I've ever seen was this one (about 10 years ago): root password is the servers hostname plus a random number.
      Worked especially well if you happened to choose servers names with 8 characters or more.

      (I guess nowadays Unix/Linux systems often use more than 8 characters for the password. Check your /etc/shadow for MD5 and alike hashes.)

    19. Re:Ignore it? by Anonymous Coward · · Score: 0

      The idea is that if it takes an average of few years for a password to be cracked, the "counter" resets every time you change it, thus if you change your password more often than that you won't get hacked.

      Mathematically it doesn't make any sense, but that's the way normal people (phb's etc) think.

    20. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Mathematically it doesn't make any sense, but that's the way normal people (phb's etc) think.

      Right, that is what I suspected. But it doesn't make any sense so why should I do it? I am still enough of an optimist that I prefer to have rules based on sound technical arguments, not vague and incorrect 'gut feelings' etc. I'd like to think that comething like a bank would have a better grasp of security.

    21. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      The reason to expire passwords and passkeys, is that by sampling encrypted content, the key can eventually be brute forced off line. You can be reasonably certain this will take months/years. The higher the value of the payload, the more frequently you need to change your keys,

      Ahh, finally some sensible reasoning! Ok, so the argument is that if someone sniffs enough encrypted packets then they can brute-force the key, and that is a pure computation problem that doesn't require any interaction with other systems that might be able to detect it. That is a good point, and that is why SSH2 has a key regeneration protocol, to automatically rekey long-lived SSH sessions.

      How does this argument apply to passwords? If someone manages to obtain an encrypted password file for my bank's internet banking credentials, then they can brute-force the plaintext passwords, offline. But is that really a threat that an end-user needs to protect against? The security of the password file is a problem for the bank, not me. Anyway, I'd be worried that if an attacker has enough resources to make brute-forcing my password practical at all, then they have an unacceptably high risk of being able to do it within the one month window before my password changes again. For example, if its going to take them a year to scan the entire keyspace, then within one month they have a 1/12 chance of cracking my account, which is already bad. I think the bank ought to be able to have enough security around their password databases to make this kind of attack difficult, or at least detectable, so they can warn their customers and lock out accounts as necessary.

      By making me change my password once a month, the bank gets some questionable improvement in their own security, in case someone hacks their internal systems and obtains their password files. But that is their problem - as an end user, changing my password is a relatively risky procedure, eg I have to type it in twice, which gives twice the opportunity for someone to peek over my shoulder. If I need to change my password every month then in practice it is either going to be a very weak password that I can remember easily, or I'm going to have to write it down somewhere. For every method I can think of in which someone gets my password because of something I've done wrong, a system where I change my password every month (1) doesn't help in this situation at all, and (2) only serves to give more opportunities for someone to get my password, since I need to type it in more times, and (3) if my password is simpler as a result of having to change it frequently then this just gets easier.

      In other words, it seems to be about the bank making policies that give a minor improvement in their own internal security, at the expense of inconveniencing and reducing the security of their customers.

    22. Re:Ignore it? by mugurel · · Score: 1

      Now look at it this way:

      Assume a password of finite size and finite alphabet, which fixes the size of the keyspace to N, and random guesses at the password (selecting passwords from the keyspace). When guessing 'without replacement' (i.e. you don't try the same guess twice), after N guesses the probability of having guessed the password is 1.

      If instead the password would be changed after each guess, you don't gain any information about the password (by ruling out an increasing number of possibilities through guessing), and as a result your chances of guessing the password stay at 1/N all the time.

      When we take as a metric for systrem security the probability of guessing the password *in the limit*, the increase in security of changing passwords would be a factor 1/(1/N) = N, which for any realistically sized keyspace is a lot more than 2.

    23. Re:Ignore it? by micheas · · Score: 1

      In other words, it seems to be about the bank making policies that give a minor improvement in their own internal security, at the expense of inconveniencing and reducing the security of their customers.

      IIRC - The password aging was part of IBM's recommendations for implementing DES. This is a proven best practice for perfect systems. This advice on changing passwords monthly is based on the assumption that the ends are secure, for example mainframe to mainframe communications.

      Reality is that for well under a million dollars you can probably get a keylogger on the client system which is probably running a vulnerable version of Adobe Flash.

      I suspect that banks that make you change your password monthly are just making sure that everyone has the same password policy instead of figuring out who does and does not need to change their password and maybe getting it wrong. It also has a chance of limiting losses if they are making sure that you are not using any of the last three passwords you used. Password aging is based on the idea that you will have a security breach and you need to proactively limit your losses.

    24. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Assume a password of finite size and finite alphabet, which fixes the size of the keyspace to N, and random guesses at the password (selecting passwords from the keyspace). When guessing 'without replacement' (i.e. you don't try the same guess twice), after N guesses the probability of having guessed the password is 1.

      Yes. Or, equivalently, the average number of guesses required is N/2; half time time it will take more than N/2 (and possibly up to N tries), half the time it will take less than N/2.

      If instead the password would be changed after each guess, you don't gain any information about the password (by ruling out an increasing number of possibilities through guessing), and as a result your chances of guessing the password stay at 1/N all the time.

      Right. Probability of guessing the password is 1/N each time, independently of how many times you have guessed in the past.

      That means that after P attempts, the probability that at least one of those attempts guessed the right password is

      1/N (probability of guessing it correctly at first attempt)
      + (1-1/N) * 1/N (probability of guessing it wrong at the first attempt, and right at the second attempt)
      + (1-1/N)^2 * 1/N (probability of guessing it wrong at the first 2 attempts, and right at the 3rd attempt)
      + ...

      =

      1 - (1-1/N)^P

      To get the password with probability strictly equal 1, you need to take P to infinity. But that is a silly limit. If you are satisfied with a probability of to crack the password of (1-x), for some small x, then you need N*ln(1/x) attempts. For example, to have a 90% probability of cracking the password, you need around 2.3*N attempts. This compares with 0.9*N attempts to get 90% chance to crack the password in the case where it isn't changing. This gives a safety factor of 2.56, which isn't much! [*]

      When we take as a metric for systrem security the probability of guessing the password *in the limit*, the increase in security of changing passwords would be a factor 1/(1/N) = N, which for any realistically sized keyspace is a lot more than 2.

      No, you've fallen for the fallacy that changing the key significantly increases the difficulty of cracking it. There is a simple conceptual argument as to why that cannot be true: random guesses have a probability 1/N of guessing the key by pure chance. So if you try N guesses then you must have a probability `close' to 1. It doesn't matter whether the key is changing or not, the probability is still 1/N per guess.

      I think I'm finally realizing why some places have these stupid rules: even a moderately technical crowd on slashdot don't understand simple probability arguments so what hope does a PHB have?

      [*] This is measuring the probability of cracking the password after P attempts, which isn't the same thing as the previous calculation, which was looking at the average number of attempts to crack the password. The distribution isn't symmetric, so the average number of attempts required isn't the same as the number of attempts required to have a 50% chance of finding the password. The average number of attempts to crack a frequently changing password is only twice the number of attempts needed to crack a fixed password, even though ensuring a very high probability of cracking a frequently changing password takes many attempts. This is because most of the time, it will only take around N attempts to guess the password, but because it is always changing, there is a small probability that it takes much more than N attempts. The probability that you fail to get the password becomes vanishingly small as have more attempts. For example, if you try 10*N times, the probability of guessing the password is 99.995%.

    25. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      IIRC - The password aging was part of IBM's recommendations for implementing DES. This is a proven best practice for perfect systems. This advice on changing passwords monthly is based on the assumption that the ends are secure, for example mainframe to mainframe communications.

      Weren't session keys invented to overcome this problem?

    26. Re:Ignore it? by tomhudson · · Score: 1
      Say they get your password. So they start making their plans.

      A week later, they're locked out again, and have to start over.

      Plus, there's this really great tool for maintaining your password list - it's called "keep the ONLY hard copy in your wallet or purse - and NEVER let it out of your sight." You're already used to doing that in terms of your wallet or purse, so it doesn't add anything new that you have to adapt to - and it's not like you have to keep THAT in plain-text.

      If you can remember the password, it's too weak.

    27. Re:Ignore it? by tomhudson · · Score: 1

      And what's wrong with writing them down and keeping them on you all the time? You know, like what you do with your folding money?

      You're a lot less likely to lose your wallet or purse than your cell phone or a usb key with all the keys stored in it.

    28. Re:Ignore it? by tomhudson · · Score: 1

      You forget something - getting the password for a user account is only step 1.

      So you now check into that account every day to see what comes up - and "damn - the passwords been changed!"

      End result - unless it's a really interesting account, or you were able to exploit other flaws to escalate privileges and create a back-door account, you go elsewhere.

    29. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      A week later, they're locked out again, and have to start over.

      So you advocate changing passwords weekly? For the reason that if your system gets pwned, then after a week when you change your password, your system will magically become un-pwned? Sorry, I'm not convinced.

      The way I do it, is that all of my passwords are in text files, stored on the most secure system I have access to. That only allows public key logins from known hosts (or other hosts, via an extra challenge-response step) to one front-end host. The passwords themselves are all random, usually longest supported length. I rarely type them, 99.9% of the time I 'cat' the relevant text file, double-click select the password and middle-click paste it into the password box.

      I think, in this setup, encrypting the password text files wouldn't add much security. The login procedure is more secure than any password I could actually remember, and if I kept a hard copy of a longer key in my wallet I'd almost certainly lose it sooner or later.

    30. Re:Ignore it? by bingoUV · · Score: 1

      Didn't I just demonstrate that the maximum increase in safety from changing your password frequently is a factor 2?

      If you think you can measure "safety" like that, you have a lot of studying to do to be able to credibly argue anything on this subject. I do not feel up to explaining it in a slashdot post, as it will go somewhat into metrics and philosophy of science; I'll just leave this subject there.

      Quote from my post:

      Maximum number of password crack attempts per unit time (Max attempt flux)

      Hope you can at least read bold. For maximum number of password crack attempts, one would have to exhaust the keyspace. The number 240 comes from there. What you are talking about, is average. Anything I can do to make you understand the difference between maximum and average?

      And all this assumes that the attacker is systematic and remembers which passwords he's already tried. If I was going to try a brute force attack, I wouldn't even bother with that, I'd just select trial passwords randomly from the dictionary

      There is one less cracker for sysadmins to worry about, then. Thank FSM that you exist. Hope your progeny fill the cracker world.

      Big fat hairy deal.

      A few posts ago, there was no difference at all. Since you were too uneducated to understand the difference, so that I had to explain it twice; it became too big fat hairy deal. Awesome.

      --
      Bingo Dictionary - Pragmatist, n. A myopic idealist.
    31. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Wow, this is getting to be pretty abusive. Lets try and keep the flames down a bit.

      Hope you can at least read bold. For maximum number of password crack attempts, one would have to exhaust the keyspace. The number 240 comes from there.

      No, that isn't correct. If the password is frequently changing, then strictly speaking there isn't a maximum. There is a small probability that takes a very large number of attempts to guess the password. That probability is vanishingly small, for even a moderate number of attempts. For example, I went through the math here, which shows that if you make a number of attempts of 10 times the size of the keyspace, then (for a large keyspace) the probability of guessing the key is 99.995%. But to get the probability to be exactly 1, requires an infinite number of attempts.

      Lets go through and calculate the probabilities explicitly. Lets assume that the attacker tries all passwords in order, only repeating passwords after exhausting the keyspace. Firstly, lets consider the case where the target password is fixed. As you previously explained, the probability of guessing the password on the P^th try (after P-1 unsuccessful tries) is 1/(N-P+1). Now, in general, the probability of guessing the password in exactlyP tries is (1-probability_of_guessing_password_in_P-1_tries) * probability_of_guessing_password_on_Pth_try. The probability of guessing the password in any of the previous tries is (N-P+1)/N, which gives a total probability of min(1,P/N). This is as we expect, since if we exhaust the keyspace by trying all N guesses, then the probability of getting the key is 1.

      The second case, for a randomly changing password, is covered here. Putting this together, for an example where the keyspace is size 1,000,000, we get, for the probability of cracking a fixed key and a randomly-changing key, after P attempts:

      P FixedKey RandomKey
      1 0.0001% 0.0001%
      2 0.0002% 0.0001999999%
      10 0.001% 0.0009999955%
      20 0.002% 0.0019999810%
      100 0.01% 0.0099995050%
      200 0.02% 0.0199980101%
      1000 0.1% 0.0999500666%
      2000 0.2% 0.1998002331%
      10000 1% 0.9950171201%
      20000 2% 1.9801336495%
      100000 10% 9.5162627206%
      200000 20% 18.126932880%
      500000 50% 39.346949192%
      1000000 100% 63.212074277%
      2000000 100% 86.466485210%
      5000000 100% 99.326206985%
      10000000 100% 99.995460030%

      Yes, there is a difference. No, I don't think that difference is significant. If the attacker has enough resources to have a chance at cracking a fixed password, then he's still got a good chance at attacking a randomly changing password with the same effort. If the attacker exhausts the keyspace then he's got 100% chance of finding my fixed key, but his probability of finding your randomly changing key is still 63%, which is still very good odds for the attacker.

    32. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Let me frame it in a slightly different way. I guess you have some kind of lotto game in your country? Imagine that the lotto results represent the randomly changing password, and you are an 'attacker', trying to guess the password (lotto results). Suppose, for the sake of argument, that the chances of wining a game of lotto are one in a million, for a single entry in one game. Can you answer:

      • What is the maximum number of lotto games you need to play in order to guarantee that you will win?
      • On average, how many games of lotto do you need to play to increase your chances of winning from one in a million up to something substantial, say 50% ? 90% ?
      • How do your answers to the above questions change, if instead of buying a single ticket in each of N different lotto draws, you instead enter N times in one single draw?
      • Finally, is there any difference between how the probabilities work in this lotto example, versus the cracker attacking passwords? If so, what are the differences?
    33. Re:Ignore it? by smash · · Score: 1

      Passwords "leak" via social engineering. If you change them, the compromised password may no longer be usable, if it has only been used by the third party in a low-impact, covert manner. Having a system like the bank mentions isn't necessarily a good idea, but social engineering is a real problem. Just ask Kevin Mitnick.

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    34. Re:Ignore it? by smash · · Score: 1

      That may be the case today, but relying on botnets to be stupid for the rest of your career isn't such as smart idea. there's nothing to stop them trying distributed brute force, other than laziness or effort/return on the part of the botnet operator.

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    35. Re:Ignore it? by smash · · Score: 1

      This gives a safety factor of 2.56, which isn't much!

      On the contrary, one could say it is over 2x as difficult to crack.

      Whether or not that is worth the effort expended is left to the individual. no its not a silver bullet, but people bet on stuff like flipping coins every day...

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    36. Re:Ignore it? by tomhudson · · Score: 1

      and if I kept a hard copy of a longer key in my wallet I'd almost certainly lose it sooner or later.

      In that case, you need a purse (or a man-bag).

      Even if someone at the local restaurant WERE to steal you wallet with a list of servers and passwords, they lack the other necessary ingredient - the account login names.

      Change the passwords every 3 months, and write them down, along with one extra letter, along with the servers, and a "honeypot" login name with the longer password. Anyone logging into the bogus account, set their .rc file to send you an email notification to change all the passwords on all your sh*t. Then trace their IP back to where they are so you can hack into their box, find their personal info, and reclaim your wallet.

    37. Re:Ignore it? by smash · · Score: 1

      If I told you that you had a 100% chance of being killed in an accident in vehicle A, but only a 63% chance of being killed if you were in the same accident vehicle B, which one would you take to work?

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
    38. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      On the contrary, one could say it is over 2x as difficult to crack.

      That is a rather dangerous attitude I think. Lets put it a slightly different way. Suppose that you know that there are attackers out there capable of brute-forcing a 120-bit key. Would you therefore be content with a 121-bit key? After all, it is 2x as difficult to crack.

      If I wanted to get a 2x increase in safety, then adding one more bit to my password is much easier than switching to a regime where I change my password every month. But crypto security doesn't work that way. To be really safe, you'd better have a password that a really hard to brute-force, like 1000, or 10000 or more times difficult than the capabilities of the best resourced bad guy you can imagine. And if you have this, factors of 2 don't matter. Actually, I think probably even if you have a very weak password, an extra factor 2 doesn't mean much.

    39. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      If I told you that you had a 100% chance of being killed in an accident in vehicle A, but only a 63% chance of being killed if you were in the same accident vehicle B, which one would you take to work?

      Neither, I'd walk or catch a bus.

      Seriously, I'm really thinking of the cost required to brute-force a password to a dedicated attacker out to get you. To get the 100% probability from exhausting the key-space, you need a serious attacker anyway, because he needs to keep track of his failed attempts so that he doesn't repeat any passwords. If its a serious attacker, then it is unlikely he'll give up at just the moment where the difference between random passwords and fixed passwords is significant. All he has to do is wait for 2x, or, if he really needs to, 5x longer (or use more parallel attempts) and he's got the probability of getting you up to 86% (or 6 in 7 chance), or 99%.

      If you really need a bit more security, then you are much better off adding a couple of characters onto your password. That is going to give you about 5000x improvement. Which would you prefer, a 63% chance of being killed, or a 0.02% chance?

    40. Re:Ignore it? by bingoUV · · Score: 1

      No, that isn't correct. If the password is frequently changing, then strictly speaking there isn't a maximum

      I had to quote my own post earlier to remind you the context where the number 240 came from. This does not mean you cannot go and read my earlier post to get the full context. So I have to quote myself once more, with more context this time:

      Once upon a time, there was a sysadmin A. He didn't change his password for 20 years. Maximum number of password crack attempts per unit time(Max attempt flux): (keyspace/20years).

      See? During this period, he did not change the password because you recommended not to. So, there IS a maximum. So your statement(quoting again below as you keep losing track) is wrong:

      No, that isn't correct. If the password is frequently changing, then strictly speaking there isn't a maximum

      Frankly, this is getting tiresome. Hope you understand my feelings. I am not reading any further of this post of yours because I get the scary feeling that rest of your post is based on the wrong premises that I just mentioned above. Correct me if this feeling is wrong.

      --
      Bingo Dictionary - Pragmatist, n. A myopic idealist.
    41. Re:Ignore it? by jon3k · · Score: 1

      "I also fail to see how anyone can maintain even a single password that they change every month, without some kind of system. Especially if it is a strong password, that takes some time&effort to remember."

      http://www.keepassx.org/

    42. Re:Ignore it? by jon3k · · Score: 1

      Excellent analogy I'm stealing this next time I try to explain this exact scenario.

    43. Re:Ignore it? by micheas · · Score: 1

      IIRC - The password aging was part of IBM's recommendations for implementing DES. This is a proven best practice for perfect systems. This advice on changing passwords monthly is based on the assumption that the ends are secure, for example mainframe to mainframe communications.

      Weren't session keys invented to overcome this problem?

      Yes. The basic concept of limiting the amount of exposure a password breach causes is still sound, even if the real world economics make it a small improvement, as opposed to a large improvement.

    44. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Once upon a time, there was a sysadmin A. He didn't change his password for 20 years. Maximum number of password crack attempts per unit time(Max attempt flux): (keyspace/20years).

      I agree completely that if the attacker can scan the entire keyspace in 20 years, then sysadmin A's password will be cracked.

      From your earlier post:

      There was another contemporary sysadmin B. He changed his password every month.

      If the attacker can scan the entire keyspace in 1 month, then sysadmin B's password will be cracked. Yes, I think we all agree on that. The question is, is sysadmin B really that more secure than sysadmin A? You seem to be trying to make an argument that sysadmin B is '240 times more secure', but your argument isn't very coherent and I don't understand it.

      Suppose the attacker is scanning the keyspace more slowly, say he's scanning the entire keyspace in 20 years. Then in that time, sysadmin A will get cracked in that time with 100% probability. But sysadmin B will get cracked in that time with a probability of at least 63%. Is that enough of a difference that sysadmin B can feel a warm glow of safety?

      The reason why that there is no absolute maximum number to the attempts it could take to crack sysadmin B's password, is because it is periodically changing. Unless the cracker can scan the entire keyspace in 1 month (in which case sysadmin B is guaranteed to be cracked anyway), then sysadmin B always has a chance that he changes his password in time to foil the attacker. But that is really a false hope: if the attacker is determined enough to scans the entire keyspace 10 times, for example, then sysadmin B only has a 1 in 20,000 chance of evading the cracker. The number 240 never comes into it.

      The point of my previous argument was to show that it doesn't matter how often sysadmin B changes his password, because even if he changes it to a random key after every attempted crack, this only buys him a factor 2 improvement in the average number of crack attempts required to guess his password. From my previous post:

      So you can see that as password is changed more frequently, the number of attempts changes from (keyspace/2) for no password changes, to (keyspace) if the password is changed frequently.

      If you don't understand my argument, please read the lotto analogy instead.

    45. Re:Ignore it? by kiddygrinder · · Score: 1

      It's a lot more ominous if you assume that they're all from the same botnet, and i would almost guarantee that at least a few of them are.

      --
      This is a joke. I am joking. Joke joke joke.
    46. Re:Ignore it? by DavidTC · · Score: 1

      But that's a case of 'the perfect is the enemy of the good'. Yes, it might not stop all attacks, but it stops most of the current ones, which is, um, better than having them.

      And, more to the point, the crap attacks are noise you can't see actual attacks through. Moving to another port fixes that.

      If you get 5000+ attacks a day, someone can actually run a distributed attack of 3000 a day against you specifically without you noticing. If you move to another port and get 5 a day, well...

      --
      If corporations are people, aren't stockholders guilty of slavery?
    47. Re:Ignore it? by bingoUV · · Score: 1

      1. Read up on metrics here. Most of your fallacies and misrepresentations of my arguments are due to ignorance of this subject. Wikipedia is here admittedly not very detailed, but it's a start.

      2. Chief fallacy at present: Your arguments, examples and calculations miss the effect of corporate policy on blocking/delaying IP/account/region on detecting an attempt to crack. "Cracking Management", if you will.

      --
      Bingo Dictionary - Pragmatist, n. A myopic idealist.
    48. Re:Ignore it? by Carnildo · · Score: 1

      You forget something - getting the password for a user account is only step 1.

      So you now check into that account every day to see what comes up - and "damn - the passwords been changed!"

      Once a determined attacker gets in, their first priority is securing their access -- installing rootkits and backdoors, and using local exploits to crack other accounts and systems. This is why the only safe thing to do once someone's broken in is to format and restore from known clean media: you need to get rid of any possible alternate ways of accessing the system.

      --
      "They redundantly repeated themselves over and over again incessantly without end ad infinitum" -- ibid.
    49. Re:Ignore it? by IWannaBeAnAC · · Score: 1

      Read up on metrics here. Most of your fallacies and misrepresentations of my arguments are due to ignorance of this subject.

      Now you are being duplicitous. What fallacies? What misrepresentations? If you think I've got anything in the final analysis wrong, please tell me - it might also help in winning the lotto!

      We have been discussing a specific problem, of whether there is a significant advantage to frequently changing a password. This is a well-defined problem: if you have two people working in the same office, person A has the same password for 20 years, and person B changes their password every month, then is it easier for a cracker to brute-force person A's password compared with person B?. I calculated the expected number of attempts needed to brute-force the password, and I also calculated the probabilities to crack the password after a fixed number of attempts. I believe I have shown that there is a small difference, but it is not significant - at most a factor 2 in the average number of crack attempts needed to break the password. This also has an applications to lotto strategy - buying lots of tickets in a single game of lotto is a better strategy than buying single tickets in lots of games, but the difference is small. For most situations, the effect on the chances of winning is negligible.

      Chief fallacy at present: Your arguments, examples and calculations miss the effect of corporate policy on blocking/delaying IP/account/region on detecting an attempt to crack.

      I've been analyzing the situation in terms of the expected number of attempts required to brute-force the password. Management could certainly make use of this information in formulating a specific policy, and that may result in slowing down the rate of attacks. That doesn't change the number of attacks required to crack the password, so it doesn't change anything in my analysis.

      On the other hand, the 'metric' you came up with, is based on the size of the keyspace divided by the rate of password changes. You have yet to provide any evidence that this 'metric' has any relevance to the problem. Indeed, it suggests that you have fallen for what appears to be a common fallacy, that changing your password N times means that it will take a factor N times longer for a cracker to guess your password. A bit of thought at how lotto games work shows that this cannot possibly be true.

    50. Re:Ignore it? by tomhudson · · Score: 1

      On a non-privileged account that they didn't break into via a system exploit? Not a rush. You could make the same argument for ANY user.

      Unless you're talking Windows, in which case you're on the wrong site.

    51. Re:Ignore it? by smash · · Score: 1

      If you're limited to 8 character passwords (and like it or not, some systems still are), that isn't an option.

      --
      I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
  3. Hardware firewall or use bfd by Golbez81 · · Score: 3, Informative

    bfd (and apf if you like it) are probably the best software solutions your gonna find, but if you're facing 1 million+ auth failures, I would seriously consider a hardware firewall and VPN of some sort.

    1. Re:Hardware firewall or use bfd by mellon · · Score: 1

      A firewall is useless, because you want people to be able to log in if they're authorized to do so. A VPN is actually a lot *less* safe than ssh, because it creates a general-purpose network link between the client and the server. Ssh is actually doing the right thing - a million auth failures in a month isn't a lot for a machine, just for a person. Even with good random passwords, as opposed to key authentication (which is a *lot* better), the chances of an attacker cracking an account with only a million logins is vanishingly small.

    2. Re:Hardware firewall or use bfd by coolgeek · · Score: 1

      I'll second the bfd and apf. It could be the 1M ssh attempts are sourced from a relatively small number of ip addresses, but since they are allowed to run unchecked, they run a whole dictionary or maybe even a brute force attack. I've found with bfd, once the bots start getting timeouts, they give up.

      --

      cat /dev/null >sig
    3. Re:Hardware firewall or use bfd by c_g_hills · · Score: 1

      So you think that a VPN should be used in conjunction with telnet and no passwords inside the network? Absurd! VPNs merely augment the current system. It would be no less secure with a VPN than without.

    4. Re:Hardware firewall or use bfd by Anonymous Coward · · Score: 0

      bfd (and apf if you like it)

      Seconded. From what I remember, they only work on RPM-based distros. Also, bfd (brute-force detection) is useless without apf (advanced policy firewall), you need apf up and running before bfd will do anything.

      The other benefit with apf is that it can periodically pool a few lists of known botnets or dodgy IPs and blacklists them.

    5. Re:Hardware firewall or use bfd by jon3k · · Score: 1

      The reason we use VPNs is to tunnel services securely over another network (in this case, the Internet). If the only thing I need is a console session (obviously the case here) what do I gain by using VPN?

    6. Re:Hardware firewall or use bfd by dzr0001 · · Score: 1

      I would think that you would benefit by dropping all SSH attempts that do not match your crypto ACLs, Sure, the firewall still has to deal with your unwanted SSH attempts, but the connections would never make it to the server which prevents brute force attacks and cuts down on system overhead since you aren't spawning processes every time someone makes an invalid connection attempt.

  4. Tar Pitting by spydum · · Score: 4, Informative

    I'm a big fan of tarpitting SSH connections myself. It dramatically cuts down on the repeated ssh attempts, and keeps my logs much cleaner.

    Basically, an iptables rule:
    -A INPUTCHAIN -m state --state NEW -m recent -p tcp --dport 22 --update --seconds 30 --hitcount 4 --rttl --name SSH -j DROP

    1. Re:Tar Pitting by Anonymous Coward · · Score: 2, Informative

      Fail2ban can do stuff that automatically!

    2. Re:Tar Pitting by jonesy2k · · Score: 4, Informative

      That's not tarpitting. Tarpitting involves keeping the connection open in order to tie up the resources of the attacking host.

    3. Re:Tar Pitting by Anonymous Coward · · Score: 5, Interesting

      I use a variation on tarpitting that has worked very well for me.
      It cut the attempts down from 60,000/day to 20 or 30 per day.

      I just add a small delay between the initial connection attempt
      and when I send the username/password prompt. The delay (in
      seconds) is the number of attempts in the last 30 minutes,
      squared. This makes all but the most determined attacker
      give up and go away very quickly.

      I have been using this with both FTP and SSH for the last
      year, and it works great.

    4. Re:Tar Pitting by Anonymous Coward · · Score: 0

      I had the same problem the OP describes and implemented fail2ban. Solved it quick. After a while, they gave up and now it's clean. They must watch for failures, too.

    5. Re:Tar Pitting by Minwee · · Score: 4, Insightful

      Fail2ban can do stuff that automatically!

      Let me see if I have this right. If iptables can keep count of incoming connections within the kernel and drop incoming connections as they happen without any intervention from a userspace program, that's _not_ automatic.

      But running a gigantic shell script to scrape text messages out of your system logs and then call randomly chosen commands which may or may not have any effect on the observed problem some time after it occurs, then that's "doing that stuff automatically"?

      Maybe those words don't mean what one of us thinks they do.

    6. Re:Tar Pitting by luizd · · Score: 2, Insightful

      Yes, I think that this is your best solution. Instead of using iptables directly, you should check your distribution software relative option.Generally is is easier (but anyway, it will ultimately result in the same iptables command)

    7. Re:Tar Pitting by cptdondo · · Score: 4, Insightful

      That, and create only a single user who can log in, that takes you to the real log in prompt. That way an attacker has to guess the one user+password, and have a legitimate userid+password to gain access.

      It's not foolproof, but it foils the vast majority of script attackers.

      And DISABLE ROOT LOGIN!

    8. Re:Tar Pitting by IQgryn · · Score: 4, Interesting

      How would one go about implementing this delay?

    9. Re:Tar Pitting by Anonymous Coward · · Score: 0

      you slick bastard

    10. Re:Tar Pitting by PCM2 · · Score: 1

      The delay (in seconds) is the number of attempts in the last 30 minutes, squared. This makes all but the most determined attacker give up and go away very quickly.

      I like the idea but your settings seem very aggressive. The attackers may go away "very quickly"... but do they go away quickly enough? Under your system, if an attacker has tried to login just eight times in the last half hour, any legitimate user who tries to login will have to wait a full minute after establishing the connection until they're allowed to enter their password. If that was me, I might hangup the connection and try again (compounding the problem).

      --
      Breakfast served all day!
    11. Re:Tar Pitting by Anonymous Coward · · Score: 1, Insightful

      That's asking for a dos attack though, send thousands of connection attempts to port 22 and the server will end up holding them for eternity until port/connection exhaustion.

    12. Re:Tar Pitting by mftb · · Score: 1

      I assumed this was being done on a per-IP basis.
      Incidentally, I would quite like to know how this AC went about implementing this.

    13. Re:Tar Pitting by PCM2 · · Score: 1

      Ah.

      --
      Breakfast served all day!
    14. Re:Tar Pitting by M.+Baranczak · · Score: 1

      So by sending a connection request every couple of minutes, I can effectively prevent all legitimate users from logging into the system?

    15. Re:Tar Pitting by schon · · Score: 4, Informative

      iptables -N autoban
      iptables -I INPUT -p TCP --dport 22 -j autoban
      iptables -A autoban -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH
      iptables -A autoban -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP

      Any site that connects more than 4 times in 60 seconds gets all packets subsequently dropped.

      You could change DROP to TARPIT (if your kernel supports it) to fuck with them a little more.

    16. Re:Tar Pitting by silverglade00 · · Score: 1

      The best usernames to use for this are oracle, staff, admin, and sales!

      Seriously, not a bad idea. Have that one user be able to su only to another single user. THAT user can then su to root. Sprinkle in 0-n users as desired with a grain of salt.

    17. Re:Tar Pitting by ndege · · Score: 1

      fail2ban also handles other stuff too...like apache failed password attempts, etc.

      Yes, it is log scraping, but, the log scraping takes place within a second of the log entry occurs. With that said, fail2ban uses iptables underneath.

      If you care to know.

      --
      Sig Return: 204 No Content
    18. Re:Tar Pitting by Anonymous Coward · · Score: 0

      So learning iptables will seriously damage someones ability to secure their system?

    19. Re:Tar Pitting by Anonymous Coward · · Score: 0

      Sure, but it doesn't mean what you seem to think it means. There is no downside to knowing what you're doing, but there may be multiple and devastating downsides to running unnecessary scripts you don't understand just because you can't be bothered to learn the tools of your trade. Learn to do it properly or hire someone who can!

    20. Re:Tar Pitting by sconeu · · Score: 1

      Probably customized the OpenSSH source. It's not that hard.

      --
      General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
    21. Re:Tar Pitting by Anonymous Coward · · Score: 0

      Learning what Pyrrhic victory means would have helped his argument, but it would have only been a Pyrrhic victory.

    22. Re:Tar Pitting by rahunzi · · Score: 1

      like it

      --
      ...that's the beauty of time travel...bye
    23. Re:Tar Pitting by Anonymous Coward · · Score: 0

      That same Anonymous Coward again:

      I failed to read his iptables statement properly before posting my comment, then immediately realised I'd been a twit. Only to discover that Slashdot was having nothing of that 'let someone post another comment within three weeks of the first one' thing, and refused to accept my retraction.

      This seems remarkably apropos to the topic, somehow...

    24. Re:Tar Pitting by Anonymous Coward · · Score: 0

      I'm a big fan of tarpitting SSH connections myself. It dramatically cuts down on the repeated ssh attempts, and keeps my logs much cleaner.

      Basically, an iptables rule:
      -A INPUTCHAIN -m state --state NEW -m recent -p tcp --dport 22 --update --seconds 30 --hitcount 4 --rttl --name SSH -j DROP

      Or better, change ssh port, and use iptables tar option on port 22

    25. Re:Tar Pitting by JackieBrown · · Score: 1

      But could grandma do that?

      *just kidding

    26. Re:Tar Pitting by JackieBrown · · Score: 3, Funny

      Incidentally, I would quite like to know how this AC went about implementing this.

      He'll be back. He has to wait an hour before being able to log in again.

    27. Re:Tar Pitting by jandrese · · Score: 1

      This is a risky thing to do IMHO. It's too easy for an attacker to lock out the admins when they start attacking a host. You have to be careful to whitelist at least one of your own hosts so you can get on the machines in an emergency.

      --

      I read the internet for the articles.
    28. Re:Tar Pitting by Just+Some+Guy · · Score: 1

      At work, I have syslogd on every public-facing SSH server set to forward auth messages to the firewall. That machine runs sshguard, which looks at those logs for attacks against all machines and handles them centrally. For that level of functionality, yeah, it's pretty automatic.

      --
      Dewey, what part of this looks like authorities should be involved?
    29. Re:Tar Pitting by Anonymous Coward · · Score: 0

      Oooh. We're using the Windows Admin's definition of "automatic" - "something else does this for me and I have no idea what's going on once I clicky-clicky on it." Gotcha.

    30. Re:Tar Pitting by DavidTC · · Score: 1

      Erm, no it cannot.

      fail2ban blocks ssh connections after failed attempts.

      tarpitting is slowing down connections. That code slows down ssh connections after, I think, 4.

      Frankly, I don't see why you couldn't slow them all down, unless you were using scp or something. How often do you make a new ssh connection to a server? If all new connections were delayed 30 seconds, you'd probably be fine, especially something would trip after you've been connected successfully. You'd need an 'anti-fail2ban' or something reading logs for that.

      Incidentally, what's going on with the retarded war about fail2ban vs. other ways to block? Are either side serious? Because you're both sounding really, really stupid right about now.

      fail2ban uses iptables. It is a tool that looks at logs of various services, and puts those IP addresses into iptables (Or hosts.deny) for a specific amount of time. You should use it if that's what you want to happen.

      Likewise, there are iptable commands that can slow or block repeated connections from the same IP. iptables does not know when you've succeeded or failed. Use that if that's what you want to happen.

      I used to use fail2ban, I now use iptables to block repeated connections, except on my mail servers, where specific bogus email addresses (spamtraps) get you, essentially, fail2banned. (Although I use ipset lists.)

      Christ, it's like a bunch of idiots arguing about whether HTTP servers or a perl CGI script is better. First of all, that's inherently stupid, as one uses the other, and second, um, maybe people should use the one that actually does what they want?

      Oh, and, while we're at it, the best thing to do to temporarily block IPs is actually to use ipset. It's what fail2ban should be using, and it's what it would actually let you manage current iptable timers if you wrote iptable code that dumped numbers in there. It's near perfect for 'blocking an IP for a set amount of time', as the entire point is to 'hold an IP, in a big list of IPs, for a set amount of time'.

      Sadly, it's near impossible to actually get fucking working because they like to idiotic change the interface and distros seem unwilling to actually include it.

      --
      If corporations are people, aren't stockholders guilty of slavery?
    31. Re:Tar Pitting by StripedCow · · Score: 3, Interesting

      But what happens if you call scp from a number of scripts in parallel? You will get banned?

      The problem is that you want to act only on the failed login attempts.

      --
      If Pandora's box is destined to be opened, *I* want to be the one to open it.
    32. Re:Tar Pitting by allo · · Score: 1

      DROP is tarpitting a bit, because it does not reset the connection (as REJECT does)

    33. Re:Tar Pitting by mrmeval · · Score: 1

      Distros like control and stability. If you've got a harmless psychotic friend that can fix your microwave with a screwdriver and ducktape but goes all OCD and reprograms it so the start key is at the upper left you probably won't call them more than once.

      It's far better to give them the broken microwave and whisper "HERF RIFLE" and go buy another microwave. When they come of of their hermitage after six months all emaciated and glowing you pat them on the head, feed them, offer profuse and glowing praise and then hand them a broken TV and whisper "Dail M for Mars". Then as they stumble off you sell the 10KW Microwave pulse rifle to Raytheon.

      --
      I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
    34. Re:Tar Pitting by JamesP · · Score: 1

      Nah, I prefer iis_admin for the jest...

      --
      how long until /. fixes commenting on Chrome?
    35. Re:Tar Pitting by 1s44c · · Score: 1

      I'm a big fan of tarpitting SSH connections myself. It dramatically cuts down on the repeated ssh attempts, and keeps my logs much cleaner.

      Basically, an iptables rule:
      -A INPUTCHAIN -m state --state NEW -m recent -p tcp --dport 22 --update --seconds 30 --hitcount 4 --rttl --name SSH -j DROP

      That doesn't look like tarpitting, you are just dropping the connections. Tarpitting would be holding the connection open but not sending useful data down it.

      Not that there is anything wrong with just dropping the connections, it's a good approach.

    36. Re:Tar Pitting by Anonymous Coward · · Score: 0

      You forgot to say "per IP address" - otherwise I'm assuming you like twiddling your thumbs for 24 hours every time *you* want to log in? ;)

    37. Re:Tar Pitting by awyeah · · Score: 1

      And DISABLE ROOT LOGIN!

      On many Linux distributions I've used, PermitRootLogin is enabled by default on SSH. I find it absolutely hilarious (FreeBSD has it disabled by default).

      I also find hilarious the number of machines where this is left enabled after a box is deployed into production.

      This seems to be especially common at places that call themselves "Microsoft Shops." This isn't a potshot against Windows admins - there are lots of very intelligent ones out there - it's just that there are a lot of Windows admins who don't really know Linux, but need to set up one or two Linux boxes in the data center for some software that they need to run.

      --
      Why, no, I haven't meta-moderated lately. Thanks for asking!
    38. Re:Tar Pitting by DavidTC · · Score: 1

      Yeah, I can't really bitch at the distros.

      It's just incredibly annoying that a 'table designed to hold hundred or thousand of IPs, or IPs and ports, or netmasks, all with their own expiration times, that you can refer to in iptables to allow or block, and easily add and remove stuff from it', which is incredibly useful, does not actually manage to make it to end users computers.

      I mean, it's not just for blocking. Want to do portknocking? Set up an ipset table, and allow new connections from that ipset table. Have the portknock detection throw an IP in it for 30 minutes. No need to expire anything, no need to change iptable rules each knock, tada, you're done, one command. You don't never need a background process running at all if you use inetd.

      --
      If corporations are people, aren't stockholders guilty of slavery?
    39. Re:Tar Pitting by WindShadow · · Score: 1

      What are the odds of a legitimate using the same source IP?

    40. Re:Tar Pitting by WindShadow · · Score: 1

      The problem with an effective tarpit is that it ties up one of your sockets as well as the originator's socket. I played with a program to open a socket, and for each incoming packet wait some time and NAK. Too effective, kept the attack socket up for hours.

    41. Re:Tar Pitting by schon · · Score: 1

      But what happens if you call scp from a number of scripts in parallel? You will get banned?

      "Doctor, it hurts when I do this."

      The solution is simple: don't do that.

      You have a fixed amount of bandwidth. You gain nothing from running scp in parallel. But if you're really stupid enough to want to do this, whitelist the IP address you do it from.

      The problem is that you want to act only on the failed login attempts.

      No, you want to act on *ALL* attempts.

      If someone is repeatedly attacking you and they get lucky, do you want to let them in when they retry? No, you don't.

    42. Re:Tar Pitting by schon · · Score: 1

      This is a risky thing to do IMHO. It's too easy for an attacker to lock out the admins when they start attacking a host.

      How, exactly? If an attacker has compromised the host you're connecting from then you've pretty much already lost.

    43. Re:Tar Pitting by jonesy2k · · Score: 1

      No, because dropping the first packet in a TCP connection means that the handshake doesn't complete. Tarpitting allows the handshake to complete and then keeps the connection open, which will keep the client connected for a much longer time than if a host doesn't respond to a SYN packet at all. http://en.wikipedia.org/wiki/Tarpit_(networking)

    44. Re:Tar Pitting by mrmeval · · Score: 1

      I'm no longer interested to function at that level and I have very little free time. I'd prefer a front end or program to do it written by people who love the OS. If I were in a good IT security job and getting paid for it I'd be more attentive to making everything run right and hopefully I'd have the training and tools to do it. For my personal PC, enough to know I'm ok and I don't run any servers on it. The servers I run are few and isolated and are only for my use.

      Document what you're talking about with examples. Assume the person you're explaining it too will not know what the hell you're talking about. Accept feedback and make the presentation better.

      I find iptables arcane and tedious and SELinux even more so. I'm never quite sure I've smashed every possible fault with my setup.

      I really need a good presentation, a good book on both and on security in general and six months of paid time off.
       

      --
      I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
    45. Re:Tar Pitting by Anonymous Coward · · Score: 0

      add pam_recent to your pam stack.

  5. sshblack by Anonymous Coward · · Score: 2, Insightful

    sshblack works very well for me. It monitors failed ssh connections and inserts entries into iptables to block the IPs.

  6. use openvpn ? by yorugua · · Score: 1

    if you can manage the set of users of your server, you can use OpenVPN and then SSH. OpenVPN has a "feature" that if each packet of the VPN is not digitally signed by a previously arranged (and distribuyed) key, then the packet is "ignored". After the VPN session is established/authenticated, your users can log in using ssh. There are even some virtual appliances and special distros (untangle.com) that have a "openvpn appliance" built in for this purpose. The how-to for openvpn is also easy to follow.

    1. Re:use openvpn ? by markdavis · · Score: 1

      VPN's are annoying and overrated. A simple tarpit delay would immediately solve the issue. The attempts will go from a million to a few hundred, instantly. And excessive logs will evaporate. Even a weak password cannot be brute-forced when the attacker can only make a few attempts per hour or per day. They will quickly give up and move on.

      It requires no special setup, no funky scripts, no non-standard ports, hardly any CPU time, no special client software, no re-educating users, no constant admin tweaking, and is self-correcting. A simple 1 to 3 line iptables entry is all you need. This is what I use: /sbin/iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH /sbin/iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j LOG --log-prefix "sshd_brute_force_block " /sbin/iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP

      When the attacker reaches 4 hit counts it will be blocked for 60 seconds before resetting. If the attacker keeps attacking before the 60 seconds are up it will reset the time limit to another 60 seconds. If an honest user messes up, all they have to do is wait a minute before trying again. If you feel you need to make it tighter, just reduce the number of tries to 3 and the timeout to 5 minutes.

    2. Re:use openvpn ? by mjschultz · · Score: 1

      My users have complained about that before. Especially with respect to SVN over SSH, because SVN has a nasty habit of creating a few connections and if they are quickly browsing the repository with `svn ls` of looking at log messages with different ranges the connections add up very quickly. This led to frustrated users yelling at me. I dialed back the numbers a bit to minimize the impact, but the invalid attempts started scaling back up.

    3. Re:use openvpn ? by Shark · · Score: 1

      On non bleeding edge kernels, using the TARPIT target is actually better than -j DROP as it will hog their resources. Be careful not to use connection tracking on those specific connections however.

      --
      Mind the frickin' laser...
    4. Re:use openvpn ? by mcbridematt · · Score: 1

      Theres an option to make SSH establish any subsequent connections on top of an existing one, which solves this issue for SVN. I can't remember what it was though.

    5. Re:use openvpn ? by jon3k · · Score: 1

      Why are you trying to use a hand grenade to kill a mosquito? Even if you add a device or piece of software to do VPN termination, all you've done is move the problem of brute force attacks there.

      There are half a dozen simple software and configuration options that solve this problem far better listed in the comments.

  7. Exactly by Anonymous Coward · · Score: 0, Insightful

    People are just paranoid. "How can I stop people from driving past my house and seeing if the lights are on?" You can't, cheaply.

    1. Re:Exactly by Darkness404 · · Score: 1

      There is a difference between someone driving past and seeing, and a million cars driving past.

      --
      Taxation is legalized theft, no more, no less.
    2. Re:Exactly by Minwee · · Score: 4, Funny

      "How can I stop people from driving past my house and seeing if the lights are on?"

      That's easy, just move the front door to where one of your upstairs windows is and install tiny robots that will draw the curtains if the traffic noise gets too loud.

    3. Re:Exactly by Anonymous Coward · · Score: 0

      Analogy:
      Live in a Gated community, or put up a wall that checks if they are valid and if they are not 10 times in a row then they are blocked for a month.

      For a server:
      Only allow verified IPs to SSH, or make an IPTables rule to block them for a month after 10 sequential failures.

    4. Re:Exactly by mjschultz · · Score: 2, Interesting

      But a million cars haven't driven past. Only ~1200 --- in the past year. This is no big deal. Hell, I start thinking something is wrong when I DON'T see many failed SSH attempts in the daily log reports.

    5. Re:Exactly by Anonymous Coward · · Score: 0

      No- there have been 1000000 drive-bys, by 1200 cars.

    6. Re:Exactly by ndege · · Score: 0, Offtopic

      For the love of moderation, will somebody please mod this the parent to +5 Funny/insightful!!!

      That comment is best I have read all week...you actually made me laugh out loud.

      --
      Sig Return: 204 No Content
    7. Re:Exactly by Anonymous Coward · · Score: 0

      People are just paranoid. "How can I stop people from driving past my house and seeing if the lights are on?" You can't, cheaply.

      They make these things called curtains which you might want to look into. In a pinch, a heavy blanket and some nails will do the trick. Or you can take a page out of the crackhead manual & just coat them all in tinfoil, which will cost you about a dollar, and can also be used to create fashionable head wear.
      Or you can just always leave the lights on, so that they don't get any useful information from the fact your lights are on.

      Sometimes the solution becomes obvious when you redefine the problem. In this case you have incorrectly identified the problem as the people driving past, therefore you can't come up with a cheap, easy solution. By understanding that it's not the people driving causing the problem, but the information they are getting while doing so, not only does the solution become cheap, obvious, and easy, but you've also solved the problem of people walking, biking, or otherwise passing your house.

      Several of the solutions offered already are cheap and easy, & have the added benefit of helping to protect against indirect attacks as well. So not only is your post rather Trollish, it is also completely incorrect.

    8. Re:Exactly by Anonymous Coward · · Score: 0

      Darn, that's a really good one. Now I see the absurdity of my own advice. (Luckily others beat me to posting.)

    9. Re:Exactly by 1s44c · · Score: 1

      "How can I stop people from driving past my house and seeing if the lights are on?"

      That's easy, just move the front door to where one of your upstairs windows is and install tiny robots that will draw the curtains if the traffic noise gets too loud.

      I don't know how you got modded funny, thats just about the most insightful comment in this whole thread.

    10. Re:Exactly by jon3k · · Score: 1

      1 million attempts != 1 million attackers

      I see an average of about 40 attempts per attacker so about 25,000 attackers per year. But the analogy is poor anyway. One of those is a physically location easily accessible by maybe a few hundred people. The second is an Internet based resource that can be accessed in a fraction of a second by a billion or so people around the world.

  8. Re:whatcouldposiblygowrong by Anonymous Coward · · Score: 0

    what could go wrong?
    worst case scenario? Slashdot trolls.

  9. Passwords? by fm6 · · Score: 4, Informative

    Here's my excuse to ride my usual hobbyhorse about passwords being obsolete. SSH supports certificate-based authentication, which is not only more secure, it's less of a hassle for the user. Don't know if it would be practical for your application (you might tell us more about that) but it's worth a look.

    1. Re:Passwords? by timmarhy · · Score: 1

      certs are harder for a user to setup, which means support time which cuts into a small time operation a lot.

      --
      If you mod me down, I will become more powerful than you can imagine....
    2. Re:Passwords? by david.emery · · Score: 1

      I agree with both parent posts. PKI Certs are certainly the way to go, but it's really hard to do this right.

      This is a case where some consulting to (a) set up the PKI stuff; (b) train our (unfortunately anonymous) questioner on how to disseminate the certs; and (c) apply the appropriate tarpit/other firewall settings, would probably be money-well-spent.

    3. Re:Passwords? by Anonymous Coward · · Score: 0

      If they can't figure out SHH passwords themselves, WTF are they doing logging into a remote shell?????

    4. Re:Passwords? by markdavis · · Score: 3, Interesting

      I agree that PKI would be more secure, but it is a LOT more hassle for most users. The simple fact is, a tarpit is *extremely* effective. Even a relatively weak password is going to be nearly impossible to break if the attackers are limited to only a few tries per hour or day or whatever.

    5. Re:Passwords? by fm6 · · Score: 1

      Password guess-ability is not the big security issue. The problem with passwords is that people write them down and leave them in unsecure locations. Or they fall victim to phishers or other social engineers.

      I've set up certificates for SSH accounts, and I don't see how it's more hassle for the users. You generate a key pair, you stick one on the server, the other on the user's computer. The only difference is that the user doesn't have to remember the password. I always set up my own SSH accounts this way, because entering a password over and over gets tedious.

    6. Re:Passwords? by fm6 · · Score: 1

      Why does the user have to set things up? You put a file on their machine, or you give them a script that creates the file.

    7. Re:Passwords? by markdavis · · Score: 1

      So... instead of social engineering to get a password, the attacker uses a virus or rootkit, then the intruder can lift the key right off the system. You are shifting from "something you know" to "something you have" (since knowbody KNOWS their key, it has to be stored). I suppose you could combine the two (passwords AND keys) for the utmost in security. But in many cases I don't see how using PKI is all THAT much more secure than passwords for remote access, especially when combined with other measures. I will guess that 99.9999% of ssh breakins are due to brute force attack, not social engineering. So it depends on the type of users and other factors as to which method makes the most sense.

    8. Re:Passwords? by rsborg · · Score: 1

      So... instead of social engineering to get a password, the attacker uses a virus or rootkit, then the intruder can lift the key right off the system.

      If an intruder has an installed rootkit on a trusted system like a developer machine, you're pretty much f*cked anyway... at that point, keylogging will yield far more access (all commonly used credentials, for example). Furthermore, a certificate is a host-guest combination, whereas a password will work from anywhere the host is visible (less secure).

      Face it, certificates are simply more secure than passwords.

      --
      Make sure everyone's vote counts: Verified Voting
    9. Re:Passwords? by Abcd1234 · · Score: 1

      Password guess-ability is not the big security issue. The problem with passwords is that people write them down and leave them in unsecure locations [stanbiron.com]. Or they fall victim to phishers or other social engineers.

      Except, of course, that's not the class of attack the individual posting the question was asking about. His problem is securing a site from random attackers on the internets, not from attacks as a result of a breach of physical security.

      Furthermore, other than cases of internal attacks (ie, disgruntled employees, etc), or honest-to-god corporate espionage, the risk of a written-down password being pilfered and used as an attack vector into a system is next to nil. As such, switching to non-password-based authentication fails the cost-benefit ratio for your average admin (the cost primarily being in time, both for the supporting admin and the confused users), and in fact, when comparing the dangers of complex passwords being written down and then stolen, versus weak passwords being guessed by a random attacker, the former is *far* less likely in general, and thus a far more preferable situation.

    10. Re:Passwords? by mrmeval · · Score: 1

      Virus, rootkit, theft. It depends on how valuable the key is. There are hungry people and paying them cash and expenses to go seduce or trick your people and copy keys. If that key is worth 100k to you it's worth it to pay 10k to get it.

      Asswords are just that so are keys that have no secondary authentication such as an this http://en.wikipedia.org/wiki/Security_token I prefer assword protected security tokens just to be mean to the user and put one more block on a thief. The user should get laid at least three times if nothing else.

      Locking down their account with SELinux is a fourth. Running all of the users on a dedicated and glued shut server is fifth.

      You really need a professional if you're at that level of risk.

      --
      I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
    11. Re:Passwords? by markdavis · · Score: 1

      You are making assumptions that this is a "trusted developer" system that was compromised. There are lots of other types of environments out there, like non-developers ssh'ing in from home. Systems in which you have almost zero control. But your point about keylogging is completely valid.

    12. Re:Passwords? by cynyr · · Score: 1

      or that laptop they are on gets stolen, or the USB key. Your best bet would require both. you could maybe intagrate one of those random password fob things. like the bliz authenticator.

      --
      All of the above was encrypted with a Quad ROT-13 method. Unauthorized decryption is in violation of the DMCA.
    13. Re:Passwords? by fm6 · · Score: 1

      Except, of course, that's not the class of attack the individual posting the question was asking about. His problem is securing a site from random attackers on the internets, not from attacks as a result of a breach of physical security

      So password guess-ability is a big issue. In which case certificates are more secure than even "hard" passwords, never mind the ones people usually pick.

      honest-to-god corporate espionage, the risk of a written-down password being pilfered and used as an attack vector into a system is next to nil.

      What, you think "corporate espionage" only happens in the movies? Why do you think companies have security guards and badges? Despite these measures, people get in all the time, usually by walking in behind somebody with a real badge. (I've been in workplaces where it was an ongoing problem.) Usually it's to steal physical stuff, but if I wanted to hack into somebody's system, I'd certainly go that route.

      As you say, this is not the kind of attack the question was about. But the point is that PKI is fundamentally more secure. This is true even if you believe that passwords on post-its is a lesser issue (which I don't). You don't secure your system by only hardening the most likely attack points — you have to make life difficult for any kind of intruder.

    14. Re:Passwords? by fm6 · · Score: 1

      If you assumes viruses and rootkits, then you certainly can't assume that your passwords are secure!

      I have to admit that a certificate by itself has weaknesses of its own. I still think even a certificate by itself is more secure than a password by itself, but having a second authentication is a "best practice" in the industry.

      And it's best practices we're talking about, not how important your data is. Even if don't care who reads your files, any system connected to the Internet is potentially vulnerable to the thousands of folks who will break in and sabotage it just to show that they can. You need to make it reasonably difficult for that kind of intruder, and I don't think you need to hire a cyber-Paladin to do it.

    15. Re:Passwords? by Abcd1234 · · Score: 1

      So password guess-ability is a big issue. In which case certificates are more secure than even "hard" passwords, never mind the ones people usually pick.

      Yeah. Or, he could go the actual, user-friendly route and just implement connection throttling, tarpitting, or similar technology to limit inbound ssh attempts.

      As you say, this is not the kind of attack the question was about. But the point is that PKI is fundamentally more secure.

      It sure is! And, like most security measures, there is a tradeoff between the security provided and user and administrative overhead and costs. And as I already said, for most people, the cost-benefit analysis for PKI simply fails.

      Remember, security is all about risk management. The risk of some brilliant hacker walking into the office, swiping some passwords, and using that to gain access to a corporate network is, for most industries, companies, and individuals, just not that great. And if it's a real concern, you're much better off limiting physical access by using keycards and hiring a security guard.

    16. Re:Passwords? by fm6 · · Score: 1

      Tarpitting can slow down scripted attacks. But if you're seeing millions of attempts to login, that's probably not enough.

      And I don't see a tradeoff. If you design it properly, a PKI system is actually less of a hassle for your users, and less of an administrative headache. Password systems persist out of inertia, not because of their greater simplicity.

    17. Re:Passwords? by jon3k · · Score: 1

      I have to assume by easier you mean using certificated based authentication without passwords. This is bad. Not only is it harder to setup but keys can be stolen easily and (very much due to) have to be moved from device to device. What you want is key + password this is "Two Factor Authentication" - something you HAVE (the keyfile) and something you KNOW (the password).

    18. Re:Passwords? by fm6 · · Score: 1

      You're right about two-factor methods being a lot better than any single factor. But I don't see how a certificate is any easier to steal than a password. To use it, you have to be logged into a (presumably password-protected) machine.

      And yes, you can copy the key file. But not as easily as you can copy a password written on a post-it. Or con the person who knows the password into sharing it with you. Not to mention that people tend to make up vulnerable passwords.

      You're the second person to tell me that keys are harder to set up. I've done it, and I don't agree. The difference is that your typical server comes with password-based authentication already in place. If you take the time to provide the same kind of automated setup for certificates (as SourceForge as done), the total hassle for your users is actually reduced.

    19. Re:Passwords? by WindShadow · · Score: 1

      The problem with certificates is that there are stored somewhere easier to find than inside someone's head. A certificate is a key anyone can use. But, you say, "I can password the certificate!" So the security comes back to a password again.

      For really security conscious users there will be a password on the filesystem, one on the account (login), and one on the certificate. They will be non-trivial and different.

      My point is that a certificate by itself is less secure than a password, since anyone can use it. Only by combining the certificate to identify the system and the passwords to prevent misuse will you have acceptable security. The hardest part is finding the user who will actually faithfully use all the available security.

      Combine this with human factors, like fingerprint readers, and port knocking and you can reach whatever combination of levels matches your requirements.

    20. Re:Passwords? by fm6 · · Score: 1

      The problem with certificates is that there are stored somewhere easier to find than inside someone's head

      And if most passwords were stored only in people's heads, that would be relevant. The problem is that most people have to use more passwords than they can possibly memorize.

  10. fwknop by c0d3g33k · · Score: 4, Informative

    They can't fail authentication if they don't know it's there. http://cipherdyne.org/fwknop/

    1. Re:fwknop by mprinkey · · Score: 1

      I agree completely. We use fwknop as a part of a required two-factor authorization scheme for a US Government customer. It is a minor inconvenience to use it to open the ssh port before connecting, but it virtually eliminates attack attempts. How can you hack a closed port?

    2. Re:fwknop by Anonymous Coward · · Score: 0

      Hack fwknop and/or libpcap which it relies on. Does it run as root? It seems like it would need to in order to packet sniff with libpcap and run iptables.

    3. Re:fwknop by phantomcircuit · · Score: 1

      That is an exceptionally bad idea. You're simply increasing the complexity of the entire authentication system, without doing much more than requiring another password.

    4. Re:fwknop by alanw · · Score: 1

      The unique aspect of fwknop is that it is a one way channel - there is no reply from the server to the client. There is no difference at all between sending a packet hashed with an invalid password to a server and sending a packet to a random IP address that is not running fwknop.

    5. Re:fwknop by jon3k · · Score: 1

      "That is an exceptionally bad idea. You're simply increasing the complexity of the entire authentication system, without doing much more than requiring another password."

      It's a very small increase in complexity to _dramatically_ decrease the likelihood of a successful attack. It's just "moving ssh to another port" taken a step further.

    6. Re:fwknop by Anonymous Coward · · Score: 0

      Ugh, please no. Use Moxie's knockknock: http://www.thoughtcrime.org/software/knockknock

  11. You are being brute-forced by Anonymous Coward · · Score: 4, Informative

    Welcome to the internet -- this happens to every site with a public IP.

    First off, do not change your SSH port. It won't do a whole lot for you, and it will be more hassle than it works.

    There are a whole lot of programs available to deal with SSH brute forcing. sshguard is one of them, and it's not too bad (you can apt-get install it). It's a bit of a hack -- it just watches your logs and takes appropriate action -- but it does work.

    The other thing you can do immediately is simply turn off password authentication in ssh. Anyone getting in will need a key. This is what sourceforge and github both do. This isn't always practical for every site, but it will damn sure keep your passwords from being brute-forced.

    1. Re:You are being brute-forced by wdsci · · Score: 1

      First off, do not change your SSH port. It won't do a whole lot for you, and it will be more hassle than it works.

      Well now that depends on your user base. If there are only a few people who need to log into the server, and they are familiar with using SSH to the point where they know how to specify an alternate port, and if you have an easy way to convey that information to them, then it's barely any hassle at all, and it does reduce the chance of unauthorized access by a significant factor - of course, that chance is already pretty small, so even a significant factor reduction might not be worth it to you. On the other hand, if you have users who aren't particularly comfortable with SSH or if there are, say, too many to tell them manually about the alternate port, then you might as well leave it at port 22.

    2. Re:You are being brute-forced by Anonymous Coward · · Score: 0

      It won't do a whole lot for you

      While I don't agree with security (solely) through obscurity, this statement is bunk. I have SSH on my home server (public key auth only), and with port 22 I was seeing thousands of login attempts from East-Asian IP blocks. After moving to an easy-to-remember port over 50000, I no longer get any attempts.

    3. Re:You are being brute-forced by silverglade00 · · Score: 1

      Port 54321?

    4. Re:You are being brute-forced by mcrbids · · Score: 1

      DISABLE PASSWORD AUTHENTICATION! I wish I had points to mod you up with! I use several strategies:

      1) Nonstandard port (despite what you say, it does stop you from getting the automated SSH scans hitting you)

      2) Disable password Auth

      3) RSA keys with passphrases.

      4) Disable the root password. Yes, I'm serious. If I'm remote, I can become root with my passphrase protected RSA key. If I'm local, I can reboot and run kernel mode single. The root password is simply not something I need, so it's only a liability.

      5) Sleep peacefully at night.

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
    5. Re:You are being brute-forced by outsider007 · · Score: 1

      5) Sleep peacefully at night.

      until the pc that your keys were on gets a virus and you decide to wipe it forgetting that you had some important stuff on there.

      --
      If you mod me down the terrorists will have won
    6. Re:You are being brute-forced by NotQuiteReal · · Score: 1

      Yeah, seems to me a million failures is what you want to see... it is the one success that is a bitch.

      --
      This issue is a bit more complicated than you think.
    7. Re:You are being brute-forced by Antique+Geekmeister · · Score: 1

      But changing your port is easy and cuts the burden of analyzing the logs and adding clever filtering to a tiny fraction of the current burden. Switching to SSH key access alone does not help the burden of all the logs of all the failures, which clutter the heck out of my logs without filtering which is a complete waste of my resources to deal with.

    8. Re:You are being brute-forced by Eil · · Score: 1

      First off, do not change your SSH port. It won't do a whole lot for you, and it will be more hassle than it works.

      I don't see why moving the SSH port is a bad idea. It's trivial and no ssh bot or script that I've heard of will even look for SSH on other ports. Adapting to it is as simple as adding a -p argument to your ssh command. I used to admin a machine that would see at least 5 brute-force runs on SSH per day. Changed the port and there were zero after that. The people who write brute-force SSH attacks (either in bot of script form) are looking for the low-hanging fruit. They don't even bother broadening their scope to systems with even a modicum of hardening because there are so many insecure-by-default machines on the net to choose from.

    9. Re:You are being brute-forced by sjames · · Score: 1

      Oddly enough, it WILL do a lot! The vast majority of password guess attempts are NOT targeted at your particular server where they would bother port scanning you. They just want any valid login on any server anywhere. Changing the port nomber makes them just go away at the first connection refused. It's just important to remember that that bit of obscurity only turns away the big dumb attacks, it does NOT make you more secure against a targeted attack (which, I imagine, was your point).

    10. Re:You are being brute-forced by Anonymous Coward · · Score: 0

      No, but I do use that as the combination on my reverse luggage.

    11. Re:You are being brute-forced by Sancho · · Score: 1

      Adapting to it is as simple as adding a -p argument to your ssh command. /quote?

      Even better, add it to your SSH config:

      $ cat .ssh/config
      Host sancho
      Hostname sancho.dyndns.org
      Port 12344
      User sancho

      Now typing "ssh sancho" takes care of my connection, including using the correct hostname, username, and port. Most, if not all command line arguments can be stored in your .ssh/config.

    12. Re:You are being brute-forced by dfsmith · · Score: 1

      Or shut down the ssh port altogether. Simply open up the telnet port if you need CL access. B-)

      This is not quite as silly as it seems. It's fairly easy to make "advent"-like scripts on the other side of telnet to access a real ssh port. E.g, "KILL TROLL WITH DAGGER" to start the ssh daemon with access from that IP address.

    13. Re:You are being brute-forced by TheTurtlesMoves · · Score: 1

      The other thing you can do immediately is simply turn off password authentication in ssh.

      Which changes the problem to managing a secrete passkey file on every machine i want to use to access it. Not necessarily an improvement in some cases and user nightmare in many.

      Passwords are fine, if you can prevent offline attacks.

      --
      The Grey Goo disaster happened 3 billion years ago. This rock is covered in self replicating machines!
    14. Re:You are being brute-forced by awyeah · · Score: 1

      That, of course, requires only a small amount of vigilance with your keys. Do backups? Maybe put one on a thumb drive or CD and put it in a fireproof box?

      Also,

      If I'm local, I can reboot and run kernel mode single.

      So all is not totally lost if his PC needs to be wiped. Just makes things a pain in the ass :)

      --
      Why, no, I haven't meta-moderated lately. Thanks for asking!
    15. Re:You are being brute-forced by awyeah · · Score: 1

      I still see failed login attempts on my non-standard ssh port. Not nearly as many, though. Anecdotal evidence... but still.

      --
      Why, no, I haven't meta-moderated lately. Thanks for asking!
    16. Re:You are being brute-forced by jon3k · · Score: 1

      "First off, do not change your SSH port. It won't do a whole lot for you, and it will be more hassle than it works."

      Couldn't disagree more. If you were more familiar with these attacks you'd know that they are botnet driven brute force attempts that only use the default SSH port. And seriously, hassle? What hassle? Having to specify a port? Seriously? Are you kidding me? Anyone I know who's bright enough to use/need ssh access to a host is more than competent to specify a port number. We're talking 99.999999999% here.

    17. Re:You are being brute-forced by jefftp · · Score: 1

      No, change the default SSH port. It's so rare that actual humans are behind brute force attacks anymore that changing ports makes a huge difference in automated port-scanners from even bothering with your servers.

    18. Re:You are being brute-forced by raju1kabir · · Score: 1

      First off, do not change your SSH port. It won't do a whole lot for you, and it will be more hassle than it works.

      I disagree. I changed the SSH port on all our servers. Everyone updated their .ssh/config files and that was the end of the hassle. Bad logins dropped from thousands a day to a handful every few weeks.

      --
      "Patriotism is your conviction that this country is superior to all other countries because you were born in it." -- GBS
  12. Never passwords! by Just+Some+Guy · · Score: 1

    Use public key authentication. It's super easy and much more secure, unless your random passwords happen to be over 300 characters long (ssh-keygen makes 2048-bit keys by default; assume 6 bits per character in a random password if each character is in the base64 set). Also, sshguard is your friend. After a small number of invalid logins - 4 by default - that IP gets firewalled for a short period of time.

    --
    Dewey, what part of this looks like authorities should be involved?
    1. Re:Never passwords! by GringoChapin · · Score: 1

      Actually, 2048 bits on a symmetric key (which is what a password is) is insane overkill. You are making the classic mistake of comparing the number of bits in an asymmetric key to the number in a symmetric key. SSH, at best, uses 256 bit symmetric encryption for the session, so you would only need a (using your numbers for 6 bits per char) password that was 43 chars long. Anything longer is pointless, because your encryption/authentication scheme is only as good as the weakest link.

    2. Re:Never passwords! by Anonymous Coward · · Score: 0

      Just so you know, you’re comparing RSA public keys with entropy there. Apples and oranges. You would get equivalent security with somewhere around 20-25 random alphanumeric mixed-case characters.

    3. Re:Never passwords! by Anonymous Coward · · Score: 0

      Symmetric keys are generated via Diffie-Hellman and not related to authentication. You are making the classic mistake of not understanding what you're talking about.

    4. Re:Never passwords! by GringoChapin · · Score: 1

      I don't recall stating that symmetric keys are related to authentication. May I suggest a careful reread?

  13. Fail2ban or denyhosts by mystik · · Score: 3, Informative

    Fail2ban or denyhosts activly target ssh. fail2ban includes rules for other services, but denyhosts includes a mechanism for sharing lists of your denied hosts w/ other admins, as well as using their ban lists to protect your ssh logins.

    --
    Why aren't you encrypting your e-mail?
    1. Re:Fail2ban or denyhosts by jroysdon · · Score: 1

      I second this advice. I don't care about other services, so denyhosts is good enough for me. I like the shared database nature, much like spam databases.

      Implement one-time passwords for new users. One time in, push public key, password no longer works. Use pub/priv keys only. Then every failed password auth can be set to fail after 1 attempt, and you can spread the goodness with denyhosts.

  14. SSH public key authentication by whamett · · Score: 4, Informative

    This kind of brute-forcing is common. The simplest way to deal with it is to set up SSH public key authentication, disable SSH password authentication, and forget about it.

    1. Re:SSH public key authentication by ColaMan · · Score: 3, Funny

      The simplest way is to drop SSH and just use telnet. They won't be expecting that!

      --

      You are in a twisty maze of processor lines, all alike.
      There is a lot of hype here.
    2. Re:SSH public key authentication by Anonymous Coward · · Score: 0

      that has worked for me. the key is to use
      one-time passwords with telnet.

  15. Fail2Ban by j_kenpo · · Score: 1

    If your not willing to invest money into intrusion detection, vulnerability scanning, or moving to a more responsive provider, accept that your server is going to constantly be scanned by the droves of script kiddies out there throwing everything but the kitchen sink at any server that responds to a ping and keep monitoring those logs, which hopefully are stored on a separate server in case you are ever actually compromised. In the mean time, try installing Fail2Ban on your server. It will block an IP address after X number of failed authentication attempts, which will alleviate the noise of the brute force password guessing attempts.

  16. What could all those people want to badly? by Anonymous Coward · · Score: 0

    Everybody wants free porn. You're just going to have to live with that. You sleep with dogs, you're bound to get flees (unless you have mandatory government filters).

  17. Spend more than 10 minutes? by Seakip18 · · Score: 2, Informative

    Seriously. I'm in the same shoes and it's easy. I came across it pretty quick and all these SSH log in problems went away.

    Check out...waaaaait...

    What's most troubling is this:

    I own a small Web development studio that specializes in open source software, primarily Drupal, WordPress, and Joomla for small businesses

    You operate a business and you haven't figure out this chief problem yet...but you want us to help you out?

    Well...Here's the solution: denyhosts

    Someone else'll chime in with it....Just hope you read up and configure it properly....or you'll find yourself locked out of your own servers.

    --
    import system.cool.Sig;
    1. Re:Spend more than 10 minutes? by Gearoid_Murphy · · Score: 4, Informative

      add the ip address and/or hostname of all the hosts you use to access your servers into /etc/hosts.allow. If denyhosts picks up 3 failed logins from a single ip address, that address is added to /etc/hosts.deny, if this happens to be your machine (and you're having a bad day entering your password), you could get locked out of your system.

      --
      prepare the survey weasels.
    2. Re:Spend more than 10 minutes? by awyeah · · Score: 1

      fail2ban has a whitelist.

      --
      Why, no, I haven't meta-moderated lately. Thanks for asking!
  18. DenyHosts by Utoxin · · Score: 1

    Great tool that pools the resources of multiple servers to proactively block IPs that are trying to brute-force the SSH port on any server in the pool:

    http://denyhosts.sourceforge.net/

    I use it, and it has Just Worked for years.

    --
    Matthew Walker
    http://www.tweeterdiet.com/ - My Diet Tracking Tool
  19. So? by victim · · Score: 4, Interesting

    If you really have secure passwords, the random guessers aren't going to get them. Log it and move on.

    I get thousands of Chinese hackers attempting to break into the battery monitor in my tool shed, big deal. I don't know why my battery voltage and solar current is so important to them, but they can knock themselves out all day.

    If the logs bother you then install fail2ban and configure it to lock people out after a few bad guesses. (Then be ready to unlock yourself from an alternate IP when you inevitably lock yourself out.)

    1. Re:So? by Anonymous Coward · · Score: 0

      I get thousands of Chinese hackers attempting to break into the battery monitor in my tool shed, big deal. I don't know why my battery voltage and solar current is so important to them, but they can knock themselves out all day.

      don't you mean MY battery monitor?

    2. Re:So? by Skapare · · Score: 1

      They don't know it's a battery monitor. All they know is, it has an IP address, and it listens on a port they suspect is SSH, and if they can get in, they can probably use it to get back out to somewhere else using your IP and your bandwidth, to do things ranging from sending out millions of spam to performing denial of service attacks on some target.

      FYI, moving the port is (at least for now) more effective than banning them for a few tries. If they get banned, they just share your IP with their friends, who will also try. If they never get a connection, they don't share it. And there are fewer pointless log entries. Simple as that. If adding a "Port" statement in your ~/.ssh/config file is too hard for you, oh well.

      --
      now we need to go OSS in diesel cars
    3. Re:So? by Korin43 · · Score: 2, Interesting

      I'm surprised I had to scroll down half the page to find this. Seriously, what is everyone so worried about? Just set a secure password and don't even worry about it. Assuming you have a secure password (8 characters, upper and lower case letters and numbers), even a million attempts per second will take over 3 years on average (and ssh won't let you try that often anyway). Bump that up to 12 characters and you're looking at millions of years.

    4. Re:So? by Anonymous Coward · · Score: 0

      You could always whitelist your target countries IP ranges. If you know the countries that are your prospective customers, permit them, drop the rest.

      Similarly, if a particular country is giving you trouble, ban the whole country, leave everyone else.

      Personally, I have no interest in having anyone visit my site that isn't in my country. So, I just permit them. Voila! Done. If I have hack attempts from within my own country, I call that ISP and get them to enforce their AUP.

    5. Re:So? by rawg · · Score: 1

      Until you get 10,000 machines trying to brute force your password at 120 times per second. Then you'll think twice about log and forget.

      --
      The above is not worth reading.
    6. Re:So? by toadlife · · Score: 1

      +1

      Besides, reading the logs can be good for a laugh.

      --
      I don't always use unix-like operating systems; but when I do, I prefer FreeBSD.
    7. Re:So? by BeardedChimp · · Score: 1

      Not only that, these brute force attempts tend to be dictionary attacks. So unless your 8 character alphanumeric password somehow lands on a real word, your going to be pretty safe.

      This gives me an idea, how about faking authentication and displaying an ascii version of goatse as the motd.
      I would love to think I'm some chinese arsehole an erm... arsehole.

    8. Re:So? by kriston · · Score: 1

      I'm sorry, but using passwords is completely wrong.
      The only real answer is to disable password authentication and only allow certificates. It's completely easy for anyone with access to a text editor.
      Ask your sysadmin to do this:
      PubkeyAuthentication yes
      PasswordAuthentication no
      PermitEmptyPasswords no
      ChallengeResponseAuthentication no

      Your problem goes away completely.

      If you think ssh certificates are hard to use then maybe web hosting is not the right business for you to be in.

      --

      Kriston

    9. Re:So? by Korin43 · · Score: 1

      But why? It's extra effort to set up and a huge annoyance if you don't have your key (hard drive crash, using someone else's computer), and really, it may be much harder, but when you're talking about millions of years to crack an 8 character password, does it really matter?

    10. Re:So? by kriston · · Score: 1

      By turning off the password checking the system stops consuming time hacking passwords. Plus, you can't brute-force guess a certificate. The problem literally goes away.

      --

      Kriston

    11. Re:So? by Korin43 · · Score: 1

      What I'm saying is the difference between taking millions of years and being impossible just doesn't matter. If you have an 8+ character password, the problem doesn't exist.

    12. Re:So? by kriston · · Score: 1

      The problem as I understand it is not just security but also denial-of-service related. Those attempts are consuming his server's resources.

      --

      Kriston

  20. Move to a higher order port and use denyhosts by deadmongrel · · Score: 3, Informative

    I use one or more of these on my public facing servers.
    1. Move the default ssh port to a higher order port (5000+)
    2. Use Denyhosts http://denyhosts.sourceforge.net/ to block repeated attempts
    3. use key exchange instead of username/password
    4. use network based IPS.
    Just moving the ssh port reduced the ssh brute force attack for me. Either stop being a noob or hire a sys admin.

    1. Re:Move to a higher order port and use denyhosts by sootman · · Score: 5, Funny

      1. Move the default ssh port to a higher order port (5000+)

      Agreed. The higher the better. For the ultimate in security, I recommend 65536.

      --
      Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
    2. Re:Move to a higher order port and use denyhosts by Anonymous Coward · · Score: 0

      Your ip-packets go all the way up to 65536? That's one more!

    3. Re:Move to a higher order port and use denyhosts by MrCrassic · · Score: 2, Interesting

      Changing the port might be troublesome if you're trying to SSH from public locations like airports and such. They usually leave port 22, 443 and 8080 open for their own services and block all others, so you will have to either set up VPN to get into your servers or wait until you're elsewhere. Additionally, an evenly-slightly determined hacker can still find where your sshd process is listening on by running a basic nmap scan.

      Key exchange and disabling root login is probably the best way to go. Fail2ban worked really well when my server had a Linux distro on it.

    4. Re:Move to a higher order port and use denyhosts by Anonymous Coward · · Score: 0

      +1 +1 +1

    5. Re:Move to a higher order port and use denyhosts by thegrassyknowl · · Score: 1

      1. Move the default ssh port to a higher order port (5000+)

      This is _not_ a good idea. Aside from the fact that now any n00b client that needs SSH access to the server is going to have to also remember a new port number, a sufficiently determined logged in user can cause the SSH daemon to crash and then replace it with one of their own which can sniff keys and passwords, contains back doors, etc.

      You can get around this by changing the privileged port numbers using a sysctl, but that has other drawbacks. You could do a little firewall trickery to redirect a higher order port to the lower one and blocking the low port from external access.

      But I reiterate, unless it's just for your own private use changing the SSH port is not a sufficiently good solution.

      Tarpitting seems like a really good solution to me. Configuring SSH better is also a good start.

      Settings like LoginGraceTime, PermitRootLogin=no and MaxStartups, MaxAuthTries, MaxSessions are all good to reduce the number of failed login attempts. Most scripts (what you are seeing) use a single session and try to stuff as many auth tries down it as possible. The do this to avoid firewall-based IDS systems from rate limiting or blacklisting them. Reducing the grace time to 15 seconds is a good start (if your clients do not have reverse lookup PTRs on their addresses this will be bad). Reducing MaxAuthTries to 2 or 3 will help. MaxSessions can be reduced also. Of course these also have drawbacks. If you're only using shell access to the machine you don't really need many sessions on a single TCP connection.

      --
      I drink to make other people interesting!
    6. Re:Move to a higher order port and use denyhosts by Allnighterking · · Score: 1

      Yes nothing like security by obscurity. Quite honestly I'm of the opinion that moving the port is of little use. One scan and they have my ports list one run of telnet against the ports and they know what they ports are. Ok I've delayed them what, 2 minutes? SSH key authentication, (which allows for easier to remember pass phrases for your users) Iptables or host_deny for the worst offenders (I've got 3 IP's banned that comprised 80% of my problem) and that's it. Just don't use 256 bit ssh keys. Go 2048, 1024 at the very least.

      --

      I'm sorry, I'm to tired to be witty at the moment so this message will have to do.

    7. Re:Move to a higher order port and use denyhosts by _xeno_ · · Score: 1

      For the ultimate in security, I recommend 65536.

      I tried that, but it keeps on binding to completely random ports whenever I start the daemon.

      --
      You are in a maze of twisty little relative jumps, all alike.
    8. Re:Move to a higher order port and use denyhosts by DavidTC · · Score: 2, Insightful

      You are assuming they are actually attacking your computer.

      They are not. They're stupid bots. Poorly written stupid bots.

      They do not do portscans, at least not of random ports. They do not attempt to find ssh elsewhere.

      I swear, I keep having this idiotic discussion. Have it about spam too. 'But why would you block email servers that don't appear to understand the SMTP protocol? Spammers can just write better servers.'

      We're not trying to block hypothetical attacks. We're not trying to stop hypothetical tools that go out and find ssh servers.

      We're trying to stop the actual attacks that are actually happening from totally idiotic craptastic software criminals are currently using.

      Forcing them, at the very least, to high competent amoral programmers, instead of the incompetent boobs they apparently hire currently.

      --
      If corporations are people, aren't stockholders guilty of slavery?
    9. Re:Move to a higher order port and use denyhosts by DavidTC · · Score: 1

      a sufficiently determined logged in user can cause the SSH daemon to crash and then replace it with one of their own which can sniff keys and passwords, contains back doors, etc.

      If you're stupid enough to pick a non-restricted port, and then not restrict it.

      The only reason moving to another port is the legit worry about other networks blocking access.

      Reducing the grace time to 15 seconds is a good start (if your clients do not have reverse lookup PTRs on their addresses this will be bad).

      Um, no. This is a flatly stupid idea to stop attackers. Attackers are using automated tools, and hence send the username and password near instantly. It's actual people who have to type.

      --
      If corporations are people, aren't stockholders guilty of slavery?
    10. Re:Move to a higher order port and use denyhosts by Sancho · · Score: 2, Insightful

      I used to feel the same way. But really, moving the port lets you focus on the real threats.

      Look at it this way: if you are being targeted with a sophisticated hack, any dangerous attempts to log in to port 22 will get lost in the massive amount of bot traffic. But if your SSH server is on port 12344, then the reports in your logs will be more meaningful. You'll know that someone was conducting real reconnaissance and you can start worrying. There's no reason that you can't change the port as well as requiring keys to log in.

      Relying on a secret port is security through obscurity. Utilizing a non-standard port to filter out bot traffic in your logs logs so that you know when you're really being attacked is actually fairly smart. Sure, maybe one day the bots will start port-scanning first, but for now, it's sound.

    11. Re:Move to a higher order port and use denyhosts by changa · · Score: 1

      When you conceder that the majority of the attempts are automated bots so moving port would reduce the amount of scans.   The scans that do happen after that you can at least assume they are spending more time on your server.

      I moved mine and the failed attempts dropped entirely.

    12. Re:Move to a higher order port and use denyhosts by Anonymous Coward · · Score: 0
      1. Move the default ssh port to a higher order port (5000+)

      Are you sure? I would recommend at least over 9000!!

    13. Re:Move to a higher order port and use denyhosts by WuphonsReach · · Score: 1

      Additionally, an evenly-slightly determined hacker can still find where your sshd process is listening on by running a basic nmap scan.

      A determined hacker is a whole different ball of wax. If someone is specifically targeting you, then different rules apply.

      Moving the port is a good first step (hell, put it on 443 or 8080). That alone will eliminate 99.9% of the attackers who are too lazy / busy to port scan the box. And it does wonders in cleaning up the log files because you'll no longer have thousands of attempts per day. That makes it easier to see more serious attackers without them being lost in the noise.

      - move the port
      - only allow key-based authentication
      - disable root login via SSH

      If you absolutely positively have to have SSH running on port 22, create a 2nd daemon and restrict it to a limited set of users.

      --
      Wolde you bothe eate your cake, and have your cake?
    14. Re:Move to a higher order port and use denyhosts by dissy · · Score: 1

      I tried that, but it keeps on binding to completely random ports whenever I start the daemon.

      Just reboot often. It will keep the bad guys guessing!

    15. Re:Move to a higher order port and use denyhosts by awyeah · · Score: 1

      While I agree that changing the port is nothing more than obfuscation - which is a terrible security policy, it should be noted that it still probably will eliminate the portion of break-in attempts that come from script kiddies, zombie machines, and the like, because they're probably just looking for stuff on common ports and moving on to the next machine.

      However, if someone wants to get into my system specifically, they're going to do exactly what you described, and they're not going to be fooled by the "Port 55432" in my sshd_config.

      So, even though you've eliminated some of the risk, it's really not much of a solution.

      --
      Why, no, I haven't meta-moderated lately. Thanks for asking!
    16. Re:Move to a higher order port and use denyhosts by jon3k · · Score: 1

      ^ I keep trying to mod this +6 but it's not working

    17. Re:Move to a higher order port and use denyhosts by jon3k · · Score: 2, Insightful

      You're missing the point. The goal of moving it is to stop the botnets. Now if you see failed attempts to login via SSH on port 12345 you know that it's a much more sophisticated directed attack on your host. Moving the port is more about filtering out the noise.

    18. Re:Move to a higher order port and use denyhosts by jon3k · · Score: 1

      This has nothing to do with determined hackers. This is to filter out the 99.99999% of failed authentication attempts we're all seeing because of botnets.

    19. Re:Move to a higher order port and use denyhosts by raju1kabir · · Score: 1

      That's a very good point. I hadn't thought of it that way before.

      --
      "Patriotism is your conviction that this country is superior to all other countries because you were born in it." -- GBS
    20. Re:Move to a higher order port and use denyhosts by ladadadada · · Score: 1

      My thoughts on these suggestions:

      1. The purpose of changing the port is not security (a simple portscan will undo that) but reduction of logged error messages while still allowing all IP addresses anywhere to SSH to the machine.
      2. The port you choose is important. At one place I worked we used port 10000. This is already used for Webmin (although we never used Webmin) and hence we got thousands of Webmin brute force attacks against our SSH port. They could never have been successful but it didn't cut down on the logged error messages very much.
      3. Denyhosts and Fail2ban both have the ability to be quite nasty on false positives and are rather prone to them. Amongst all the suggestions above to use these products, I would also add to make sure you whitelist a place you can always get access to. You should also have an out-of-band communication method with your servers. That way, when you do finally get locked out of your own server by your security tool, you know how to get in and fix the problem. The same goes for an IPS if you install one. Make sure you can still access it when it decides you are an intruder.
      4. Check your SSH error log to make sure something like denyhosts or fail2ban would even be of any use. I have seen plenty of brute force attempts where each IP address only tries three different username/password combinations and then moves on to another server. Then another picks up where the first one left off. These guys wouldn't even notice if you were using fail2ban. Sharing your denyhosts with the denyhosts site might help. You could use the shared denyhosts block lists to configure fail2ban if you preferred it.

      And to the original poster who gets a million per year across 50 or so domains... I got a new box installed a few weeks ago that had 45,000 attempts in the three days it was online before my ISP gave me the IP address. That's a million attempts about every two months. Per server. You have only yet seen the tip of the iceberg.

      --
      Sig matters not. Judge me by my sig, do you?
    21. Re:Move to a higher order port and use denyhosts by DavidTC · · Score: 1

      It really is driving me crazy.

      Security by obscurity is stupid by itself. Security by well-formedness is stupid by itself.

      I mean, let's assume I'm in charge of physical security, and everyone is required to have their badges pinned to the upper right torso. Likewise, they are required to respond to my 'Hello', with 'My name is [their name].'.

      Now, I clearly should not be automatically letting in everyone with the correct badge position, or the correct response. None of those are particularly a secret, and an attacker could have easily figured them out. I need to actually check the badge and image against their face and the database.

      And someone walks up with their badge pinned to the upper left. And doesn't respond correctly.

      So I should...what? Just ignore that fact?

      Security through obscurity, security by 'public procedure following', is an entirely valid thing to do on top of other security.

      Especially, and I can't add emphasis this enough, on the internet,where you have the equivalent of 50 idiot kids getting in line to every real person, so you move the 'is their badge actually pinned to the right place' check to the start of the line, before they waste your resources. Yes, a few of them will actually have badges, in the right place...made of paper with scribbles on it, which you will detect when they try to use it. But many of them can't even cobble together a damn badge at all, and almost all of the ones that do will have it in the most common upper left, and you can automatically throw them out of line and they can go bother other security checkpoints.

      And then you still run everyone through a proper security checkpoint, which is easily and cheaper now that crackheads aren't wasting your resources.

      --
      If corporations are people, aren't stockholders guilty of slavery?
    22. Re:Move to a higher order port and use denyhosts by DavidTC · · Score: 1

      Let me amend that last sentence:

      And then you still run everyone through a proper security checkpoint, which is easily and cheaper now that crackheads aren't wasting your resources....and you can now see who's attacking you specifically. They're the ones who spent time learning to get past the sanity check. Those people, unlike all the idiotic automated kiddies, are actually dangerous, so watch them.

      --
      If corporations are people, aren't stockholders guilty of slavery?
  21. Keys... by Anonymous Coward · · Score: 0

    Key-based authentication is really what you need. If your situation doesn't allow for key-based auth, Fail2Ban can help reduce brute-force attempts for password-based auth, and allowing connections from specific IPs, if possible, can heighten security quite nicely.

  22. BlockHosts by psychosis · · Score: 2, Informative

    We started using BlockHosts to feed iptables rules, and our failure logs went from 30-50k per day to 100. Basically, with more than 'x' failed logins within 'y' time frame, the source IP is blocked for 'z' time period. Since it uses iptables, you could block it from just the ssh port, or the entire system (we do the latter).
    All three variables are configurable, and we also have whitelisted a few select standby IPs for contingency use. (As another poster said, you **will** lock yourself out eventually.)

    1. Re:BlockHosts by Anonymous Coward · · Score: 0

      you wont lock yourself out if you only allow key access.

    2. Re:BlockHosts by Thumper_SVX · · Score: 1

      Seconded on Blockhosts. Had the exact same problem, exact same results. Nowadays my average is about 200 blocked IP's, and I run the script every 15 minutes. I also use certificate auth only so the password problem really is a non-problem. In the event I need to get in to download a cert to a new machine (if I don't have my USB key on me that has the cert already there), I also have an IPSec VPN tunnel set up that's a piece of cake to connect up. The VPN is handled by its own hardware firewall (a Sonicwall Pro 2040), and I allow password auth only from the internal subnet on the back side of the firewall.

      In 4 years of running sites on that server, the only successful hack I've ever had was because of a problem with an application hosted on the site. That application was removed pretty rapidly, and the only real impact was that all of a sudden I got people telling me that people couldn't get to their site because there were hidden links that were dead or slow on the served up pages.

      HTH

  23. Re:whatcouldposiblygowrong by jo_ham · · Score: 4, Funny

    He could get trolled on slashdot by the very people he's coming to ask for help to become *less* of a noob.

    I'll bet you teach your kid gun safety by shooting him in the neck.

  24. Throttle Inbound Connections by Padrino121 · · Score: 5, Informative

    I have a similar situation and cannot limit to very specific IP ranges. I have done the following with good success. I pulled some examples from my configuration that can be tweaked for yours if you like.

    1. Limit incoming SSH attempts to a low number. In my case I limit to 2 connections in 60 seconds. I can tighten it even more but this did a lot to kill brute force attempts.
    iptables -I INPUT -p tcp -i vlan1 --dport 2242 -j DROP
    iptables -I INPUT -p tcp -i vlan1 --dport 2242 -m state --state NEW -m limit --limit 2/min -j ACCEPT
    iptables -I INPUT -p tcp -i vlan1 --dport 2242 -m state --state RELATED,ESTABLISHED -j ACCEPT

    2. Automatic blacklist via DenyHosts. This helps cut down attempts from known ranges without even giving them the chance even at a slow rate. http://denyhosts.sourceforge.net/

    1. Re:Throttle Inbound Connections by ndege · · Score: 1

      Dude! Lemme guess....your "secret" non-standard ssh port is 2242. ;)

      don't worry, you secret is safe with us!

      All joking aside, thanks for posting the iptables rules! I plan to add these rules in addition to fail2ban, ssh riding on a high-port, and certificate based authentication...oh, and direct root logins are also not permitted on my boxen. Long live su/sudo

      --
      Sig Return: 204 No Content
    2. Re:Throttle Inbound Connections by Anonymous Coward · · Score: 0

      This is a recipe for DoS.

    3. Re:Throttle Inbound Connections by Padrino121 · · Score: 1

      Actually the port was changed before posting to protect the innocent :). Sounds like you have a good combination of tools that will significantly limit your SSH attack vectors.

  25. An iptables recipie by Simon+Carr · · Score: 4, Insightful

    -A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name SSH --rsource -j ACCEPT
    -A INPUT -p tcp -m tcp --dport 22 -m recent --update --seconds 60 --hitcount 8 --rttl --name SSH --rsource -j LOG --log-prefix "SSH_brute_force "
    -A INPUT -p tcp -m tcp --dport 22 -m recent --update --seconds 60 --hitcount 8 --rttl --name SSH --rsource -j DROP

    Stops 'em *somewhat* dead. If you want to whitelist hosts so they are not impacted by this rule, just add;

    -A INPUT -s your.ip.address -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT

    Before the throttling ruleset.

    --
    -- The unsig...
    1. Re:An iptables recipie by Necroman · · Score: 1

      Yup, this drastically cut down the brute force on my server.

      --
      Its not what it is, its something else.
    2. Re:An iptables recipie by NotQuiteReal · · Score: 1

      That's too much typing. My mom wants a GUI for that.

      --
      This issue is a bit more complicated than you think.
    3. Re:An iptables recipie by cynyr · · Score: 1
      --
      All of the above was encrypted with a Quad ROT-13 method. Unauthorized decryption is in violation of the DMCA.
  26. fail2ban by EvilIdler · · Score: 1

    http://www.fail2ban.org/wiki/index.php/Main_Page

    That should cover automatic banning of repeat offenders. It works by reading logs, so it can work with many services. You could for example make it block all those attempting to exploit your CMSes.

  27. OpenBSD PF by roman_mir · · Score: 3, Insightful

    #SSH
    pass in inet proto tcp from any to $ext_if port ssh
    pass out inet proto tcp from any to $ext_if port ssh
    pass quick proto tcp from any to $ext_if port ssh \
            flags S/SA keep state \
            (max-src-conn 15, max-src-conn-rate 5/3, \
              overload <bruteforce> flush global)

    you know what I am saying?

    1. Re:OpenBSD PF by Anonymous Coward · · Score: 0

      Nice.

    2. Re:OpenBSD PF by funkboy · · Score: 1

      The tutorial that explains what all this does is here. They've also added a nice feature called expiretables that keeps the "bruteforce" table small & efficient by expiring entries that haven't seen any hits after a definable period of time.

      FWIW, there's also an entry in the official PF FAQ on this...

    3. Re:OpenBSD PF by badger.foo · · Score: 1

      They've also added a nice feature called expiretables that keeps the "bruteforce" table small & efficient by expiring entries that haven't seen any hits after a definable period of time.

      FWIW, there's also an entry in the official PF FAQ on this...

      Thanks for mentioning the tuturial, but actually expiretable is no longer necessary. On anything with PF equal to OpenBSD 4.1 or newer a simple

      pfctl -t bruteforce -T expire 86400

      will expire table entries that have not had their statistics updated for the last 24 hours (86400 seconds)

      I really should reverse the sequence at that page. expiretable likely still works, but it is no longer necessary to install a separate package to get table expiry.

      --
      -- That grumpy BSD guy - http://bsdly.blogspot.com/
    4. Re:OpenBSD PF by dissy · · Score: 1

      you know what I am saying?

      You down with BSD, yea you know me?

      (Sorry, sorry...)

  28. pam_abl by otis+wildflower · · Score: 2, Interesting
  29. Re:whatcouldposiblygowrong by NNKK · · Score: 2, Insightful

    If somebody tries to perform surgery without a proper medical education, do you offer pointers, or do you tell them to drop the knife and find a real surgeon?

    Companies running public-facing servers without good technical expertise are a menace.

  30. I don't understand the problem by dingen · · Score: 2, Interesting

    So there have been a million failed attempts to log in over SSH in a year. That's about one failed attempt every 30 seconds.

    What's wrong with that? It's not like they're getting in, right?

    --
    Pretty good is actually pretty bad.
    1. Re:I don't understand the problem by egcagrac0 · · Score: 1

      Right... If someone was standing at the door of your house for a year, trying to pick the lock, you'd just let them keep trying until they opened it? I mean, it's not like they're getting in, right?

    2. Re:I don't understand the problem by Anonymous Coward · · Score: 0

      If you trust your lock, then yes, letting them keep trying is what you should do. Anything else you do will demand some effort and lead to the same result (they can't get in).

    3. Re:I don't understand the problem by thegrassyknowl · · Score: 1

      What's wrong with that? It's not like they're getting in, right?

      It's not like he'd know if they were getting in - a sufficiently good attacker will cover their tracks pretty well. Not knowing the basics of securing SSH (and being a self-confessed n00b) really makes one a n00b. I'd hazard a guess that a n00b isn't capable of the forensic analysis needed to actually work out if someone did get in.

      --
      I drink to make other people interesting!
    4. Re:I don't understand the problem by turing_m · · Score: 1

      Right... If someone was standing at the door of your house for a year, trying to pick the lock, you'd just let them keep trying until they opened it?

      Bad analogy. Picking most locks is fairly easy - there are video tutorials on the net to show you how to do it. If you let them there for an hour, they will probably get in if it's a typical lock. If you have at least a random 8 digit lowercase password, it will take 200,000 years for them to "pick" the lock.

      The other thing, comparing your front door to an internet facing ssh server - where do you live, Johannesburg?

      --
      If I have seen further it is by stealing the Intellectual Property of giants.
    5. Re:I don't understand the problem by dingen · · Score: 1

      Dude, it's the internet. There's going to be people at your door all the time. As long as your lock is in order, there's nothing to worry about.

      --
      Pretty good is actually pretty bad.
    6. Re:I don't understand the problem by egcagrac0 · · Score: 1

      It is the internet. Still, showing them that there's someone watching and encouraging them to move along isn't a terrible idea. (I'd love to hear the counterpoint - 'yes! let them try to break into my system.' - what's your reasoning? How could that possibly be a good thing?)

      If you stop letting them try to break in, their 200,000 years takes a lot longer.

  31. That grumpy BSD guy by the_brobdingnagian · · Score: 1

    Peter N. M. Hansteen has written a nice article about a similar atack. http://bsdly.blogspot.com/2009/11/rickrolled-get-ready-for-hail-mary.html The first thing I would do (at install time) is to disable root login over ssh.

    1. Re:That grumpy BSD guy by Korin43 · · Score: 1

      +1 to disabling root login. I use my first name as a user name, and it's a common-ish name, but in the entire time I've had a VPS (a year and a half or so), I've never had an ssh attempt even use my correct name. It's kind of hard to break a password when you don't even know the use name.

  32. Denyhosts by Anonymous Coward · · Score: 0

    We use denyhosts on our production servers. Works like a charm. Just make sure you have an alternate ip to log on from in case you lock yourself out.

  33. OSSEC is what I use by loftwyr · · Score: 1

    OSSEC is what I've been using for years and it works well. IT's much more comprehensive a security package than fail2ban but uses log monitoring as it's basis.

    It's worth a look.

  34. Easy by Beached · · Score: 1

    Change the port and use private certificates for authentication.

    However, changing the port to something will get the bots off your back. They still don't try other ports.

    --
    ---- aut viam inveniam aut faciam
  35. Limiting SSH Access by sabaisabai · · Score: 1

    Change the default port, disable SSH access for root, disable password access entirely (login with public keys), install fcheck to monitor changed files and hence intrusions. If you have the luxury, remove SSH access entirely from your web server and block everything but ports 80 and 443, and enter via another server behind the same firewall. As a nOOb, I gained quite a lot from following this Hardening Linux Web Servers guide: http://www.freesoftwaremagazine.com/articles/hardening_linux

  36. Change ports by PhunkySchtuff · · Score: 1

    Although the solutions like fail2ban and denyhosts are undeniably useful, you will cut down well over 90% of the drive-by ssh attempts by simply changing the port.

    None of the scripts, that I'm aware of, actually portscan your machine looking for the SSH login headers, they all hit port 22 and try to log in. It takes too long to scan a machine so if nothing is listening on port 22, they will move on.

    You will still get the odd attempt from someone who has portscanned you - these will be relatively rare. In these cases simply disable password logins altogether and use the public key authentication that is a LOT more secure (and convenient once it's all set up) anyway.

    1. Re:Change ports by Abcd1234 · · Score: 2, Interesting

      I actually go one step further: after IPv6-enabling my site, I only allow v6 ssh inbound. Since Teredo makes it possible to get v6 from nearly anywhere, it doesn't cause any inconvenience, and ssh attacks have basically vanished. 'course, it won't last forever, but it works great right now.

  37. Enforce RSA keys and disable passwords by pestilence669 · · Score: 1

    RSA keys are notoriously time intensive to brute-force. As far as I know, no one is crazy enough to automate an attack. If you disable password authentication altogether, you eliminate your risk of an automated dictionary attack. It might confuse the hell out of some users, which is a con.

  38. solution by unix_geek_512 · · Score: 1

    --dport 22 -i DROP

    Use a high SSH port and allow logins from two static IPs -j DROP everything else.

    Hire me to fix the rest ;)

  39. Change port by Anonymous Coward · · Score: 0

    This is pretty common stuff trying random SSH logins on public facing servers, at least for me - just change the SSH port and have strong SSH passwords - that's all I do and stops it dead.

    If you are really worried, firewall/iptables to fixed IP addresses.

  40. Okay by mindstrm · · Score: 1

    First..... 1 million password *failures* is not a security problem by itself. They're supposed to fail if they don't have the right password.

    So - moving this to a more obscure port will definitely cut down on the automated scanning.. but it's not really the heart of the issue.

    The heart of the issue is that it took you so long to realize someone was even doing this. That probably boils down to your running a business requiring sysadmin work without a sysadmin.

    There are lots and lots of ways to approach this, some of which people have touched on already.

    1) You need awareness of what's going on - daily log analysis. OSSEC is neat, give it a shot.
    2) Moving SSH to a weird port is something some people do - I don't prefer that - it buys some obscurity and cuts down on some scanning, but doesn't address any real security issues.
    3) OSSEC in active mode with a whitelist so you don't block out legitimate users - works pretty well.
    4) Hire someone to deal with security/deployment/backups/recovery/service providers (sysadmin?)

  41. Security through Obscurity, sortof by Seriman · · Score: 1

    Obviously the port change idea is unpopular because it's just obscurity, which != security. However, most, of not all, of those attempts are probably from scripts rather than actual human attackers actively attempting to compromise your servers. The script kiddies rely on automation to rapidly find vulnerable hosts using easily-scripted vulnerabilities or brute force. The simple act of changing your ssh port will render those kinds of attacks useless against you. I had a similar scenario where my logs were full of failed ssh attempts and by changing the ssh port, they all stopped. ALL OF THEM. I haven't had an unknown IP attempt to log in via SSH in around five years. fail2ban, strong passwords, or whatever additional security you want to apply is great, and recommended, but a port change will solve more of the problem than you might think.

  42. Re:whatcouldposiblygowrong by Anonymous Coward · · Score: 0

    That's a hell of a lot better than some "l33t h$ck3r" who does not know his ass from a whole in the ground. I will take the "noob" any day. They at least show an open mind and admit their weaknesses.

  43. VPN for SSH by Anonymous Coward · · Score: 0

    I've used ISPs that provided separate VPN access for protected ports such as SSH, so you only had to open HTTP to the public. But seriously, there options such as port knockers and the like. Of course, if they are actively managing, they could try to have a firewall that automatically filtered obvious break in attempts.

  44. Working as intended. by Schraegstrichpunkt · · Score: 1
    • Protocol 2
    • Set PermitRootLogin to "no" or "without-password"
    • ChallengeResponseAuthentication no
    • PasswordAuthentication no

    And then just ignore the attempts. fail2ban can sometimes be ok, but be aware that it creates a denial-of-service vulnerability that is exploitable by attackers who can can spoof source addresses.

    1. Re:Working as intended. by MichaelSmith · · Score: 1

      fail2ban can sometimes be ok, but be aware that it creates a denial-of-service vulnerability that is exploitable by attackers who can can spoof source addresses.

      Yeah my server went off line a week ago and while debugging the problem I noticed the kernel complaining at startup that a file included from my pf configuration was corrupt. Its a script I wrote which updates that file, not fail2ban. The file was my blocked hosts table.

      So from now on I am just going to put up with the dictionary attacks.

  45. Re:whatcouldposiblygowrong by jo_ham · · Score: 1

    Then the answer to the question is the link to someone who can provide that.

    I doubt the responses would have been quite so hostile if the topic had been car repair - poorly maintained vehicles are a menace on the roads!

    The answer does not necessarily have to be "here is what you do" - it can be "find someone who knows what they are doing". Trolling him is not likely to create any positive effect, except among the already insular server admin clique. Save the "oh my god, so this noob totally connected a 54-50 to a 35-27 with no logging!" drinking stories for the bar.

  46. Okay... seriously..... by Anonymous Coward · · Score: 0

    "Earlier today I was researching some problems on one of our sites and found that there have been over 1 million SSH authentication failures from ~1200 IP addresses on one of our servers over the last year."

    What's to cope with? This isn't a problem - this is the internet. Unless servers were actually breached, or it's actually costing you money - why do you care? If your password practices are solid as you say - you should be fine.

    People attempting to log in is not a security issue - people logging in is.

    How do you manage server security with no system admin? Either pay the extra money for managed hosting where they do this for you, or hire someone to do it for you on staff. If those aren't viable - change your business plan (I mean, your business plan involves administering servers - somewhere along the way you made a decision that administering them yourself was the way to go for your business..... so why would you not hire a sysadmin?)

  47. Re:whatcouldposiblygowrong by dintech · · Score: 4, Insightful

    That's a beautiful and witty analogy but to reverse it:

    If he asked "How can I stop my house being burgled?" and you said, "Without a full alarm, CCTV and patrol system, don't even bother. Leave it to the professionals."

    Some others might see some practical value in suggesting, "Maybe lock your door at night."

    My opinion in this situation is first to take what advice you can and do something yourself as soon as possible (since any extra security is better than nothing). Next, as you suggested and when he has the resources to employ someone to do it properly, seek professional help. Simply doing nothing until he can do it properly sounds a bit dangerous.

  48. It happens. Deal with it. by IGnatius+T+Foobar · · Score: 1

    I hate to sound unsympathetic here, but the Internet is a hostile place. If you have port 22 open to the world, you should expect to get pummelled with password cracking attempts more or less constantly.

    Either learn to live with it, or at least take some steps to slow them down. I find that throttling back the number of connections any one IP address can make in a short time pretty much slows it down to a reasonable level. Alternatively, you can also put some "trap" logins on your system. Usernames like "admin" or "oracle" with the password set to the same as the username are good. When the login succeeds, you immediately drop the connection and lock the source IP address out using iptables.

    Unless it's really causing a lot of pain, though, please don't harass the ISP from which the connection is originating. You're just going to make some overworked sysadmin's day a little more unpleasant. Chances are, they're already doing everything they can to keep rogues off their network.

    --
    Tired of FB/Google censorship? Visit UNCENSORED!
  49. Re:whatcouldposiblygowrong by asdf7890 · · Score: 1

    what could go wrong?

    Lots.

    worst case scenario?

    Depends how realistic we are being with our range of possible scenarios.

    Worst not-ridiculously-unlikely case: ill configured service, service minus important patches, or poorly chosen authentication/privilege setup, or something similar, allows an automated hack in and therefore the server becomes yet another bot in the net or possibly even a C&C box for the botnet.

    A zombied server is usually more trouble for the rest of the 'net then a zombied home machine because they generally have access to better bandwidth resources and are more likely to be openly connectible from the outside world so can more easily be used to host services such as phishing websites or a botnet C&C relay.

    There is also the potential loss/damage to the information in the server itself to consider. If a "noob" admin is running the server then it is not unlikely that the services and data held on the server are not adequately backed up.

  50. Re:whatcouldposiblygowrong by obarthelemy · · Score: 2, Insightful

    Since it seems to have escaped your attention, I'd like to point out the fact that unqualified surgeons can (will ?) kill people; unqualified admins won't.

    Which seems to be a somewhat relevant matter.

    --
    The Cloud - because you don't care if your apps and data are up in the air.
  51. Port Knocking by chriswaco · · Score: 1
    1. Re:Port Knocking by zoid.com · · Score: 1

      Yep.. Port knocking is a great low budget solution to this.

    2. Re:Port Knocking by mprinkey · · Score: 1

      http://cipherdyne.org/fwknop/

      This was posted above. It accomplishes the same goal as port knocking, but removes all of the timing issues and replay attack vectors. All of the communication is cryptographically signed and encrypted and done via a closed port.

    3. Re:Port Knocking by Anonymous Coward · · Score: 0

      but the code is bigger than the simplest possible port knocking service and thus harder to audit.

      "the main fwknop daemon is written in perl"

      and you need specialised client.

      other than that, it looks pretty cool!

  52. Re:whatcouldposiblygowrong by Anonymous Coward · · Score: 0

    I'd tell them to wait a minute, then run and grab a video camera. But that might not work with the analogy...

  53. I love it! by Bananatree3 · · Score: 1

    You are making them work for their attempt. Soon, you're servers are just too expensive time wise to make it a worthwhile investment.

  54. Do nothing by dmiller · · Score: 1

    If you are randomly generating your passwords and they are of a decent length then you don't really need to do anything. If your passwords contain lower-case letters only (not recommended), but are eight characters long then your million authentication attempts would represent only a 0.0005% chance of success. If you passwords contain numbers and upper-case characters too, then the likelihood is 1000 times less.

    1. Re:Do nothing by muckracer · · Score: 1

      > If your passwords contain lower-case letters only (not recommended)

      I like lower-case character passwords actually. Contrary to widespread opinion it's the length that matters, not the width. ;-)

  55. Re:whatcouldposiblygowrong by darkpixel2k · · Score: 0, Offtopic

    He could get trolled on slashdot by the very people he's coming to ask for help to become *less* of a noob.

    I'll bet you teach your kid gun safety by shooting him in the neck.

    LMAO! Where are my mod points?

    --
    There's no place like ::1 (I've completed my transition to IPv6)
  56. Wrong security concern. by Vellmont · · Score: 1


    I own a small Web development studio that specializes in open source software, primarily Drupal, WordPress, and Joomla

    Right off the bat, you're far too focused on the security of least concern, ssh. Unless you set an idiotic password, it's not going to be guessed. It sounds like you have that covered.

    But.. the part you've missed is your FAR more vulnerable applications. You say your ISP is "actively managing" your security, but how certain are you they're doing a decent job of it? Do they have experts in each of these different CMS systems?

    If you're serious about security, find experts to manage the security settings and versions of each of your chosen applications. I know for a fact that Joomla has historically had some issues with it. The others you mentioned wouldn't be terribly surprising to find problems as well. We're not talking a lot of money here. A good price would be in the neighborhood of $200 per application/site for an assessment of your configuration. Look for people that are reputable, not some fly-by-night "I know all applications" joker who just runs a security scanner and charges you $200.

    And no, scanners aren't going to replace expert human beings that know what to look for.

    --
    AccountKiller
  57. Ignore it by lisany · · Score: 1

    Just ignore it.

  58. Good methods by hmmdar · · Score: 1

    A good method would be to configure your iptables to drop all packets that come in from a new connection on all ports by default, and only allow through the specific ports you want the outside world to have access to. It is also an extremely good idea to move the ssh port higher than 5k. With the right iptable rules you can configure your system to ignore repeat attacks at the kernel level. And for the love of all that is good do not use passwords use key auth only, and disable root ssh login.

  59. Re:whatcouldposiblygowrong by bigsteve@dstc · · Score: 1

    Some others might see some practical value in suggesting, "Maybe lock your door at night."

    The problem is there is no simple laymans advice like that that would solve his problem. He needs someone to fit new locks to his doors, etc not just turn the key in the door.

  60. apply patches fastidiously by sneakyimp · · Score: 1

    Somebody might want to check my math here...my stats are a bit rusty

    Ok let's assume a few things:
    1) your passwords are 8 chars long and use upper and lowercase alpha and numbers only
    2) they are essentially random passwords that are NOT in the dictionary.

    This would mean that there are 2^62 possible passwords in your password space. That's 4,611,686,018,427,387,904 possible passwords. The chances of guessing one password in that space within a million random tries is 1,000,000/4,611,686,018,427,387,904. That's about one chance in 4,611,686,018,427. I believe that one in 4.5 trillion is about as remote a possibility as you getting struck by a meteor.

    I think it's much more likely that someone will exploit a buffer overflow or sql injection vulnerability on your servers than someone guessing a password. You should make sure that you've applied whatever patches that you can and that any sensitive data traveling to or from your servers is encrypted.

    I also like the iptables suggestion -- this means your machine will ignore entire regions of the internet so your server's exposure is at least limited to friendly subnets.

    Another useful technique is to prohibit root access to SSH on initial login. This means that everyone has to login with some other username before they can acquire root privileges. For hackers, this means guessing not just a password but also a username that is allowed to login via SSH on the machine.

  61. the web is new by circletimessquare · · Score: 1

    when surgery was first performed, anyone could and did do it

    to much suffering, yes

    but you can't expect the regimented laws and well-established protocols of long experience with a brand new technology

    and yes, the internet is STILL brand new technology

    we are only beginning to see standards and laws and social changes from its appearance

    as well as further technological change

    you can't expect the standards you are asking for

    --
    intellectual property law is philosophically incoherent. it is your moral duty to ignore it or sabotage it
    1. Re:the web is new by NNKK · · Score: 1

      The web is nearly twenty years old, the internet as we know it thirty, Unix forty. How long does it have to be, exactly, before you realize that there are plenty of people out there who are experts (or reasonable facsimiles thereof) in its practical operation?

    2. Re:the web is new by colonelquesadilla · · Score: 1

      Knives and gangrene are a lot older.

      --
      It's either false dichotomies, or the terrorists win, you decide.
    3. Re:the web is new by node+3 · · Score: 1

      I think you are severely underestimating the amount of education and training that goes into becoming a doctor. Becoming a sysadmin, even a highly qualified one, is *vastly* simpler.

    4. Re:the web is new by NNKK · · Score: 1

      Did you even read what I was responding to? Assuming for the sake of argument that you're right (and you're not, entirely), you're just making my point for me.

      If the problem is that the Internet is vastly younger than humanity, then the fact that it's "vastly simpler" to become a competent sysadmin should compensate appropriately, and companies should thus be able to go find someone competent to run their servers, rather than relying on a self-described "n00b" owner.

    5. Re:the web is new by badran · · Score: 1

      You cannot possibly compare a SysAdmin to a Doc.... a SysAdmin is more like a junior nurse...

    6. Re:the web is new by jon3k · · Score: 1

      Not entirely true. First of all "highly qualified" doesn't mean "good". It just means possibly a degree and paper certificates. To be an exceptional system admin takes 4+ years in college and 20+ years of practical experience and being an exceptionally bright individual. To be a surgeon just requires an 8 year medical degree. To be an exceptional surgeon I would assume requires a rare natural gift and/or a lifetime of work. But we're not arguing great doctor vs great system administrator.

    7. Re:the web is new by emilper · · Score: 1

      The web is nearly twenty years old, the internet as we know it thirty, Unix forty. How long does it have to be, exactly, before you realize that there are plenty of people out there who are experts (or reasonable facsimiles thereof) in its practical operation?

      Experts in what ? The fundamentals maybe did not change much ... maybe ... but the actual software and hardware that's used does not look much like whatever was used on the "internet" thirty years ago ... Medical practice was a controlled occupation even when blood-letting was considered high-tech, but at that time even to be a lumberjack or to serve drinks in a public house one had to pass exams and pay fees.

    8. Re:the web is new by The+End+Of+Days · · Score: 1

      I don't know why Malda doesn't just rename this section "Ridicule Me" since that's what a large number of you folks seem to think it means.

  62. Simples solution: Port knocking. by Hurricane78 · · Score: 1

    That should keep the CPU usage down, and your system secure from that type of attack. You can’t do much more than that.

    You could run a script to find the owner of all those IPs... maybe do a bit of statistics to see what you can find out... But in the end it will be someone that you can not sue or contact in any way anyway.

    --
    Any sufficiently advanced intelligence is indistinguishable from stupidity.
  63. Denyhosts by someguysomewhere · · Score: 1

    I use 'denyhosts' which actively monitors and blacklists based on failed login attempts. I usually set it to ban anyone that tries to login as root more than once since root logins are disabled anyway no one should be trying that. And to ban anyone trying to login as an unknown user. Valid users are allowed a lot more leeway, 10 retries I think.

  64. drop the requests by Anonymous Coward · · Score: 0

    use an ACL to drop all traffic from Africa, Russia and China... problem solved

  65. hashlimit by suso · · Score: 4, Informative

    You can also use the hashlimit module for iptables. I find it works pretty well for allowing people in who need to access and block things like the ssh worm that was causing ssh to run out of resources.

    You might check out the end of this presentation that I made 4 years ago.

    http://www.bloomingtonlinux.org/wiki/15th_meeting

    I've been using hashlimit successfully for years in a web hosting environment.

    I'd also recommend hiring someone who focuses their efforts on managing the servers and taking care of network security. This job is usually referred to as a system administrator or network administrator. DOH!

    1. Re:hashlimit by JWSmythe · · Score: 2, Insightful

      I'd also recommend hiring someone who focuses their efforts on managing the servers and taking care of network security. This job is usually referred to as a system administrator or network administrator.

          That's probably the most relevant thing I've seen. I'm amazed at how many places don't want or have people with a clue working on their equipment. TFA said they have *NO* sys/net admin, and the guy who attends to those task is a "n00b".

          There's more than one way to address this (which plenty of us have mentioned), but the important part is to have someone on staff who actually knows what they're doing.

          I had someone ask me the same thing a while back. It wasn't tallied over a year, but it was something like 10,000 connections from China to SSH on port 22 in an hour. They were all unsuccessful. I gave a few options. Move SSH. Bring up proper iptables rules (or ANY iptables rules). Put a firewall out front. Set rules in the router to prevent it. Their final decision was .... [drum roll] ... "well, as long as they were unsuccessful, it doesn't matter." That from a group who had a few machines compromised in the past for various reasons.

          Sometimes it doesn't matter if you've given them the best, or even reasonable answers, they'll only hear what they want to.

      --
      Serious? Seriousness is well above my pay grade.
    2. Re:hashlimit by turbidostato · · Score: 2, Insightful

      "I'd also recommend hiring someone who focuses their efforts on managing the servers and taking care of network security. This job is usually referred to as a system administrator or network administrator. DOH!"

      Quite to the point. There's a rising trend on questions like "I'm having problems about X but I prefer being cheap on coping with X, what should I do?". And then there's the rising trend on answering something else than "if you depend on X you'll need to invest on X".

      And now, about the problem at hand: your (his) logs attest thousands of *failed* connection attempts through ssh. In the end... so what? Failed attempts are neither worrying nor in your hand to be avoided (changing your ssh port is the most cost effective remediation measure to maintain bots at a distance). Bellovin already stated quite some years ago (not his exact words, but their meaning): do not monitor on the outer side of your firewall if you are not in the position of avoiding the attacks; all you get will be headaches and a ton of meaningless logs to parse (and probably losing important information among the noise). The verily reason for your firewall to be there is already to maintain the attacks as failed attempts anyway. Do monitor from the inner side. In this case, monitor successful logins, not failed ones.

    3. Re:hashlimit by phoenix321 · · Score: 1

      I rather notice an increasing trend of throwing money at a problem instead of addressing it properly.

      After giving The Management Consultant's answer ("pay for it"), you ironically mentioned the complete solution that is free as in beer to implement and succinct to explain: ignore the fire side of the firewall and concentrate logging on the servers (or the DMZ) it is protecting.

      Which is the best you can do in this regard without having dedicated staff (admins in rotating shifts even) and overly complex blocking scenarios that can can bite you harder than the attacker ever could (DOSing yourself through fail2ban or portknocking that is constantly interrupted by outside attacks).

      Add a fitting real-world metaphor and even management will understand you. What about:

      "You wouldn't monitor the water outside the ship's hull, so start watching the water inside and prepare to act quickly if that happens"

    4. Re:hashlimit by turbidostato · · Score: 1

      "I rather notice an increasing trend of throwing money at a problem instead of addressing it properly."

      Throwing money at it is the proper way to address the problem because the problem here is not the log entries but the lack of network security knowledge on a company that rely on Internet-facing servers to make a living.

      They are critically risking their bussiness by this, so "The Management Consultant's answer" must be "gain that knowledge or affront consequences" and gaining the knowledge is going to involve money (either by hiring a sysadmin, outsourcing the service, educating internal staff...).

      The only question still opened is where the sweet spot (how much money in exchange for how much knowledge) is going to be for their case.

  66. Changing the Port should be just fine by Gypsy2012 · · Score: 1

    Serious, I shifted my port for ssh several years ago. I have yet to see a failed attempt that wasn't a legitimate user who screwed up since I changed. Sure, I know that someone could be port scanning and stuff, but really, I just don't see it happening.

  67. Re:whatcouldposiblygowrong by tpstigers · · Score: 0

    Companies running public-facing servers without good technical expertise are a menace.

    Umm... just out of curiosity: a menace to whom, exactly?

  68. Simplest, bestest by spencertk · · Score: 1

    deadmongrel and PhunkySchtuff have really answered your question the best of all.

    I can't add much to it except for these comments. denyhosts works great and we use a threshold of 1 failure on unknown logins and only 3 failures on known logins. It takes attention to detail as a remote user but it really works well. We set the thing to completely shut out someone who pulls that SSH crap on us, assuming that they are a bad buy. By extension, we use our firewall to log things that shouldn't be happening and tell us about the source IP. Again we assume they are bad guys (or gurls) and simply shut em out forever. Same thing goes for POP3 scans, etc. Hey, there are only a few billion possibilities (in IP4), knock em down and coordinate your data with others to save them time.

  69. restrict access to specific hosts / networks by Anonymous Coward · · Score: 0

    Don't let administrative ports/pages be open to the world on your production environment. If you think you have to (Need to log in to troubleshoot from a hotel etc) you don't.

    Use a development host in an unprivileged network with unprivileged users as a jump host if absolutely needed. Don't store host keys on jump hosts. If you're just on a single host well.. too bad. See above messages about fail2ban alternative ports etc.

    Patch regularly to help prevent local privilege escalation vulnerabilities.

    Disallow remote root ssh logins. Use sudo with as needed command configuration. Use file groups/permissions wisely so users don't need privilege escalation to do their daily work. (777 is not wisely!)

    Disallow shell access for people that only deal with content files. (sftponly for content. nologin for users that need neither file nor shell access)

    And of course use strong passwords.

  70. Locked by default and knocking to open. by Anonymous Coward · · Score: 0

    By defaut, I drop connections on port 22.
    I made a small script which basically waits for a file to be created in /tmp, the file contains one IP. When the file is created, my script opens the 22/tcp port for the specific IP.
    To create the file, I simply load a web page with a browser.
    This is easy and works really great.
    If the webpage were indexed, I just have to move it somewhere else. And even if the port gets opened, it is no big deal...

    The script:
    #!/bin/sh

    FILE_IP=/tmp/unlock
    IPTABLES_RULE=INPUT

    while :
    do
    sleep 1
    [ -f $FILE_IP ] || continue

    IP=`cat $FILE_IP`

    if iptables-save | grep -q $IP
    then
                    sleep 1
    else
                    cat /dev/null 2>&1
                    then
                                    iptables -I $IPTABLES_RULE -s $IP -p tcp --dport 22 -j ACCEPT
                    fi
    fi

    rm $FILE_IP 2>/dev/null

    done

    ------
    The web page (this is bash, but easy to write as php too) :

    #!/bin/sh

    echo Content-type: text/plain
    echo ""
    cat /tmp/unlock
    $REMOTE_ADDR
    END

  71. Those words don't mean what one of you thinks! by Anonymous Coward · · Score: 0

    If there's any difference between "that stuff", and "stuff that!", and I think there is, then maybe he knew what he was saying all along?

  72. 3 steps by unity100 · · Score: 1

    1 - Disable direct root login - allow login only with a wheel user that is allowed to su-

    2 - Use hosts_deny to deny ssh service to any ip other than clients'. you can allow clients' ip ranges in narrow range if they have dynamic ip.

    3 - Change ssh port.

  73. or use portknocking by Anonymous Coward · · Score: 0

    or use portknocking

  74. Re:whatcouldposiblygowrong by Toonol · · Score: 2, Insightful

    In fairness, surgery is WAY MORE FUCKING IMPORTANT than server management.

    People without perspective are a menace.

  75. SOP by Hasai · · Score: 1

    1) Quickest and easiest: Change the port to something oddball.
    2) Slightly harder: Set iptables to only permit SSH sessions from selected domains.
    3) Getting geeky: Kill password authentication and force sshd to use certificates only.
    4) Advanced: Set iptables to DROP IP addresses after three authentication failures within sixty seconds, for sixty seconds.
    5) Paranoid: 2+3.
    6) Very paranoid: 2+3+4.
    7) Go-get-the-guys-in-the-white-suits paranoid: 1+2+3+4.

    #4 is my personal favorite. It only takes about three lines in the iptables settings, and it drives script kiddies crazy when their "leet warez" hang.

    --

    Regards;

    Hasai

  76. I have been seeing... by QuietLagoon · · Score: 1

    ... many, many (dozens per second) SSH probes recently. Make sure your passwords are solid.

  77. ACLs + port knocking by adosch · · Score: 1

    I've seen quite a few posts about using `iptables` (which I'm 100% for and there were some pretty stout ideas that I hadn't thought of myself) however, regardless of running SSH on it's standard service port or picking an alternative, I didn't see a lot of comments about just implementing straight ACL's other on the tcpwrappers level in /etc/hosts.{allow,deny}. Everyone talks about blacklists, but I think it's import to have whitelists as well. A new method I've started to incorporate is a strict ACL whitelist `iptables` custom table along with using a custom port knocking sequence prior to opening up access for a particular window of time.

  78. UFW = FTW by bdinger · · Score: 1

    I second every suggestion to get a hardware firewall, and use VPN if possible. But I know with many large hosting providers, particularly those who specialize in VM's, this isn't an option. I have a couple of VM's through one of those hosts (and I *love* said host), so you have to do the next best thing: some sort of software protection. If you are running Ubuntu, UFW does excellent. I use UFW and allow SSH connections only from two spots - my work IP, and my shell server. My shell server sits in a co-lo behind my PIX, and I VPN into it. I'm kinda weird like that, I'll admit. I have a PIX at home as well. Okay I'm a bit of a freakshow. Anyway, if you aren't running ubuntu, hosts.deny, PKI, and moving SSH to a very high numbered port will *help*. Other than that, contact the hosting provider and see if they will help you on a consulting basis. Remember many of them are running barebones to give you good prices - don't expect too much, and you never know - if you offer they might not even take you up on it. Finally - good luck.

  79. sshdfilter? by MoFoQ · · Score: 1

    you can always use iptables and hashlimit module to limit the number of connections to port 22 as well as using sshdfilter

  80. Basic network security by JWSmythe · · Score: 1

    First, hire someone who knows what they're doing. You just posted to a pool of roughly 1 million technical folks, and at least a couple hundred thousand who know what they're doing. A good percentage of them are unemployed or underemployed right now.

    Changing the SSH port is an excellent idea. Folks scan huge swaths of the Internet looking for ports with services that they expect. Leave SSH on port 22, they'll assume you haven't done much for security and have a chance of exploiting a buggy version or finding an easy password. I knew someone who allowed root logins, with the password of "password" with SSH on port 22. The box was compromised within days.

    These folks generally go for low hanging fruit. Let that be someone else.

    Make your machines invisible. Well, almost invisible. Make them so they won't ping, and won't respond to anything but an authorized request. Tools like nmap default to ICMP pings first, and then will follow up with a detailed port scan. If you have high visibility sites, you'll still get curious people who look hard to find something. Make it impossible for them to get to anything sensitive.

    Set up iptables (or the firewall applicable for your platform) is essential for security. Here's a little script that I used for a long time. Networks and some ports have been modified to protect the guilty^H^H^H^H^H^H innocent. This script is for Linux. It may require modification for your platform. The general idea will apply to any *nix platform. Modify as necessary. I had an ipchains version, but that was retired long ago. You may want to add to your enemies list (in the code below) automatically based on some honeypot services. Maybe code up a little something as an inetd process that simply appends their IP to enemies.list (and distributes to your peers) if someone tries to SSH in on port 22. Use that with caution though. It's a shame when you lock out yourself accidentally.

    You could either start DROP rules on the fly, or work up the list automagically and have this script rerun at an interval (every 5 minutes, ever hour, every week, whatever suits your tastes).

    #!/usr/bin/perl
    # rc.firewall
    # secure yer webserver
    # (c) 2010 - JWSmythe
    # Free to reproduce and modify with attribution.

    # Publicly accessible ports. These are any ports you want the general public to hit.
    @pub_ports = (
    "80", # HTTP
    "443", # HTTPS
    "8080" # Streaming something
    );

    # These are private ports. Only our private_net users. Any other ports will be completely inaccessible.
    @private_ports = (
    "22222", # Our SSH port
    "33066" # Our DB port
    );

    # Permitted Networks/Hosts.
    # Use / subnet notation
    # Use the smallest subnet possible.

    @private_net = (
    "192.168.1.0/24", # Where our servers are
    "198.81.129.0/24", # Another companion network
    "63.97.94.0/24", # Someone else that works with us.
    "216.34.181.45", # home
    );

    # These are known enemies. You can collect these
    $enemy_list = "/etc/firewall/enemies.list";

    #
    # Normally you won't modify beyond here.
    #

    --
    Serious? Seriousness is well above my pay grade.
  81. Re:whatcouldposiblygowrong by Restil · · Score: 1

    I think the point here is that the server is supposed to be "managed" already. He already understands that he's too n00b to properly handle the problem. What he IS requesting is any additional advice for simple activities or procedures that might help to improve the security and are within his abilities to implement on his own.

    He's not asking how to perform surgery.. He's asking for advice on the proper way to apply a bandage.

    --
    Play with my webcams and lights here
  82. Many ways by X.25 · · Score: 1

    Change port. Believe it or not, it does help enourmously - I didn't beleive it, but then I've done it for shits and giggles, I haven't had a single brute force attempt on my server.

    Also, use sshdfilter (or fail2ban, etc).

    Those 2 will take care of most SSH brute force attacks.

    And if you don't want any SSH brute force attacks on your server, use public key authentication.

  83. Stateless access controls, preferably in hardware by Anonymous Coward · · Score: 0

    Whether you implement access controls in a stateless firewall appliance or server side with iptables, you will need to accept some measure of responsibility for the security of your infrastructure at some point. Additional access controls can be introduced through SSH daemon configuration, for example by restricting access to specific users or groups. Tcpwrappers can also provide an additional layer of protection.

  84. change port - disregard all other posts by Anonymous Coward · · Score: 0

    it's simple, change your port. all you're looking for is to relieve some of the bot login attempts to your ssh server. it's not a security measure, it's a simply a annoyance measure. bots don't have the time to search for ssh service on other ports, and if one did, so what, let it try to brute force, your server is no less secure on another port but will have several million fewer log lines.

  85. knockd by Anonymous Coward · · Score: 0

    Set up knockd:
    http://www.zeroflux.org/projects/knock

    Port knocking took my web servers from millions of failed attempts per month to zero.

  86. Nothing. by Alex+Belits · · Score: 1

    Computer security can not be achieved by responding to attacks. It's achieved by not being vulnerable to them.

    Attacks may happen at any moment, and may target anything -- nothing that happened in the past can predict what might happen in the future considering that any host on the Internet can talk to your server. The amount of connection would matter if it is high enough to produce a DoS attack or number of attempt is so high, a brute force password guessing becomes viable. You are so far from both, pretty much any action you can perform would DECREASE the security because attackers might find a way to turn it against you. For example, if you block a host that tried to establish too many connections, they may try to spoof your host, so you will end up locking yourself out.

    --
    Contrary to the popular belief, there indeed is no God.
  87. Re:whatcouldposiblygowrong by NNKK · · Score: 1

    Practically speaking, it really isn't different.

    The surgeon who kills someone might, if the victim's family is very lucky, be assessed damages of a couple million. An idiot with a cracked server farm can easily cause that much damage on the net.

  88. Re:whatcouldposiblygowrong by NNKK · · Score: 1, Insightful

    To whom, exactly, is it more important?

    Society places economic value on everything, and the amount of damage a cracked server farm can potentially do far outstrips the economic value of a human life.

  89. two-factor authentication by Anonymous Coward · · Score: 0

    http://en.wikipedia.org/wiki/Two-factor_authentication

  90. Use sshutout by 2ndRateSoul · · Score: 1

    This works great for reducing the effectiveness of dictionary attacks:

    http://freshmeat.net/projects/sshutout

    1. Re:Use sshutout by Kymermosst · · Score: 1

      Totally agree. I've been using it for a couple of years now and it's fantastic.

      --
      "Alcohol, Tobacco, Firearms, and Explosives" should be a convenience store, not a government agency.
  91. Security for n00bs by mstrebe · · Score: 1

    How do you manage security if you're a n00b? Only you can manage your security. Only you care enough to do the work.

    Start reading. And FAST!

    --
    aka Matthew at SlashNOT/!
  92. Re:whatcouldposiblygowrong by node+3 · · Score: 2, Insightful

    Practically speaking, it really isn't different.

    The surgeon who kills someone might, if the victim's family is very lucky, be assessed damages of a couple million. An idiot with a cracked server farm can easily cause that much damage on the net.

    WTF? In one case, a web server has been vandalized. In the other, a person is dead.

  93. fail2ban by cigawoot · · Score: 1


    I know a lot of people have suggested fail2ban, and its a great solution that's easy to implement. The best part is it uses sendmail to mail logs to the root user about brute-force attempts. This is mainly for my curiosity.

    The big thing is the ban timer on fail2ban doesn't need to be very long. The ban can be as short as 2-3 minutes and still get the message across. Once they realize they're disconnected, they'll go elsewhere. It'll slow them down enough that brute forcing ssh isn't practical anymore, usually at that point they'll move on to another host.
    An easier solution is to just use public-key authentication though, there are plenty of articles out there that deal with this.

    Really, just all the spam in my logs to be amusing. I had someone use a web scanner on my box, and after it was done and found nothing of interest, it made a request for /fuckingshitnonexistant.php, which of course 404'd.

  94. Re:whatcouldposiblygowrong by node+3 · · Score: 4, Funny

    Society places economic value on everything, and the amount of damage a cracked server farm can potentially do far outstrips the economic value of a human life.

    You forgot to start that sentence with, "you might be a psychopath if..."

  95. Another Buffer.. blockAPNIC by FlyingGuy · · Score: 1

    Google for it. It is a pretty up to date list of all the undesirable IP ranges and your attempts will go way down.

    Most recently they added 1.0.0.0 :)

    --
    Hey KID! Yeah you, get the fuck off my lawn!
  96. Learn firewall and security by Sudheer_BV · · Score: 1

    Learn iptables. There are many good books available covering iptables and server security topics.

    --
    Sudheer Satyanarayana
    www.techchorus.net
  97. Re:whatcouldposiblygowrong by NNKK · · Score: 1

    No, a web server has been cracked and turned to spamming, DDoS, and cracking of other servers, causing immense financial damage to other companies.

    And we're not talking about the happy-go-lucky land of every-life-is-precious or the insufferable "if even one child is saved..." fantasies, we're in the real world, and in the real world, the economic damage to be wrought from a single company's negligence in security their servers can meet or exceed the economic damage of a surgeon's negligence.

  98. Re:whatcouldposiblygowrong by NNKK · · Score: 1

    I'm sorry you're too psychologically immature to recognize economic reality, but that's really not my problem, and hardly makes me a psychopath.

  99. First step: Don't worry. by GNUALMAFUERTE · · Score: 1

    It's not really that bad. I manage several Unix systems. I have done so for all of my professional life. Some servers get in someone's list, some others don't.

    I currently work for an international telco, with base in the US, and servers in the US, Brazil and Argentina. It's a small firm, and I manage the whole operation. Some servers get attack attempts all the time. Others don't.
    The first thing you have to find out is: Are those attacks targeted? Many times, you'll get a new server up, assign a fresh IP, and immediately inherit shitloads of connection attempts. Those've been probably targeted at that IP for years. Most probably aren't even meant for your particular platform. I get shitloads of IIS+Windows attacks targeted at my Slackware + Apache2 servers. I see connections to my SSH daemons trying to exploit vulnerabilities that have been patched for at least 5 years.
    But mostly, I get stupid dictionary attacks. With oh so crappy dictionaries that look mostly for usual names and system defaults.

    This are the steps you should follow:

    1st: Move SSH out of port 22. That'll filter out 75% of all attempts.
    2nd: Use Portsentry. You'll eventually have to whitelist some guy unfairly banned, but most of the time, it works like a charm.
    3rd: Implement way of the many scripts (or write your own) that bans IPs or ranges of IPs that have failed auth many times to your opensshd. This is your most important defense here.
    4rd: Implement longer delays after failed passwords
    5th: Seat back, and relax. Change passwords regularly. Keep them strong. Watch logs regularly, keep an eye for sofisticated, targeted attacks, and ignore the script kiddies.

    Most of the time, those logs just mean that you are out there on a public network, and you've got an IP on way too many people's lists. If it's sucking up too much bandwidth, ask your ISP for a new IP.

    If you ever became worried about some guys, feel no shame about banning whole ranges of IPs. If you truly expect no traffic from those places, dropping China, Brasil and Russia from ever reaching your ssh port is a great idea. Actually, if you only expects connections from certain places, whitelist those ranges and drop anything else.

    Finally, don't focus so much on SSH. OpenSSH is stable and secure, and it'll rarely be the source of you getting rooted. Focus on more vulnerable services, like crappy php webapps, ftp servers, etc.

    --
    WTF am I doing replying to an AC at 5 A.M on a Friday night?
    1. Re:First step: Don't worry. by WuphonsReach · · Score: 1

      1st: Move SSH out of port 22. That'll filter out 75% of all attempts.

      Closer to 99%+ in my experience (possibly even 99.9%).

      And eliminating all of that noise from the logs allows you to see more serious attackers who were previously getting lost in the noise / clutter.

      However, I no longer believe that things like fail2ban / denyhosts work well. Many modern attackers use botnets that slowly pick at your firewall from hundreds of different IPs at a very slow rate. Unless you have a very aggressive ban setting (where you block for a few days), you're unlikely to effectively block these attackers. And you're much more likely to lock yourself out by accident.

      Move the port, switch to pub-key authentication, limit who can login via SSH, turn off the ability to login to root via SSH. Then focus on the other weaknesses in the server.

      --
      Wolde you bothe eate your cake, and have your cake?
  100. port knocking by Anonymous Coward · · Score: 0

    what ever happened to port knocking?

  101. Multiple Layers by Alan+Evans · · Score: 1

    1. Worry about securing Drupal, Joomla and Wordpress first...
    - or -
    2. Use a VPN and hardware firewall
    - or -
    3. Use iptables 'recent' or 'limit' modules
    - or -
    4. SSH keys
    - or -
    5. Find a managed service provider to do 1-4 so you can worry about managing the sites (check out Secure-24.com maybe)

  102. Re:whatcouldposiblygowrong by node+3 · · Score: 2, Insightful

    I'm sorry you're too psychologically immature to recognize economic reality, but that's really not my problem, and hardly makes me a psychopath.

    It's not a sign of being "psychologically mature" to hold the notion that human life is a fungible commodity.

    A poor person in the slums of Bangalore is economically worth more dead (for his organs) than alive. You state that society places an economic value on everything, including people. Yet for some reason, society has outlawed murder, even if the result is a net monetary profit for society.

    Your complete failure to comprehend that a human life is worth more than its economic value to society is why I called you a psychopath.

  103. contrack module ipt_recent by doktorjayd · · Score: 1

    works quite well for me

    http://www.snowman.net/projects/ipt_recent/

    its been around for years, and has kept my ssh service nice and available for almost as long.

    basically, keeps a contrack record for tcp new attempts on the configured port(s), with threshholds for how many attempts before being temporarily blacklisted, then a timeout for how long before they can go again.

    fail2ban and denyhosts fee way to high up in the stack for my liking

  104. Re:whatcouldposiblygowrong by dougisfunny · · Score: 1

    To name a few...

    1) All the zombie pcs their servers are controlling.
    2) All the computers the zombie pcs attack.
    3) All the email addresses the zombies spam.

    --
    This is not the funny you're looking for.
  105. Re:whatcouldposiblygowrong by NNKK · · Score: 1

    Your complete failure to comprehend that a human life is worth more than its economic value to society is why I called you a psychopath.

    Whether or not I recognize any such thing is entirely irrelevant to the discussion at hand. There are no moral imperatives involved in the question of whether self-described 'n00bs' should be running world-facing servers, it is purely an economic question, thus making any non-economic value of a human life entirely irrelevant.

    Your complete inability to disconnect your base emotions from a purely economic discussion is why I called you psychologically immature.

  106. some perspective maybe by Anonymous Coward · · Score: 0

    There are lots of comments here and I doubt "Anonymous Coward" will make for a respectable post, but here goes anyway on my experiences.

    - So, random passwords are a good start. My experience has been that most attacks on my systems start with specific organized password hacks.
    - I don't agree with using off-the-wall port numbers or things like port-knocking. Here is why: When I connect to a standard port number for a specific service with an established site, I do have the impression that security is usually addressed and that malicious attacks will get nowhere. When I connect to a non-standard port or use port-knocking or whatever on an established site, I have the impression that the sys-admins don't know jack about real security, that they are scared, and that "security through obscurity" has become the main line of defense. I'd much rather put things out in the open and show a locked door, than give the impression of an unlocked door that is hidden.
    - fail2ban, as others have mentioned, is a great tool. By default, it will only ban an IP for 10 minutes or so... which is more than enough time to cause the attacking machine to effectively lose interest. But, if you want to make sure other machines on your network are protected, a plan on action could be as follows: I run fail2ban on multiple machines and tally the results daily with logwatch, the corresponding bad IP addresses are taken (there are usually not many) and blocked using hosts.deny on each machine. I've found over and over again that this drastically limits the amount of malicious traffic that I get attacking multiple machines.
    - An obvious point from above is to disable root via ssh. This doesn't disable your specific login's super user root access, btw.
    - If you find that you are attacked more from specific domains (and you do have the ability to address entire domains and subnets with most of these options) and it causes system resource problems, then try to understand how your machines are communicating with the attacking machines... which are 100% of the time scripted. Using the TARPIT option in IPTABLES may be a good approach here. The main advantage that a script has in attacking your machines is that it can blow through multiple attempts in a short time... and so you basically drag it out so the script becomes useless or until the script thinks your machine is not responding.

  107. Do the math. by SinShiva · · Score: 1

    ~1,000,000 auth failures per year = ~2740 failures per day. from 1200 IPs, that's 833 failures PER IP ADDRESS. how in the bloody hell does that go amiss? i like to think most people could figure out their password within 10 guesses (per ip). for a problem this minimal, you don't even need to consider adding a delay between auth requests.

  108. Nothing to worry about by flyingfsck · · Score: 1

    One million login hack attempts over a year is pretty normal on the standard port 22.

    --
    Excuse me, but please get off my Pennisetum Clandestinum, eh!
  109. Re:whatcouldposiblygowrong by Dan541 · · Score: 1

    and advertising that fact on /.

    --
    An SQL query goes to a bar, walks up to a table and asks, "Mind if I join you?"
  110. Re:whatcouldposiblygowrong by Dan541 · · Score: 1

    I'll bet you teach your kid gun safety by shooting him in the neck.

    I bet he is terrified of guns after, the system works.

    --
    An SQL query goes to a bar, walks up to a table and asks, "Mind if I join you?"
  111. Multiple ways by Nuitari+The+Wiz · · Score: 1
    I manage a bunch of physical and VPS servers, all colocated at various facilities. Using gvpe and dedicated switches, I've built a VPN between the locations and my house that allows ssh access between the machines. The vast majority of SSH servers only listen on the private IP address. There is no special access for traffic inside the VPN, and ssh keys are mandatory to login to these servers. In case something happens to the VPN gateways, there is an alternate host that accepts connections using port knocking (which is about 100% effective against automated attacks) and contains a whitelist of known good IP addresses. Fail2Ban still runs on it and it can ban IP addresses on the VPN is something untowards happen. Sometimes my customers require SSH access to the server. I apply the following order of preference:
    • OpenVPN/PPTP to the client machines
    • Port knocking
    • Different SSH Port

    The problem is that all solutions need more work from the customer and that's sometimes something they just don't want to deal with. If I'm really really stuck, what I do is set fail2ban to block on the first failed attempt. That server also gets removed from the VPN network and thus do not get any backup or MySQL replication. No matter what, there is no root password login enabled.

  112. proactive blocking by bugi · · Score: 3, Informative

    In addition to using reactive tools like fail2ban and denyhost, also block most of the world proactively:

    git clone git://github.com/bugi/iptables-by-country.git

    1. Re:proactive blocking by BruceSchaller · · Score: 1
      Thanks for playing China, South Korea, Ukraine, Russia....etc etc...

      I suggest SSHblack. It automatically updates IPTables and it's a python script. It allows a fixed number of connection attempts, then just drops the packets. After a period of time it can remove the ban, improving performance. This also prevents the aforementioned problem of sitting down to a virused comp, and if you're travelling, you won't have issues either =)

  113. Re:whatcouldposiblygowrong by jim_v2000 · · Score: 1

    If everyone gets told that, it's not long before there are no surgeons left.

    Also, running a server is not a critical as surgery. No one is going to die if a server crashes or gets hacked.

    --
    Don't take life so seriously. No one makes it out alive.
  114. Re:whatcouldposiblygowrong by jim_v2000 · · Score: 2, Insightful

    It's fucking computer. He can learn how to secure it. There's no reason to hire someone else to do something that he can do himself, especially when it's something that he needs to know how to do.

    --
    Don't take life so seriously. No one makes it out alive.
  115. Re:whatcouldposiblygowrong by jim_v2000 · · Score: 1

    Reasonable people understand that economic damages do not equate with lost lives. Drop the pedantry...you sound like a moron.

    --
    Don't take life so seriously. No one makes it out alive.
  116. Re:whatcouldposiblygowrong by jim_v2000 · · Score: 1

    Surgeons get paid around $300k. System admins get paid around $70k. (Those are median wages pulled from salary.com). It seems that society places a much higher value and importance on surgeons.

    --
    Don't take life so seriously. No one makes it out alive.
  117. FreeBSD - built in rate limiting / fail banning by Anonymous Coward · · Score: 0

    If you are using FreeBSD, you can add this (and tune it) to /etc/inetd.conf to cope with login bots.

    # throttle bot login attempts : limit sshd to 10 child processes,
    # 3 connections per IP per minute, and 5 simultaneous invocations per
    # IP address
    ssh stream tcp nowait/10/3/5 root /usr/sbin/sshd sshd -i -4

  118. wow 20k hits/week by Anonymous Coward · · Score: 0

    you're not really successful. stop calling yourself developer and stop calling your bedroom studio. go back to serving burgers at mcd.

  119. SSH Key by rawg · · Score: 2, Informative

    Instead of generating passwords, have your users supply their SSH key and turn off passwords. Much better solution.

    --
    The above is not worth reading.
  120. Don't run the default protocols by mysidia · · Score: 1

    SSH is attacked often because a lot of sites run it.

    Disable SSHD on all machines, and run Kerberized telnet instead.

  121. best combo by Anonymous Coward · · Score: 0

    htaccess, fail2ban, denyhost, and iptables + snort

  122. Re:whatcouldposiblygowrong by inKubus · · Score: 1

    WTF? In one case, a web server has been vandalized. In the other, a person is dead.

    But your whole argument crumbles if the web server in question is WOPR and that pesky hacker has just started World War Three.

    --
    Cool! Amazing Toys.
  123. Re:whatcouldposiblygowrong by X0563511 · · Score: 1

    However, zombie servers get noticed. When you find that all your email goes to spam, and blacklists are yelling at you... you realize something is wrong. Abuse complaints come in, and your server gets nullrouted. Home users don't notice until it is EXTREMELY bad, and even then often blame it on the wrong things.

    --
    For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
  124. Re:whatcouldposiblygowrong by X0563511 · · Score: 1

    Happy-go-lucky? Fuck you.

    Accidents and such are one thing. Malpractice and deliberate killing is another. These are fucking [b]lives[/b], not imaginary numbers that may or may not represent a quantity of gold.

    Again... fuck you.

    --
    For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
  125. Re:whatcouldposiblygowrong by X0563511 · · Score: 1

    Reading your comments in this story... I only have one thing to say:

    You need counseling.

    --
    For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
  126. Lock it down. by BlackHawk-666 · · Score: 2, Insightful

    I can't believe the person who set the server up left this port open to the world. If you want the server secure then you will close all the ports that are not actually needed - in your case this likely means you keep 80 and 443 open.

    For remote management make get a few IPs for the desktops that are meant to connect to it and make sure the ISP opens SSH port only to the IPs.

    You can tunnel X over SSH and do file management, whatever you need so it should be enough.

    Don't bother changing it to some random port, security through obscurity is total bullshit in this age of port scanners.

    --
    All those moments will be lost in time, like tears in rain.
    1. Re:Lock it down. by Anonymous Coward · · Score: 0

      This is the type of attitude that annoys me about most people in InfoSec - lack of pragmatism. Obscurity by itself is not a security measure but with other controls its valuable. Its the same reason who want to the version number of an application from being exposed. You don't want to give the attacker any more information than absolutely required. But I can think of one good reason to the port of an application - it cuts down on the noise. Plus - if you are not detecting port scans in your environment - you have other problems.

    2. Re:Lock it down. by jon3k · · Score: 1

      "Don't bother changing it to some random port, security through obscurity is total bullshit in this age of port scanners."

      You're clearly very uninformed on the actual threat. 99%+ of these attacks are automated attacks from botnets. There's no port scanning it's a waste of resources for them. They just attempt to login via port 22 using a few dozen default passwords and move on.

    3. Re:Lock it down. by BitZtream · · Score: 1

      Don't bother changing it to some random port, security through obscurity is total bullshit in this age of port scanners.

      Ahhhh spoken like the voice of someone parroting what they read on someone elses website.

      After a few years of writing cryptography software, let me give you a little hint. Its ALL security through obscurity. TCP ports only allow for 65k possible options so its an easy guess. You can follow the same process to break AES encryption, it just takes a lot longer to guess.

      Its all security through obscurity, its just a question of how obscure the knowledge required to break it is.

      --
      Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
    4. Re:Lock it down. by BlackHawk-666 · · Score: 1

      It only takes a couple of minutes to break the knowledge of which port you are running SSH/Telnet/etc on. Can you really classify that as obscure? Once those two minutes are up they can get on with the job of probing that port for weaknesses.

      --
      All those moments will be lost in time, like tears in rain.
  127. Fortinet by Exter-C · · Score: 1

    Hi There,

    I know its not the cheapest solution around but we use Fortinet Firewalls with their IPS feature. There is a signature for brute force SSH attacks. It works really well. We have seen a 96% drop in SSH connections since installing these devices in front of our servers. So far we have had no reported false positive issues. Coupling that with all the other signatures in the IPS database and we have a huge drop in attacks overall.

  128. Re:whatcouldposiblygowrong by shentino · · Score: 1

    Supposing that a hacker knocks out a power grid...or jams up a medical database? Or...gets into a military system?

    Causing damage or disruption in a server might not be directly dangerous, but it can make things indirectly quite hazardous indeed.

    A hospital might lose power and patients in the middle of surgery could die. That's probably why hospitals have backup generators though.

    Medical databases getting corrupted could easily get someone a fatal drug dose of the wrong type, or quantity.

    And hacking into the army, possibly launching an attack. Well, duh.

    Computers these days are quite capable of causing harm if they're malfunctioning, thank you.

  129. Determine what you need by SmallFurryCreature · · Score: 1

    You get a lot of recommendations here, but people tend to just blurt out the flavor of the hour they are using without considering the essential motto of any proffesional, "the right tool for the job".

    Simplest, do you need SSH access? I once maintained servers with absolutely no remote access capability of any kind. Didn't need to, lived within 5 minutes of the hosting location and simply worked from there. Saves a LOT of security hassle when only physical access can be used on a server. Most likely not possible, but I hope it does show that you must THINK about what is needed/possible in your situation.

    For instance, moving the SSH port. It is possible, security through obscurity at its finest, but how will it affect your customers? If you then got to deal with endless service calls to explain the non-standard port, or worse, client software can't handle alternate ports, then it is not the right tool.

    An alternative to this is switching the IP. Nothings says that the IP used to access the webserver must be the same as the one used to access SSH. Again security through obscurity, but it might help.

    Also, there is no law that says every machine should be remotely accesible. If you got a lot of servers, why not create an Admin box? It can connect through all the servers over the internal network, but the world facing servers got no outside admin connections. Yes, if the Admin server is borked, you are in trouble, but I found that people in the name of "Shit might happen" open themselves up to a lot more shit.

    An other simple approach is to block parts of the world that you don't expect legit connections to come from. If you are never in China and neither are your customers, why would you allow China to connect to port 22? Just remember that you got such a block in place before you book your holiday in Hong Kong.

    An even simpler approach is to block root from using SSH, and then use only somewhat unique account names. You need two parts to login to SSH. Brute forcing passwords is only half the job unless I have been missing something all these years.

    And on the whole, 1 million failed login's is a good thing. It is the successful login that you should worry about.

    --

    MMO Quests are like orgasms:

    You may solo them, I prefer them in a group.

  130. Easy: Server management service by Skal+Tura · · Score: 1

    It's cheap, it's professional, it's fast and it's done correctly with lots of experience. What's not to like there?
    Of course, it's not a answer to everyone, but in your case seems to be good match.

    http://www.platinumservermanagement.com/
    I've considered using them in the past to save my time and they seem to be good, and is recommended by many.

    1. Re:Easy: Server management service by Skal+Tura · · Score: 1

      Forgot to say, if you want to manage yourself i recommended using APF + BFD from RF-X Networks. They are excellent FREE products. The BFD is addon to APF and will ban anyone trying to bruteforce into your server.

      It's normal day to day activity that there's lots of brute force attempts.

  131. Re:whatcouldposiblygowrong by kangsterizer · · Score: 1

    that's why you pay a good sysadmin (for a lot of money) if you need good security, and don't if you don't.

    if your server is important economically or even supports some life saving tools/etc and it doesn't have a good sysadmin, that's your error.

    If you get an unimportant server hacked, well, no big deal. Rather that than being disabled or die etc by like.. far.

    on the other hand, you probably want 100% of the surgeries to be successful.

  132. Ob.Whine quoted by elronxenu · · Score: 1

    how do you manage server security on a tight budget with literally no system admin (except for me and I know I'm a n00b)?

    You do the best you can. Sheesh. Learn about the system and how to secure it. It's not slashdot's problem you're under-funded and under-resourced.

    There's a triangular spectrum. Corner 1 is how much you're willing to pay. Corner 2 is how much you're willing to learn and do by yourself. Corner 3 is your probability of getting r00ted. If you don't want to spend any money on sysadmin and you don't want to spend any time to secure your system, then expect to get r00ted sometime.

  133. I use BlockHosts by houghi · · Score: 1

    http://www.aczoom.com/cms/blockhosts/
    The advantage is that it does things live. So no log scanning (well, it does the first time, just to see what it can add) and therefore even if several hundred scans are done from the same IP at the same time, you do not need to wait a minute for some cron job to start and read all the adresses again.

    As it works with hosts.allow (or deny) you can determine IP addresses that will never fail, so you have always access. You can also determine the amount of times users can try as well as how long you want to block the IP address.

    --
    Don't fight for your country, if your country does not fight for you.
  134. good against 1 attacking host -- not large botnets by beh · · Score: 2, Insightful

    I am using fail2ban, but I do not think it's a particularly great tool when you see how many different IP addresses the attacks come from, so you're somewhere stuck in the middle trying to optimise how to make fail2ban more effective, while not being a problem for your own users:

    - you configure blocking from 1 login attempt and a long block time cuts down on most of the outside attacks, but if some legitimate user mistypes his password, he'll be locked out for that same long block time...
    - you configure several wrong password attempts and/or shorter blocking times - then the attacks do not get slowed quite as much, but it hinders your users less.

    There are some things you might consider, though -

      - if you can, and your users always access the system from their own computers/laptops, force the use of public-key authentication and disable use of password logins; then outside access attempts via password cannot succeed.
      - if you can't do this, at least force root to use public key (and/or su/sudo from another login. (sshd_config either
              'PermitRootLogin without-password' (to allow root access through authorized_keys, but not through password, or
              'PermitRootLogin no' to block root access via ssh-login altogether.

      - if there are only specific accounts you might want to allow access to, look into pam_require, then limit to those users in pam's ssh
          config: 'account required pam_require.so @ssh-users myaccount' (allows user 'myaccount' and all users in group 'ssh-users'
          to log in via ssh - everyone else will be kicked out, even with a valid password).

      - keep an eye on the log to see whether it's actual users that get hit, or whether you see access attempts to non-existent users
          (many of the attacks are basically dictionary based). If you find one of the valid accounts gets hit too much, consider renaming that
          user account.

  135. Re:whatcouldposiblygowrong by tkinnun0 · · Score: 1

    Recognizing the reality for what it is without making a value judgement one way or another is now grounds for counseling? What next, not believing in God is grounds for re-education?

  136. Re:good against 1 attacking host -- not large botn by badran · · Score: 2, Informative

    - you configure several wrong password attempts and/or shorter blocking times - then the attacks do not get slowed quite as much, but it hinders your users less.

    There are some things you might consider, though -

    3 fails / 10 min != 10 fails/ 1 sec

  137. Re:Ignore it? - No way ! by Anonymous Coward · · Score: 0

    There *is* brute-forcing going on. I'm surprised no-one has mentioned the string of articles on the Net on this very topic (Then again, this is slashdot where everyone posts first, then thinks. So naaaaaaah, forget that).

    The graph at this site http://stats.denyhosts.net/stats.html shows you what's been going on for the last few months. And this article http://www.immutablesecurity.com/index.php/2009/10/06/low-and-slow-ssh-brute-force-attacks/ has some info. about how this has been going on for a long time.

    At our tiny company (four remote users) we moved ssh to a non-standard port, and don't allow password access, only private key auth. Requiring a key makes ssh bullet-proof against password guessing. Moving the port saved us a bit of bandwidth - early on in the brute-forcing the attackers would hammer away as fast as they could. Now, with lots of people using an IDS, they attack more slowly, and from a large number of different IPs.

    So to answer the original question - I would move the ssh port and go for an auth key. It may seem like a bit of trouble, but a lot less trouble than re-building your server.

  138. A million connections. by Anonymous Coward · · Score: 0

    Do you have many customers who access SSH, or is it mostly you? That could help define your problem and your solution.

    As others have pointed out, a million connections divided by 50 sites, divided by 365 days, may not be all that unreasonable.

    On the other hand, if it is only you, or if you like to go through your log files regularly and find it too cumbersome with all the extra noise, then there may be better solutions.

    I like to use pageknocking (not portknocking) to open the SSH port for access. This prevents access from worms and limits the number of log entries created, although others claim (incorrectly) that it is just security by obscurity... (It should be trivial to modify it for use with Linux) www.otterhole.ca/knock/

  139. Re:whatcouldposiblygowrong by Anonymous Coward · · Score: 0

    You forgot to start that sentence with, "you might be a psychopath if..."

    Or an economist. An economist would realise that effort is fungible[1], and the effort that goes into cleaning up malware could save a lot of lives if it was applied to, say, medicine. So yes, enough compromised servers are worth more than a human life.

    [1] On long enough timescales. Allow a decade or so for retraining and changed career courses.

  140. Too many issues... by RichM · · Score: 1

    Drupal, WordPress, and Joomla

    You have bigger security problems than SSH.

  141. One million sounds like a lot, but isn't really by badger.foo · · Score: 1
    Or to put it another way, what you're seeing is the Internet's background noise. There is at least one, possibly several, smallish botnets that do brute force ssh password guessing all across the Internet.

    I see others have already mentioned my articles such as http://bsdly.blogspot.com/2009/11/rickrolled-get-ready-for-hail-mary.html, and if you take a peek in the list of addresses I put there, I would not be at all surprised if there's a great deal of overlap with the hosts that keep sniffing your servers (my data for that round has a little over 4000 hosts). In fact, it would be interesting to know how large or small the overlap is. They will keep trying (in fact I'm just seeing the start of another alphabetic phase over the last few days here) but there are a few things you can do to make it less likely they will succeed.

    The general advice is, as you have heard many times before, to enforce a policy of no passwords, usin only key authentication, of course disable root logins and if practical limit where you can log in from to 'known good' IP addresses or ranges. The first two won't rid you of the logged attempts, but sensible in any case and makes the probability of ssh-based compromise quite a bit less likely.

    Rate limiting helps get rid of the classical rapid-fire variety password guesser, but will not help at all when you're faced with the coordinated 'hail mary cloud' where each individual host could be attempting to access your system or network only every few hours.

    As for portknocking, I seriously think the port knockers would be equally well served by switching all passwords to unicode. That provides a practical alphabet of the same number of unique characters (16 bits, remember), and for anyone with a large enough fleet of password guessers, the mechanics of guessing the right one is not all that different. Oh well, I just spilled the beans for the main point of an upcoming column, that won't spoil the fun later, I hope.

    --
    -- That grumpy BSD guy - http://bsdly.blogspot.com/
  142. Use good passwords. by jonadab · · Score: 1

    Okay, so they're making a million attempts a year.

    Let's say you plan to keep this server for, what, twenty years? After that you will replace it with an entirely new system and new passwords.

    Assuming that the number of attempts they make increases geometrically, starting from one million this year, in twenty years they could generate how many attempts? A billion or so? Maybe ten billion? Let's say a hundred billion, because you don't want to take chances with your server security.

    So just make sure all your passwords are sufficiently long and complex that the search space magnitude well and truly exceeds a hundred billion. Ideally you want to make the hundred-billion number look absolutely ridiculous. This is not particularly hard. Even if you don't look beyond lowercase letters (because you want to type the password quickly with no shifting keys), 26^N goes past a trillion after just nine characters.

    Personally, I'd set the minimum length to at least twenty, and make the root password more like twice that long (if you allow remote root login). It's overkill, but when it comes to security a little bit of overkill is good. It just may save you if you've underestimated some important element of risk (like, say, how many attempts they can make in a given time period).

    --
    Cut that out, or I will ship you to Norilsk in a box.
  143. DenyHosts by frambris · · Score: 1

    We use DenyHosts, a program watching your secure-log for failed logins and after a few of those adds their IP to /etc/hosts.deny. It can also sync with a central repository.

  144. Do *NOT* use a password with ssh! by Colin+Smith · · Score: 1

    That way an attacker has to guess the one user+password, and have a legitimate userid+password to gain access.

    Use public key authentication.

    Also. The root account should not have a password at all. Passwords are a weakness which should be phased out entirely. It's (long past) time brute forcing passwords was made futile.

     

    --
    Deleted
    1. Re:Do *NOT* use a password with ssh! by cptdondo · · Score: 1

      Well, that works as long as you never, ever have to log in to from a random terminal. Which I do.

      And if your laptop gets stolen, then your key gets stolen with it. Ditto USB stick, etc.

      So pubic key is less vulnerable to brute force attacks, but more vulnerable to physical attacks. Pick which one you want.

    2. Re:Do *NOT* use a password with ssh! by muckracer · · Score: 1

      > So pubic key is less vulnerable to brute force attacks, but more vulnerable to physical attacks.
      > Pick which one you want.

      Can I have another option? o_O

  145. Re:Ignore it? - No way ! by tomhudson · · Score: 1

    A million attempts over the course of 1 year can easily be defeated by changing the password every 3 months.

  146. Do *NOT* use a password with ssh! by cptdondo · · Score: 1

    Well, that works as long as you never, ever have to log in to from a random terminal. Which I do.

    And if your laptop gets stolen, then your key gets stolen with it. Ditto USB stick, etc.

    So pubic key is less vulnerable to brute force attacks, but more vulnerable to physical attacks. Pick which one you want.

  147. Use "artificial ignorance" and cron, daily by davecb · · Score: 1

    The short answer is to get someone to read all your logs daily and email you only if there's something non-routine in them. That will find anything that gets logged, so you will have good coverage and rapid notification.

    Since no-one in their right mind is going to offer that service for a reasonable price, you can have cron run an 'artificial ignorance" script nightly. The tern coems from Marcus Ranum, and there's a complete discussion of filtering syslog at Sherlock Holmes on Log Files.

    In practice, I get a few emails a month about new things, and add them to the list in the script if they're uninteresting.

    --dave

    --
    davecb@spamcop.net
  148. Re:whatcouldposiblygowrong by Anonymous Coward · · Score: 0

    You need to read this: http://news.slashdot.org/comments.pl?sid=1573970&cid=31389232

    From the article which discusses the economic value of a human life, from the standpoint of the wife of a man who cost over $600,000 to try and keep alive. Do you think she needs counseling because she compared that cost to what else the money could have bought?

  149. firewall by Uzik2 · · Score: 1

    It's trivial to put in rules to only accept ssh connections from specific IP addresses. Perhaps you might consider only accepting connections from your customer's IP's, or doing the reverse and blocking abusing IP subnets.

    --
    -- Programming with boost is like building a house with lego. It's a cool but I wouldn't want to live in it
  150. Re:whatcouldposiblygowrong by smash · · Score: 1
    You're grasping at straws. Damage to life in any of the cases you mention above relies in the fact that essential systems are exposed to the internet, and do not have any sort of fail safe backup.

    If some random botnet on the internet can cause any significant effect to any of the systems you mention in your post, they are broken and need to be re-engineered.

    --
    I run: Windows, OS X, Linux, FreeBSD. Just because you have a hammer, doesn't mean everything is a nail.
  151. Re:whatcouldposiblygowrong by Roogna · · Score: 1

    Not entirely true. Economic damage can directly cause jobs to be lost. That can easily lead to lack of healthcare, or even shelter and food for those previously employed individuals. Which can lead directly to lost lives.

  152. Honeypot by Anonymous Coward · · Score: 0

    Run SSH server in a different port, use 22 for a honeypot:

    http://code.google.com/p/kippo/

    1. Re:Honeypot by svo · · Score: 1

      Kippo is a lot of fun indeed.

  153. VPN + allow access with iptables for the vpn IP's by Anonymous Coward · · Score: 0

    Just setup a VPN and make your iptables allow access to the IP block that the VPN will use. Also, allow access to the subnet of your office only(if you have one).
    Instead of installing tools use the iptables rate-limit and automatically ban them.

  154. Re:whatcouldposiblygowrong by Anonymous Coward · · Score: 0

    Well, sometimes unqualified admins can kill living things.

    Or have we forgotten the sage advice: "always mount a scratch monkey"?

  155. Re:whatcouldposiblygowrong by astar · · Score: 1

    there is a certain view that the proper valuation of a human life is best done by an accountant. I would give examples, but goodwin's law gets in the way.

  156. Re:whatcouldposiblygowrong by jon3k · · Score: 1

    He didn't say he agrees with it. But he's right. There are a lot of instances where the loss of a human life had far fewer financial implications than a theft of some customer database. Sad but true.

  157. Re:whatcouldposiblygowrong by jon3k · · Score: 1

    Except that we have probably 100:1 ratio of system admins to surgeons which means society pays faaaar more to employ sysadmins than surgeons. So when you look at the broad picture you are completely incorrect.

  158. Port Knocking by skyphyr · · Score: 1

    You could consider implementing port knocking. It will be somewhat of an inconvenience for your clients, but it will almost eliminate your ssh authentication failures.

  159. Something a little more advanced? by jon3k · · Score: 1

    Is there a piece of software similar to SSHGuard but instead of adding local IPTables rules can function in conjunction with a hardware firewall (eg - Cisco ASA) ? I'm thinking of a device inside the private network pulling logs off hosts in the DMZ and using the results to dynamically manage firewall denies.

    1. Re:Something a little more advanced? by mijio · · Score: 1
      SSHGuard is designed to support this. Since the blocking backends are modular, you can make it block with firewalls other than those shipping with the code. Local or remote does not matter as long as you can reach/control it from the attacked host. You have two options:
      1. you write your own module. Command-based modules are just 6 command definitions, see eg http://sshguard.svn.sourceforge.net/viewvc/sshguard/trunk/src/fwalls/command_pf.h?revision=181&view=markup
      2. you submit an extension request. If the team considers the firewall is relevant enough (Cisco ASA surely is), they're happy to add it. See the Request New link in the home page.
  160. ban china by bkissi01 · · Score: 1

    I think everyone that has a SSH server must have the exact same issues. I have a CentOS server behind my firewall that I use for a little web development (personal projects, nothing major or really interesting) and just testing out different things but for some reason the chinese army seems hell bent on breaking in. I just set iptables to block every /8 IP range that I could find that was even loosely related to china. Personally, I don't understand why anyone would allow their network/machine to communicate with chinese IP ranges, there just seems to be no real need. Honestly, this cut invalid login attempts from thousands to a handful. As said before make use of your authorized_keys file and I'd also recomend that you double check that login by root is disabled.

  161. Botnet brute force. by Anonymous Coward · · Score: 0

    I looked at my logs the other day on my FreeBSD router and noticed the same thing this guy had. Random IP addresses (different class A's very few repeat IP addresses) and invalid logins. Each time the username would alphabetically increment. So all these different IP's each taking the enxt name on the list to try to login. It was pretty scary.

    I let it get through it's list up to about 'j' before I blocked port 22.

  162. OSSEC by doug.burks · · Score: 1

    I highly recommend OSSEC (ossec.net). It will parse your system logs (SSH, Apache, ModSecurity, Snort, and others) and block attacker's IP addresses automatically. There's even a Wordpress plugin that will output to syslog and therefore OSSEC. For more information, please see: http://securityonion.blogspot.com/2010/02/defense-in-depth-using-ossec-and-other.html

  163. Re:whatcouldposiblygowrong by jim_v2000 · · Score: 1

    You're finding the 1% of cases where a server crashing might cause lost lives.

    If a surgeon messes up, the chances are near 100% that someone will die or be maimed for the rest of their life.

    --
    Don't take life so seriously. No one makes it out alive.
  164. Re:whatcouldposiblygowrong by jim_v2000 · · Score: 1

    You're talking about pay. I'm talking about value.

    --
    Don't take life so seriously. No one makes it out alive.
  165. Re:whatcouldposiblygowrong by Anonymous Coward · · Score: 0

    a single server farm isn't going to do $millions of damage

    and an unlicensed surgeon who kills someone is facing jail time

  166. Why Stop Them by thisNameNotTaken · · Score: 1

    Some advice:

    Hack the ssh program, let them in, rate limit them after they give you data, then dump them. Start all over again.

    I'll let you know how this works as I have a research project to do this.

    I am looking for ssh friends :)

  167. Two things you can use by C_Kode · · Score: 1

    knockd if only *you* or other technically savvy people connect to them, or option B (DenyHost) if customers actually use it too.

    DenyHost can be set where it will blacklist IPs that fail ssh more than $x times and you can even whitelist IPs.

  168. Mod parent up funny -- oh wait by ansak · · Score: 1

    I already see it as a 5. Oh well... "I get thousands of Chinese hackers attempting to break into the battery monitor..." I'm still laughing.

    --
    Still hoping for Gentle Treatment...
  169. Re:whatcouldposiblygowrong by node+3 · · Score: 1

    thus making any non-economic value of a human life entirely irrelevant.

    No, the non-economic value of a human life is never irrelevant.

    Ever.

    You were equating the need for trained doctors with the need for trained sysadmins. The reason we need highly trained doctors is not due to the economic impact of poorly trained doctors, but because of the human impact of poorly trained doctors.

    Your complete inability to disconnect your base emotions from a purely economic discussion is why I called you psychologically immature.

    The value of a human life is not a "base" emotion. I can easily talk about the value of a human life in terms of economic output, the value of the elements in the body, the value as a customer or an employee, etc. But one must never forget that these are also humans.

    To dissociate the value of a human as a human from a human, is the key ingredient of a psychopath.

  170. open ssh port = bad by Anonymous Coward · · Score: 0

    1. Dont have open ssh ports on the net...
    2. Use vpn tunnles to get to your network
    3. ONly allow port 22 connections from your vpn network.
    4. Stop getting hacked

    Who the hell leaves an ssh port open to the net on a production server ?
    Also while fail2ban is very effective as i have used it in the past, its not a perfect solution.

    again while in gods name do you have ssh ports open to the net, realy you should not have any admin access avaible strait from the net, if you do your just asking to get burned

  171. Re:whatcouldposiblygowrong by Anonymous Coward · · Score: 0

    I think the realization is that economics are psychopathic. The comparison of a surgeon to sys. admin. above may be a poor analogy because of the societal (i.e. human) difference between the two jobs. The suggestion that a human life counts less than a server farm's integrity may be an economic perspective, it as also a psychopathic perspective. The point may have been phrased better.

    Letting psycopaths (i.e. large corporations) have a large amount of political control is probably an extremely bad idea for a human society

  172. re: Use VPN first by hittjw · · Score: 1

    Invest in a hardened VPN box, block all ports on your webserver from outside world except 80 and 443. Only allow SSH access from the VPN. Log into your environment only after you first have a VPN connection. Outside world would only see the ports they are allowed access -- you would have more control over who has secure access.

    Best,

    Justin

    --
    If you had everything you wanted, you'd just want more.
  173. OWASP Live CD by Anonymous Coward · · Score: 0

    OWASP Live CD http://www.appseclive.org/content/downloads

  174. Trolly boy. by jotaeleemeese · · Score: 1

    You can't discuss economy in isolation, specially disconnected from human emotion and moral judgements.

    That should be obvious to even the most derided, but educated, person.

    --
    IANAL but write like a drunk one.
  175. When I had this problem by coolsnowmen · · Score: 1

    I did a reverse lookup on the ip addresses that were trying to randomly guess user/pass on my machine and found that the majority were from: China, Korea, india, and Japan. I then filled the hosts.deny file with the subnets from those countries and cut back on 97% of the break-in attempts.

    I also told my boss noone from those countries was ever going to be able to see our website let alone login w/o bouncing it through a different computer first. I also block root login and users that can login have to be in the sshd group and don't have simple login names like "fred",

    I believe something fail2ban-like to be a better solution in the long run, but this was faster for me to setup and understand exactly what was going on.

  176. Use ClearOS by pr0f3550r · · Score: 1

    This is why i use ClearOS. It comes with Intrusion Prevention via Snort right out of the box. It proactively blocks failed SSH attempts and keeps my boxes off the lists happy and smiley!

  177. As someone managing an SSH server by Outland+Traveller · · Score: 1

    If your passwords are randomly generated and long, it doesn't matter how many attempts to guess them are tried. The likelyhood of a random guess getting through are lower than your chances of winning the lottery. Let people waste their time on futile attempts.

    To further decrease your chances, use public keys authentication instead of passwords, or two factor authentication, or limit connections by IP address.

    Changing the post does fool most SSH scanners as well.

    I don't like fail2ban because it can lead to DoS vectors.

    Bottom line is that logged attacks that have no hope of getting through shouldn't cause a panic.

  178. non-std-port & IPTables *TARPIT* too! by Anonymous Coward · · Score: 0

    non-standard port & TARPIT ( IPTables ), and you reduce the discovery of your actual port ( by making scans take nearly-forever )

  179. sshguard is better than fail2ban by ooglek · · Score: 1

    +1 for sshguard. Compiled (not interpreted by perl, python or ruby), fast, stable, works great with any firewall -- pf, iptables, etc.

  180. Re:whatcouldposiblygowrong by The+End+Of+Days · · Score: 1

    In fairness, I have noticed that in terms of self-importance, the two professions are about equal.

  181. Mobile OTP by Anonymous Coward · · Score: 0

    I am wondering why no one did not mention OTP solutions as well?
    You can have Mobile OTP. Also Port Knocking or SPA with SSH certificates.

  182. Welcome to the Internets! by Spit · · Score: 1

    If you're going to have services open to the Internet without IP restricions, expect millions of random connections. Just use ssh-key authentication, disable password over ssh and forget about it.

    --
    POKE 36879,8