Results 1 to 3 of 3

Thread: Iptables

  1. #1

    Question post-firewall error

    Hi,

    i have the following script in my /usr/local/sbin/post-firewall

    Code:
    1: #!/bin/sh
    2:
    3: ## Set default policy
    4: iptables -P INPUT DROP
    5: 
    6: ## Removes last default rule
    7: iptables -D INPUT -j DROP
    8: 
    9: ## Deny access to ftp from WAN
    10: iptables -D INPUT -p tcp -m tcp -d "$2" --dport 21 -j ACCEPT
    11: 
    12: ## Allow access to ssh from WAN
    13: iptables -A INPUT -p tcp --syn --dport 22 -j brute_force
    14: 
    15: ## Block ssh brute force attacks
    16: iptables -N brute_force
    17: iptables -F brute_force
    18: iptables -A brute_force -m state --state NEW -m recent --name attack --set
    19: iptables -A brute_force -m recent --name attack --rcheck --seconds 60 --hitcount 4 -m limit --limit 1/minute --limit-burst 1 -j LOG --log-prefix 'SSH brute force attack '
    20: iptables -A brute_force -m recent --name attack --rcheck --seconds 60 --hitcount 4 -j DROP
    21: iptables -A brute_force -j ACCEPT
    when i run it manually i get the following errors:

    --- 7 ---
    iptables: Bad rule (does a matching rule exist in that chain?)
    --- 10 ---
    iptables v1.2.7a: host/network `' not found
    Try `iptables -h' or 'iptables --help' for more information.
    --- 16 ---
    iptables: Chain already exists
    --- 18 ---
    iptables: No chain/target/match by that name
    --- 19 ---
    iptables: No chain/target/match by that name
    --- 20 ---
    iptables: No chain/target/match by that name

    Line 10 is ok because i don't give any arguments to post-firewall, and 16 because the chain allready does exist because of previous attempts.
    But i can't understand errors in line 7,18,19 and 20, specially the number 7. Could someone please help me out?


    Thank you.
    Last edited by byteZero; 10-09-2005 at 18:54.

  2. #2
    anyone ?

  3. #3
    I would suggest to load the module before adding rules with "recent". try this:
    insmod ipt_recent

Similar Threads

  1. iptables vs web interface
    By bomberman in forum WL-500g Q&A
    Replies: 0
    Last Post: 20-05-2005, 08:06
  2. Port Forwarding? iptables?
    By *Sorcerer* in forum WL-500g Q&A
    Replies: 7
    Last Post: 08-05-2005, 22:00
  3. Iptables
    By barsju in forum WL-500g Q&A
    Replies: 15
    Last Post: 01-03-2005, 01:36
  4. How do I save my changes to Iptables?
    By oyvindk in forum WL-500g Q&A
    Replies: 6
    Last Post: 23-02-2005, 13:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •