Linux - SecurityThis 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.
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.
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.
/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.
/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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.