LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-26-2006, 02:49 PM   #1
Lazy
LQ Newbie
 
Registered: Feb 2006
Distribution: SUSE 10.0 x64
Posts: 3

Rep: Reputation: 0
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
 
Old 02-26-2006, 03:10 PM   #2
rhoekstra
Member
 
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 372

Rep: Reputation: 42
as root:
Code:
iptables -I INPUT -s 86.84.109.31 -j DROP
 
Old 02-26-2006, 03:11 PM   #3
rhoekstra
Member
 
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 372

Rep: Reputation: 42
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..
 
Old 02-26-2006, 03:12 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
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.
 
Old 02-26-2006, 06:14 PM   #5
Lazy
LQ Newbie
 
Registered: Feb 2006
Distribution: SUSE 10.0 x64
Posts: 3

Original Poster
Rep: Reputation: 0
Noob question: Do I have to restart the firewall for the bans tork, if so how?
 
Old 02-26-2006, 06:47 PM   #6
rickh
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: Reputation: 62
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.
 
Old 02-26-2006, 07:37 PM   #7
piforever
Member
 
Registered: Dec 2005
Distribution: CentOS 5 - Debian 5
Posts: 112

Rep: Reputation: 15
just save it

/sbin/iptables-save > /etc/sysconfig/iptables

and no need to restart
 
Old 02-27-2006, 01:40 AM   #8
chibi
Member
 
Registered: Aug 2004
Location: Canada
Distribution: Archlabs
Posts: 65

Rep: Reputation: 15
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.
 
Old 02-27-2006, 05:36 AM   #9
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676
Blog Entries: 7

Rep: Reputation: 32
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
 
Old 02-27-2006, 11:32 AM   #10
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
-Fantastic- link, chibi
 
Old 04-11-2006, 10:21 AM   #11
tbeehler
Member
 
Registered: Aug 2003
Location: Washington State, USA
Distribution: Mainly RH 9.0
Posts: 227

Rep: Reputation: 30
Thanks guys. This really helped me out when I found someone from China was trying to port scan me. I appreciate it!

Travis
 
Old 04-11-2006, 02:04 PM   #12
simcox1
Member
 
Registered: Mar 2005
Location: UK
Distribution: Slackware
Posts: 794
Blog Entries: 2

Rep: Reputation: 30
There's also /etc/hosts.allow and hosts.deny which you can use to block connections.
 
Old 04-11-2006, 02:46 PM   #13
tbeehler
Member
 
Registered: Aug 2003
Location: Washington State, USA
Distribution: Mainly RH 9.0
Posts: 227

Rep: Reputation: 30
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?
 
Old 04-11-2006, 03:01 PM   #14
simcox1
Member
 
Registered: Mar 2005
Location: UK
Distribution: Slackware
Posts: 794
Blog Entries: 2

Rep: Reputation: 30
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.
 
Old 04-11-2006, 04:53 PM   #15
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
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).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-Ban in SSH damicatz Linux - Security 3 04-23-2005 07:45 PM
vsftpd ban IP dsgdevil Linux - Software 5 06-01-2004 11:44 PM
using iptables to ban a subnet? Sm0k3 Linux - Networking 4 01-24-2004 03:25 PM
(Using Apache) How to IP ban? Onox Linux - Software 1 07-02-2003 05:05 PM
how do i ban messenger programs? antken Linux - Networking 5 09-18-2002 06:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration