macsat.com OpenWrt and ASUS WL Forum
January 08, 2009, 14:51:59 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length
News: Back to macsat.com
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: iptable gives errors trying to get SSH bruteforce work  (Read 1092 times)
0 Members and 1 Guest are viewing this topic.
nsn
Newbie
*
Offline Offline

Posts: 46


View Profile
« on: March 17, 2007, 15:23:09 PM »

I followed the tutorial and getting following logread:

Jan  1 00:00:20 (none) user.info : iptables: No chain/target/match by that name
Jan  1 00:00:21 (none) user.info : iptables v1.3.3: recent: you must specify one                                              of `--set', `--rcheck' `--update' or `--remove'
Jan  1 00:00:21 (none) user.info : Try `iptables -h' or 'iptables --help' for mo                                             re information.
Jan  1 00:00:21 (none) user.info : /etc/firewall.user: 22: --name: not found
Jan  1 00:00:21 (none) user.info : /etc/firewall.user: 23: SSH_BRUTE : not found
Jan  1 00:00:21 (none) user.info : iptables v1.3.3: recent: you must specify one                                              of `--set', `--rcheck' `--update' or `--remove'
Jan  1 00:00:21 (none) user.info : Try `iptables -h' or 'iptables --help' for mo                                             re information.
Jan  1 00:00:21 (none) user.info : /etc/firewall.user: 25: --name: not found
Jan  1 00:00:21 (none) user.info : iptables v1.3.3: recent: you must specify one                                              of `--set', `--rcheck' `--update' or `--remove'
Jan  1 00:00:21 (none) user.info : Try `iptables -h' or 'iptables --help' for mo                                             re information.
Jan  1 00:00:21 (none) user.info : /etc/firewall.user: 27: --name: not found
J

The \etc\firewall.user looks like:

root@OpenWrt:/etc# cat firewall.user
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org

iptables -F input_rule
iptables -F output_rule
iptables -F forwarding_rule
iptables -t nat -F prerouting_rule
iptables -t nat -F postrouting_rule

# The following chains are for traffic directed at the IP of the
# WAN interface

iptables -F input_wan
iptables -F forwarding_wan
iptables -t nat -F prerouting_wan

### Open port to WAN
## -- This allows port 22 to be answered by (dropbear on) the router
# iptables -t nat -A prerouting_wan -p tcp --dport 22 -j ACCEPT
# iptables        -A input_wan      -p tcp --dport 22 -j ACCEPT
iptables -t filter -A input_rule -i $WAN -p TCP --dport 22 -m recent
--name SSH --rcheck --hitcount 3 --seconds 120 -j LOG --log-prefix
"SSH_BRUTE "
 iptables -t filter -A input_rule -i $WAN -p TCP --dport 22 -m recent
--name SSH --update --hitcount 3 --seconds 120 -j DROP
 iptables -t filter -A input_rule -i $WAN -p TCP --dport 22 -m recent
--name SSH --set -j ACCEPT





### Port forwarding
## -- This forwards port 8080 on the WAN to port 80 on 192.168.1.2
# iptables -t nat -A prerouting_wan -p tcp --dport 8080 -j DNAT --to 192.168.1.2:80
# iptables        -A forwarding_wan -p tcp --dport 80 -d 192.168.1.2 -j ACCEPT

### DMZ
## -- Connections to ports not handled above will be forwarded to 192.168.1.2
# iptables -t nat -A prerouting_wan -j DNAT --to 192.168.1.2
# iptables        -A forwarding_wan -d 192.168.1.2 -j ACCEPT


Who can help me out...?
Logged
macsat
Administrator
Sr. Member
*****
Offline Offline

Posts: 1,104



View Profile
« Reply #1 on: March 19, 2007, 09:07:59 AM »


Did you remember to install the ipt_recent package, and to load the module ?

Code:
ipkg install iptables-mod-extra 


And then:
Code:
insmod ipt_recent
insmod ipt_LOG


If you want the modules to be loaded a boot time (you do want this!) do this:
Code:
echo "ipt_recent" >> /etc/modules
echo "ipt_LOG" >> /etc/modules

Logged
nsn
Newbie
*
Offline Offline

Posts: 46


View Profile
« Reply #2 on: March 21, 2007, 19:51:53 PM »

Thank you Macsat...
I was so stupid using cut and paste... Always remember that if you copy and paste you will/can get some ^M chars between it.

Due to these chars you don't see it did not work.

Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

English Steel 1.6 © Saxon North Technologies
Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.127 seconds with 24 queries.