Linux Netfilter discussions
 help / color / mirror / Atom feed
From: cky@arcor.de
To: netfilter@lists.netfilter.org
Subject: Re: Dinamic (www list) IP BAN ...
Date: Thu, 22 Apr 2004 19:16:57 +0200 (CEST)	[thread overview]
Message-ID: <19160336.1082654217586.JavaMail.ngmail@webmail07.arcor-online.net> (raw)

Hi,

just write a little script and call it by a cronjob every 30 minutes or so.

I assume your banlistfile is splitted into 2 or more tables (as you show), like:

192.168.0.3     #comment 1
10.10.3.2         #comment 2
192.168.44.2   #comment 3

and so on.

So take a look at this (very simple) script (if you've more iptables rules, you've to change the script, of course):


#!/bin/bash

banfile="/path/to/banlist.txt"

iptables -F
iptables -Z

for ip in `cat $banfile | awk '{print $1}'`; do
	iptables -A INPUT -s $ip -j DROP
done


That's all.


Best regards,
Thomas


On Thu, 22 Apr 2004 17:47:19 +0100
Roque <roque@lpgc.net> wrote:

> Hi all, i wonder if someone could help me with a little problem ...
> I need to ban a number of IP´s that are posted in a plain text file on
> a web site; the file changes every 30Min. The file is as simple as
> 
> banned-ip1    #Reason1
> banned-ip2    #Reason
> ...
> 
> The url can be reached in this way: http://www.url.com/ip/banned.txt
> 
> I have read the iptables man pages and haven´t seen nothing similar.
> Is it really posible to do so?
> Thanks in Advance. roque@lpgc.net







             reply	other threads:[~2004-04-22 17:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-22 17:16 cky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-04-22 16:47 Dinamic (www list) IP BAN Roque
2004-04-22 17:00 ` Frank Gruellich
2004-04-22 17:07 ` Antony Stone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19160336.1082654217586.JavaMail.ngmail@webmail07.arcor-online.net \
    --to=cky@arcor.de \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox