Poopiepants
Occasional Visitor
My telnet is not for the router, but for an old school bbs.
In this case there is no security issue.
In this case there is no security issue.
My telnet is not for the router, but for an old school bbs.
In this case there is no security issue.
iptables -t nat -I PREROUTING -p tcp -m tcp -s 10.10.10.10 --dport 3389 -j DNAT --to 192.168.1.100
-A FORWARD -i eth0 -m state --state INVALID -j DROP
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i ! br0 -o eth0 -j DROP
-A FORWARD -i br0 -o br0 -j ACCEPT
-A FORWARD -m conntrack --ctstate DNAT -j ACCEPT
-A FORWARD -i br0 -j ACCEPT
iptables -t nat -D PREROUTING -d 192.222.217.133/32 -j VSERVER
iptables -t nat -D PREROUTING -d 192.222.217.133/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.190:80
iptables -D FORWARD -m conntrack --ctstate DNAT -m set --match-set BlockedCountries src -j DROP
iptables -D FORWARD -m conntrack --ctstate DNAT -m set --match-set Blacklist src -j DROP
iptables -D FORWARD -m conntrack --ctstate DNAT -m set --match-set Maude src -j DROP
iptables -D FORWARD -m conntrack --ctstate DNAT -j ACCEPT
iptables -t nat -I PREROUTING -d 192.222.217.133/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.190:80
iptables -I FORWARD -m conntrack --ctstate DNAT -j ACCEPT
iptables -I FORWARD -m conntrack --ctstate DNAT -m set --match-set BlockedCountries src -j DROP
iptables -I FORWARD -m conntrack --ctstate DNAT -m set --match-set Blacklist src -j DROP
iptables -I FORWARD -m conntrack --ctstate DNAT -m set --match-set Maude src -j DROP
Well, I still need help:
I have the firewall code up and running and added some tweaks to it like the option of banning an IP block with Mask e.g. 188.143.0.0/16 from the program commande line. And added the M$ anti-spying code from the wiki at the end.
It DOES work splendidly for attackers that are going for ports OTHER than 80. See, I have a website that's running on port 80 and some people out there are trying to hack it. Since I'm using the PortForward option in the GUI to open the http port and redirect to my PC, I have no control over who's getting in...
Now, what I would desperately need is a way to use the banned ipset's to filter an iptables FORWARD and PREROUTING set of rules instead of the GUI.
I found some code in SNB threads, code like this:
combined with this:Code:iptables -t nat -I PREROUTING -p tcp -m tcp -s 10.10.10.10 --dport 3389 -j DNAT --to 192.168.1.100
Code:-A FORWARD -i eth0 -m state --state INVALID -j DROP -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i ! br0 -o eth0 -j DROP -A FORWARD -i br0 -o br0 -j ACCEPT -A FORWARD -m conntrack --ctstate DNAT -j ACCEPT -A FORWARD -i br0 -j ACCEPT
Conceptually, what I would like is a FORWARD rule that's accepting a NOT -m set --match-set Maude src
Can someone help ?
EDIT:
This is what I'm trying now with PortForward disabled:
Code:iptables -t nat -D PREROUTING -d 192.222.217.133/32 -j VSERVER iptables -t nat -D PREROUTING -d 192.222.217.133/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.190:80 iptables -D FORWARD -m conntrack --ctstate DNAT -m set --match-set BlockedCountries src -j DROP iptables -D FORWARD -m conntrack --ctstate DNAT -m set --match-set Blacklist src -j DROP iptables -D FORWARD -m conntrack --ctstate DNAT -m set --match-set Maude src -j DROP iptables -D FORWARD -m conntrack --ctstate DNAT -j ACCEPT iptables -t nat -I PREROUTING -d 192.222.217.133/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.190:80 iptables -I FORWARD -m conntrack --ctstate DNAT -j ACCEPT iptables -I FORWARD -m conntrack --ctstate DNAT -m set --match-set BlockedCountries src -j DROP iptables -I FORWARD -m conntrack --ctstate DNAT -m set --match-set Blacklist src -j DROP iptables -I FORWARD -m conntrack --ctstate DNAT -m set --match-set Maude src -j DROP
PS: I can share the changes I made to the code through the website... Just ask for it...
Thanks !
Maude
Did you read the release notes where it says ipset has changed?Version 380.63 seems to have broken this script on my 5300, anyone else having this issue?
Version 380.63 seems to have broken this script on my 5300, anyone else having this issue?
Thoughts?
As pointed out in another thread...
http://www.snbforums.com/threads/using-ipset-revisited.32817/#post-287431
This may get you headed in the right direction for the changes required.
Cheers!
Did you manage to get the script running for version 380.63? If so, could you please post the updated code, thanks!
#!/bin/sh
if [ "$(ipset --swap malware-filter malware-filter 2>&1 | grep -E 'Unknown set|The set with the given name does not exist')" != "" ]; then
# Load ipset modules
ipset -v | grep -i "v4" > /dev/null 2>&1
if [ $? -eq 0 ];
then
# old ipset
ipsetv=4
lsmod | grep "ipt_set" > /dev/null 2>&1 || \
for module in ip_set ip_set_nethash ip_set_iphash ipt_set
do
insmod $module
done
else
# new ipset
ipsetv=6
lsmod | grep "xt_set" > /dev/null 2>&1 || \
for module in ip_set ip_set_hash_net ip_set_hash_ip xt_set
do
insmod $module
done
fi
echo "0 * * * * /jffs/scripts/firewall save" > /var/spool/cron/crontabs/admin
[ -n "`pidof crond`" ] && killall -q crond
sleep 5
crond
sh /jffs/scripts/firewall
fi
Yes, but it has changed again in .65, which I am unable to look at due to other commitments, in .63, this is what I did in the firewall-start script.
Code:#!/bin/sh if [ "$(ipset --swap malware-filter malware-filter 2>&1 | grep -E 'Unknown set|The set with the given name does not exist')" != "" ]; then # Load ipset modules ipset -v | grep -i "v4" > /dev/null 2>&1 if [ $? -eq 0 ]; then # old ipset ipsetv=4 lsmod | grep "ipt_set" > /dev/null 2>&1 || \ for module in ip_set ip_set_nethash ip_set_iphash ipt_set do insmod $module done else # new ipset ipsetv=6 lsmod | grep "xt_set" > /dev/null 2>&1 || \ for module in ip_set ip_set_hash_net ip_set_hash_ip xt_set do insmod $module done fi echo "0 * * * * /jffs/scripts/firewall save" > /var/spool/cron/crontabs/admin [ -n "`pidof crond`" ] && killall -q crond sleep 5 crond sh /jffs/scripts/firewall fi
Let us know if it works for you.
Kind Regards
errr that's the script, see /jffs/scripts/firewall-start here: https://www.snbforums.com/threads/h...ng-ipset-firewall-addition.16798/#post-115872errr thats not malware-filter if your gonna copy paste stuff do it right
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!