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.
|
 |
|
02-26-2006, 02:49 PM
|
#1
|
LQ Newbie
Registered: Feb 2006
Distribution: SUSE 10.0 x64
Posts: 3
Rep:
|
How to ban question: Anyone know how?
Hi,
I using Suse 10.0 64 version. Was wondering how I use the firewall to ban a particular ip address. Is there a way to do this from the shell? If so what is the syntax?
the ip question is 86.84.109.31
Thank you, my server is under a DOS attack from this IP and any assistence would be greatly appreciated
|
|
|
02-26-2006, 03:10 PM
|
#2
|
Member
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 372
Rep:
|
as root:
Code:
iptables -I INPUT -s 86.84.109.31 -j DROP
|
|
|
02-26-2006, 03:11 PM
|
#3
|
Member
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 372
Rep:
|
What this does:
In the INPUT chain (where rules reside to match for packets getting into the machine), all packets that come from 86.84.109.31, it will be DROPPED..
|
|
|
02-26-2006, 03:12 PM
|
#4
|
Moderator
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696
|
iptables -A INPUT -s 86.84.109.31 -j DROP
The place of the IP is quite clear
Note: it adds a new rule to INPUT. If you already have a firewall configured it may be that the requests are already accepted before this rule is taken into consideration. So, if you have a firewall, put it close to the beginning of the INPUT section.
|
|
|
02-26-2006, 06:14 PM
|
#5
|
LQ Newbie
Registered: Feb 2006
Distribution: SUSE 10.0 x64
Posts: 3
Original Poster
Rep:
|
Noob question: Do I have to restart the firewall for the bans tork, if so how?
|
|
|
02-26-2006, 06:47 PM
|
#6
|
Senior Member
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250
Rep:
|
Of course when you reboot this rule as set out above will disappear, and have to be re-entered.
A better solution for the casual user is to use an IPTABLES front-end gui like Firestarter (Gnome) or Guarddog (KDE). Set the blocking rule up in one of those and it'll stay there. If you have a router, it's also easy to set such a rule up on that firewall.
|
|
|
02-26-2006, 07:37 PM
|
#7
|
Member
Registered: Dec 2005
Distribution: CentOS 5 - Debian 5
Posts: 112
Rep:
|
just save it
/sbin/iptables-save > /etc/sysconfig/iptables
and no need to restart
|
|
|
02-27-2006, 01:40 AM
|
#8
|
Member
Registered: Aug 2004
Location: Canada
Distribution: Archlabs
Posts: 65
Rep:
|
A good site to teach you basic IPTABLE stuff is here:
http://www.justlinux.com/nhf/Securit...es_Basics.html
Also if their ip is dynamic and not static, they just need to restart so they can DOS you again. So if you'd like to ban an entire range you would do:
iptables -A INPUT -s 86.84.0.0/16 -j DROP and thats the same as 86.84.*.*
86.0.0.0/24 would be 86.*.*.* respectively.
Hope that helps you too. I've never used firestarter I always type in my iptables manually or add it to a script ill execute on restart.
Also if you wanna look at your iptables, use the iptables -L command.
|
|
|
02-27-2006, 05:36 AM
|
#9
|
Member
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676
Rep:
|
iptables -I INPUT -s 86.84.109.31 -j DROP
This will add the rule as the first rule..this way you will guaranteet that there are no rules preceding this rule that cancel it out.
Note: -I takes nubmer for order...without a number the default is 1
|
|
|
02-27-2006, 11:32 AM
|
#10
|
Senior Member
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181
Rep:
|
-Fantastic- link, chibi 
|
|
|
04-11-2006, 10:21 AM
|
#11
|
Member
Registered: Aug 2003
Location: Washington State, USA
Distribution: Mainly RH 9.0
Posts: 227
Rep:
|
Thanks guys. This really helped me out when I found someone from China was trying to port scan me. I appreciate it!
Travis
|
|
|
04-11-2006, 02:04 PM
|
#12
|
Member
Registered: Mar 2005
Location: UK
Distribution: Slackware
Posts: 794
Rep:
|
There's also /etc/hosts.allow and hosts.deny which you can use to block connections.
|
|
|
04-11-2006, 02:46 PM
|
#13
|
Member
Registered: Aug 2003
Location: Washington State, USA
Distribution: Mainly RH 9.0
Posts: 227
Rep:
|
Quote:
Originally Posted by simcox1
There's also /etc/hosts.allow and hosts.deny which you can use to block connections.
|
Does Postfix use the hosts.deny and hosts.allow? or do I have to specify it in the main.cf file?
|
|
|
04-11-2006, 03:01 PM
|
#14
|
Member
Registered: Mar 2005
Location: UK
Distribution: Slackware
Posts: 794
Rep:
|
It's nothing to do with your mta. It's just another way to block specific hosts. Or allow them. If you look at the manuals for them it'll tell you more. I just thought I'd mention it. man 5 hosts_access and man 5 hosts_options.
|
|
|
04-11-2006, 04:53 PM
|
#15
|
Senior Member
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658
Rep:
|
As far as I know, Postfix doesn't have support for tcp_wrappers/libwrap and doesn't use host.allow/deny. You need to be very carefull when using tcp_wrappers to make sure that app in question actually uses it (things like Apache and Postfix don't by default). You can configure daemons to run through xinetd and use tcp_wrappers, but Postfix has it's own access control file for that purpose (/etc/postfix/access).
|
|
|
All times are GMT -5. The time now is 01:22 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
|
|