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.
|
|
03-31-2006, 03:10 PM
|
#1
|
Member
Registered: Jan 2006
Posts: 51
Rep:
|
[B]how can i configure SSH to allow only the ip that i want?[/B]
sorry .. do you know .. how can i do it?
i have ip 10.41.0.146 in a lan and i want to accept
that 10.41.0.1 and 10.41.0.2 only connect to my computer by SSH and drop all others
do you know how to do it??
i use .. SLACKWARE 10.0
|
|
|
03-31-2006, 03:35 PM
|
#2
|
Member
Registered: Oct 2003
Location: Canada
Distribution: ArchLinux && Slackware 10.1
Posts: 298
Rep:
|
You need to use a iptables to filter connections.
If you are new to Linux you may want to sue some thing simple to set up your firewall. One very good and simple firewall is Firestarter.
Take a look here: http://www.fs-security.com/
|
|
|
03-31-2006, 04:50 PM
|
#3
|
Member
Registered: Sep 2002
Posts: 310
Rep:
|
This is off the top of my head, so might need a fix.
Code:
allow="
10.41.0.1
10.41.0.2
"
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
for ip in $allow; do
iptables -A INPUT -i eth0 -p tcp -s $ip --dport 22 -m state --state NEW -j ACCEPT;
done
|
|
|
03-31-2006, 10:03 PM
|
#4
|
Member
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468
Rep:
|
Or modify sshd to look for hosts.allow, but iptables is a good way to go (because it stops sshd from even hearding abot the connection if it's undesirable). Just offering an alternative
|
|
|
04-01-2006, 02:21 AM
|
#5
|
Member
Registered: Jan 2006
Posts: 51
Original Poster
Rep:
|
modify sshd -,,,,, which part?
thanks to all ... but i was looking for modify sshd ... host.allow
how is the way to do it?
|
|
|
04-01-2006, 06:15 PM
|
#6
|
Member
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468
Rep:
|
Well, `man sshd_config' and `man hosts.allow' are good places to start. They also include warnings...
|
|
|
04-02-2006, 08:12 AM
|
#7
|
LQ Newbie
Registered: Feb 2004
Location: UK
Posts: 22
Rep:
|
Quote:
Originally Posted by eder_michael11
thanks to all ... but i was looking for modify sshd ... host.allow
how is the way to do it?
|
in hosts.allow there should be something like this:
Code:
sshd: 10.41.0.1 10.41.0.2
and in hosts.deny:
|
|
|
04-03-2006, 11:41 AM
|
#8
|
Member
Registered: Jan 2006
Posts: 51
Original Poster
Rep:
|
ok thnks i will try it
|
|
|
04-04-2006, 12:51 PM
|
#9
|
Member
Registered: Jan 2006
Posts: 51
Original Poster
Rep:
|
doesnt work hosts.allow and hosts.deny
sorry but .. i did that and my computer continues accepting
conexions by ssh from the host that i dont want
i modify hosts.allow like this
sshd: 10.41.0.1 10.41.0.2
and hosts.deny
sshd: ALL
and doesnt work
do i have to modify some thing at sshd_config?
or what is happening?
|
|
|
04-04-2006, 01:19 PM
|
#10
|
Member
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 548
Rep:
|
for hosts.deny we use:
All:All
to deny traffic of All kinds. Maybe that'll help.
|
|
|
04-05-2006, 11:43 AM
|
#11
|
Member
Registered: Jan 2006
Posts: 51
Original Poster
Rep:
|
doesnt work at hosts.deny
ALL: ALL
i think that i have to do something more... it seems too easy just puting at
hosts.allow
sshd: 10.41.0.1
hosts.deny
ALL:ALL
i dont know maybe we are missing to modify other file or ... i dont know .. but doesnt work
i found a way editing sshd_config
AllowUsers root@10.41.0.1
DenyUsers ?*?
..............
it seems that works but i would like to do it from the files hosts.allow and deny ....
|
|
|
04-05-2006, 07:49 PM
|
#12
|
Senior Member
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: Custom Debian Live ISO's
Posts: 1,291
Rep:
|
The /etc/hosts.deny and /etc/hosts.allow file should work, maybe tcpwrappers is not installed or not install properly.
Last edited by fotoguy; 04-05-2006 at 07:51 PM.
|
|
|
All times are GMT -5. The time now is 03:19 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
|
|