LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Search this Thread
Old 11-14-2004, 02:36 AM   #1
vmattila
LQ Newbie
 
Registered: Nov 2004
Location: Ikaalinen,Finland
Posts: 5

Rep: Reputation: 0
hosts.deny doesn't block an SSH attempt


Hello there,

I have written entries to /etc/hosts.allow and /etc/hosts.deny files to limit an access to our machine as suggested in the stickies of this forum.

In general, due the purpose of our server, I am unable to first deny all and then allow just certain hosts. I have anyway defined a few hosts that should never be accessing our box. Therefore the hosts.deny looks like this:
Code:
sshd: .cn, .cn.net, .cn.com, .jp, .jp.com, .pl, .com, .ar, .tw
sshd: UNKNOWN
hosts.allow has just a few lines defining certain IPs that I want never to be denied (my own computer etc).

Anyway, from the latest LogWatch I can pick rows like them:

Code:
sshd:
   Invalid Users:
      Unknown Account: 9 Time(s)
   Authentication Failures:
      nobody (es106.internetdsl.tpnet.pl ): 1 Time(s)
      unknown (ool-44c69595.dyn.optonline.net ): 9 Time(s)
First I tought that hosts.deny doesn't work at all. Anyway, I added a known complete host name to the file and then tried to access the server via that host - the connection was refused successfully. So, the hosts.deny works, on some level.

Why everything listed in hosts.deny are not blocked?

Thanks for your kind help =)

Ville

Last edited by vmattila; 11-14-2004 at 02:42 AM.
 
Old 11-14-2004, 09:43 AM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Maybe putting wildcards in front of the domain extensions would work..

Ex:

sshd: *.cn, *.cn.net, *.cn.com, *.jp, *.jp.com, *.pl, *.com, *.ar, *.tw
sshd: UNKNOWN
 
Old 11-14-2004, 09:51 AM   #3
vmattila
LQ Newbie
 
Registered: Nov 2004
Location: Ikaalinen,Finland
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by trickykid
Maybe putting wildcards in front of the domain extensions would work..
I will try that. According to the patterns section in the man page, "A string that begins with a `.' character. A host name is matched if the last components of its name match the specified pattern. For example, the pattern `.tue.nl' matches the host name `wzv.win.tue.nl'.". So it should work without wildcards too.

Well, I will try with the wildcards and report you the results.

Thanks!

Ville
 
Old 11-14-2004, 12:14 PM   #4
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 117Reputation: 117
make sure SSHD is using tcpwrappers. If it's not, hosts.deny doesn't do anything.
 
Old 11-14-2004, 12:18 PM   #5
vmattila
LQ Newbie
 
Registered: Nov 2004
Location: Ikaalinen,Finland
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by Matir
make sure SSHD is using tcpwrappers. If it's not, hosts.deny doesn't do anything.
Thanks Matir,

As I said in my first post, I added a known host to the hosts.deny and tried to access from that host the machine via ssh. The blocking worked without any problems. In a similar way when I added a domain (with and without wildcards) and tried to access from a machine under the domain, the connection was blocked.

So, in basics hosts.deny works fine. Just some connections do not match the hosts.deny settings even they should.

Ville
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hosts.allow & hosts.deny question... jonc Linux - Security 9 03-05-2005 09:41 PM
ssh and /etc/hosts.all & deny tebucky Linux - Security 8 01-27-2005 05:23 PM
Adding shell commands to hosts.deny and hosts.allow ridertech Linux - Security 3 12-29-2003 03:52 PM
SSH hosts.deny file WoodyH Linux - Security 1 10-11-2003 07:44 AM
hosts.deny and hosts.allow defaults? gui10 Linux - Security 5 12-20-2001 01:57 AM


All times are GMT -5. The time now is 04:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration