Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-14-2004, 02:36 AM
|
#1
|
LQ Newbie
Registered: Nov 2004
Location: Ikaalinen,Finland
Posts: 5
Rep:
|
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.
|
|
|
11-14-2004, 09:43 AM
|
#2
|
LQ Guru
Registered: Jan 2001
Posts: 24,149
|
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
|
|
|
11-14-2004, 09:51 AM
|
#3
|
LQ Newbie
Registered: Nov 2004
Location: Ikaalinen,Finland
Posts: 5
Original Poster
Rep:
|
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
|
|
|
11-14-2004, 12:14 PM
|
#4
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
make sure SSHD is using tcpwrappers. If it's not, hosts.deny doesn't do anything.
|
|
|
11-14-2004, 12:18 PM
|
#5
|
LQ Newbie
Registered: Nov 2004
Location: Ikaalinen,Finland
Posts: 5
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 04:37 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|