Aug 16 2008
Debian SSH Security
Within two days of having my out of the box Debian install exposed to the internet I realised something had to be done about my SSH security.
I was getting a large amount of attempts to access my server. This was logged to /var/log/auth.log.
Attempts ranging from guessing the system’s users:
Aug 12 19:01:04 sailes sshd[11017]: Invalid user alex from 221.11.123.149
Aug 12 19:01:04 sailes sshd[11017]: (pam_unix) check pass; user unknown
Aug 12 19:01:04 sailes sshd[11017]: (pam_unix) authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.11.123.149
Aug 12 19:01:05 sailes sshd[11017]: Failed password for invalid user alex from 221.11.123.149 port 41122 ssh2
Aug 12 19:01:08 sailes sshd[11021]: Invalid user brett from 221.11.123.149
Aug 12 19:01:09 sailes sshd[11021]: (pam_unix) check pass; user unknown
Aug 12 19:01:09 sailes sshd[11021]: (pam_unix) authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.11.123.149
Aug 12 19:01:11 sailes sshd[11021]: Failed password for invalid user brett from 221.11.123.149 port 41238 ssh2
Aug 12 19:01:13 sailes sshd[11025]: Invalid user mike from 221.11.123.149
Aug 12 19:01:14 sailes sshd[11025]: (pam_unix) check pass; user unknown
Aug 12 19:01:14 sailes sshd[11025]: (pam_unix) authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.11.123.149
Aug 12 19:01:16 sailes sshd[11025]: Failed password for invalid user mike from 221.11.123.149 port 41366 ssh2
Aug 12 19:01:19 sailes sshd[11029]: Invalid user alan from 221.11.123.149
Aug 12 19:01:19 sailes sshd[11029]: (pam_unix) check pass; user unknown
Aug 12 19:01:19 sailes sshd[11029]: (pam_unix) authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=221.11.123.149
To attempting to brute force the root password:
Aug 16 21:05:12 sailes sshd[24111]: (pam_unix) authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=65.75.189.67 user=root
Aug 16 21:05:14 sailes sshd[24111]: Failed password for root from 65.75.189.67 port 36171 ssh2
Aug 16 21:05:15 sailes sshd[24115]: (pam_unix) authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=65.75.189.67 user=root
Aug 16 21:05:18 sailes sshd[24115]: Failed password for root from 65.75.189.67 port 36489 ssh2
Also alsorts of crazy other error messages which no doubt came from attempting to exploit various potential security flaws.
This was obviously not a good situation, luckily many people offered advice. Ideally what I should have done was to only allow management access to my own static ip address. But this doesn’t suit me, I like to be able to do anything from anywhere.
Another suggestion was to change the port ssh listens on. This is a very good suggestion, and one I would pass onto others. It seems like 99% of the attackers don’t bother to check for ssh listening on a non-standard port. I didn’t want to do this because that would mean I would have to remember yet another custom port, but also due to strict firewall policies I had to contend with.
Finally I decided on installing a piece of software called DenyHost
# apt-get install denyhost
This python application runs frequently throught the day monitoring my auth.log, when it sees suspicious behaviour it bans the ip address from the service.
Now my hosts.deny file is now increasing almost daily with naughty ip addresses.
sailes:/# cat /etc/hosts.deny
sshd: 221.11.123.149
sshd: 89.96.182.197
sshd: 211.239.157.222
Although this is not the most secure option, I feel it best suits my needs.

March 10th, 2010 at 6:14 pm
Sailor Sam…
http://www.sbdcexcellence.org/index.php/member/64/ ok…
March 11th, 2010 at 7:53 pm
echelon ladder…
http://www.museumofhoaxes.com/hoax/forums/member/15789/ ok…
March 12th, 2010 at 3:59 pm
ludicrous attempts…
http://elawc.org/member/75/...
March 12th, 2010 at 4:15 pm
Frederick…
http://www.fricked.com/index.php/member/41/ ok…
March 18th, 2010 at 4:54 pm
Eric…
http://www.aaask.com/index.php/member/71/ ok…
March 19th, 2010 at 11:04 am
Peter…
http://www.spamfilterjudge.com/index.php/member/131/ ok…
March 20th, 2010 at 11:36 pm
Jurgen…
http://www.longjuyt23.pun.pl/profile.php?id=55 for sure…
March 23rd, 2010 at 12:14 pm
Peter Inocule…
http://georgianbaymetiscouncil.com/index.php/member/27/ is a truth…
March 23rd, 2010 at 8:25 pm
Frederick Right…
http://www.sierhelt.com/index.php/member/109/ is the way…
March 24th, 2010 at 8:28 pm
Wrong is right…
http://borss.com/index.php/member/81/ is hot…
March 25th, 2010 at 10:00 pm
Bongo Dongo…
http://www.sagaludzilodu.pun.pl/profile.php?id=10 echo…
April 3rd, 2010 at 3:24 am
Вы ошибаетесь. Давайте обсудим это. Пишите мне в PM….
Инженер связи Attempts ranging from guessing the system’s users:
Aug 12 19:01:04 sailes sshd[11017]: Invalid user […….
April 5th, 2010 at 11:18 am
Excitement27…
http://www.psajdak.pun.pl/profile.php?id=20 I think…
April 5th, 2010 at 3:48 pm
florist18…
http://bournesigns.com/index.php/member/20/ inside…
April 8th, 2010 at 9:05 pm
trudgewater…
http://www.abacusbci.com/member/123/ edgy…
April 11th, 2010 at 7:20 pm
это точно !!…
Инструктор по плаванию Within two days of having my out of the box Debian install exposed to the internet I realised something had to be done about my SSH security…..
April 16th, 2010 at 4:05 am
у моего папы куча радости! )))…
Бизнес тренер Attempts ranging from guessing the system’s users:
Aug 12 19:01:04 sailes sshd[11017]: Invalid user […….
May 13th, 2010 at 3:14 am
Я знаю сайт с ответами на интересующей Вас вопрос….
Метро 2034 - аудіокнига I was getting a large amount of attempts to access my server. This was logged to /var/log/auth.log…..
June 24th, 2010 at 1:15 pm
Medicamentspot.com International Legal RX Medications. Special Internet Prices (up to 40% off average US price). NO PRIOR PRESCRIPTION REQUIRED!…
Combivir@buy.online” rel=”nofollow”>.…
June 25th, 2010 at 10:35 pm
Pillspot.org. Canadian Health&Care.No prescription online pharmacy.Special Internet Prices.PillSpot.org. Vitamins@buy.online” rel=”nofollow”>.…
Categories: Skin Care.Antidepressants.Pain Relief.Eye Care.Antidiabetic.Weight Loss.Antiviral.Antibiotics.Vitamins/Herbal Supplements.Mental HealthAnxiety/Sleep Aid.Anti-allergic/Asthma.Mens Health.Womens Health.Stop SmokingBlood Pressure/Heart.St…
July 15th, 2010 at 9:03 pm
Buy:Zetia.Seroquel.Ventolin.Wellbutrin SR.Zocor.Lipitor.Acomplia.Lasix.Cozaar.Amoxicillin.Advair.Lipothin.Nymphomax.Buspar.Female Cialis.Prozac.Benicar.SleepWell.Female Pink Viagra.Aricept….