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-07-2006, 06:43 AM
|
#1
|
LQ Newbie
Registered: Oct 2006
Posts: 13
Rep:
|
TCPwrappers and user access
Hi, I have the following configuration on my hosts.deny and hosts.allow:
/etc/hosts.deny
ALL : ALL
/etc/hosts.allow
ALL : 127.0.0.1
What I want is to allow a specific user to connect to ssh server from anywhere, something like:
sshd: <usrname>@ALL
but this isn't working, can someone tell me how to do this?
Thanks,
Bruno
|
|
|
11-07-2006, 07:32 AM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
tcpwrappers can not know what a user name is, that's something handled by the daemon it is wrapping, and at TCP level there is no such concept as a user name. tcpwrappers does support RFC931 http://www.faqs.org/rfcs/rfc931.html but that itself relies on finger services on the client side to tell tcpwrappers outside of the appliction who the user is. it's really no use unless you control both the client and the server.
Last edited by acid_kewpie; 11-07-2006 at 07:34 AM.
|
|
|
11-07-2006, 07:38 AM
|
#3
|
Moderator
Registered: May 2001
Posts: 29,415
|
/etc/hosts.allow
ALL : 127.0.0.1
You'll have to add a line with the first argument set to the argv[0] of the binary ("sshd" in this case) and allow the subnets the user is allowed from. With "/24" subnet type notation just chop of the last octet. Example with subnet "11.22.33.44":
sshd: 127.0.0.1, 11.22.33.,
This will allow anyone with access through ssh to connect. "man 5 hosts_access" for more info.
Also make sure your firewall policy reflects this policy.
Now set in sshd_config the AllowUsers directive to "user@host" and make sure you include all the users that are allowed in. (You can also use the PAM listfile module instead, but that only works with usernames, no hosts, unless you also set access.conf.) If you want to further restrict subnets this user is allowed in from you can add "from="127.0.0.1,11.22.33.44"" to the users ~/.ssh/authorized_keys key entry, unless the user needs to change (add authed keys to) the file.
|
|
|
11-07-2006, 08:12 AM
|
#4
|
LQ Newbie
Registered: Oct 2006
Posts: 13
Original Poster
Rep:
|
Quote:
Originally Posted by unSpawn
/etc/hosts.allow
ALL : 127.0.0.1
You'll have to add a line with the first argument set to the argv[0] of the binary ("sshd" in this case) and allow the subnets the user is allowed from. With "/24" subnet type notation just chop of the last octet. Example with subnet "11.22.33.44":
sshd: 127.0.0.1, 11.22.33.,
This will allow anyone with access through ssh to connect. "man 5 hosts_access" for more info.
Also make sure your firewall policy reflects this policy.
|
But I want to access from several different places, not only a subnet, and my firewall policy is according.
Can I take this approach:
sshd : ALL
and allow only my username using sshd_config?
Also, can I change ALL : 127.0.0.1 to ALL : LOCALHOST? Is it the same?
Thanks for all.
Last edited by blackcat_73; 11-07-2006 at 08:15 AM.
|
|
|
11-07-2006, 08:16 AM
|
#5
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
absolutely, yes. it's not until you get to ssh itself that the idea of a username comes into existance, but once it has you can certainly leverage a combination of tcpwrappers and sshd_config to control things quite tightly.
|
|
|
All times are GMT -5. The time now is 01:06 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
|
|