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.
1. you want ssh connection from your machine to be allowed, but only from a particular net? I think that's something like:
iptables -A INPUT -p tcp -i eth1 -s x.x.x.0\24 -j ACCEPT -dport 22
2. so similarily:
iptables -A INPUT -p tcp -i eth0 -j ACCEPT -dport 22
if eth1 is x.x.x.x and eth0 is y.y.y.y
Last edited by Simon Bridge; 02-04-2007 at 05:46 PM.
2. allow all incoming port 22 traffic to the y.y.y.y interface
Thanks for any help.
In the configuration file for the ssh server /etc/ssh/sshd.config you can set the ssh server to only listen on the ipaddress of the interface you specify, it will then refuse connection on any other interface. For example if you ssh server runs and ipaddress of 192.168.1.1 you would have something like this:
Glad to help out, if you would like to make it even more secure you can change the default port that ssh listens on to a completely different port. In the /etc/ssh/sshd.config you will see the #Port 22, just remove the hash symbol (uncomment), change the port to anything eg. Port 6893 then restart the ssh server and it will now listen to port 6893 for connectiosn.
Glad to help out, if you would like to make it even more secure you can change the default port that ssh listens on to a completely different port. In the /etc/ssh/sshd.config you will see the #Port 22, just remove the hash symbol (uncomment), change the port to anything eg. Port 6893 then restart the ssh server and it will now listen to port 6893 for connectiosn.
hi, i don't mean to nit-pick, but i just wanted to comment that, technically speaking, changing the port ssh listens on has absolutely no effect as far as security is concerned... obscurity doesn't give more security...
but yes, having it listen on another port does have its benefits, such as making an ssh daemon less prone to getting picked-up by spiders, etc... but that's not in any way shape or form an increase in the security level...
hi, i don't mean to nit-pick, but i just wanted to comment that, technically speaking, changing the port ssh listens on has absolutely no effect as far as security is concerned... obscurity doesn't give more security...
but yes, having it listen on another port does have its benefits, such as making an ssh daemon less prone to getting picked-up by spiders, etc... but that's not in any way shape or form an increase in the security level...
Yes that is true, I should have said that it will help to minimise the threats from automated programs/scripts which target port 22 by default.
It ain't working, just because "-t" stands for "table".
so the rules gotta be :
iptables -P INPUT DROP
#default policy of the chain
iptables -A INPUT -p tcp --dport 22 -i eth1 -s x.x.x.x -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -i eth0 -j ACCEPT
#any other allowed ports go below(may use multiport..)
iptables -A INPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.