Limiting and redirect port access with useragent

Posted by linuxcore on Server Fault See other posts from Server Fault or by linuxcore
Published on 2012-06-05T19:06:09Z Indexed on 2012/06/07 10:42 UTC
Read the original article Hit count: 260

Filed under:
|
|
|

I'm trying to write iptables string match rule To block http://domain.com:8888 and https://domain.com:8888 when it matches the supplied string in the rule. And another rule to redirect the ports also from 8888 to 7777

I tried following rules but unfortunately didn't work

iptables -A INPUT -p tcp -s 0.0.0.0/0 -m string --string linuxcore --algo bm --sport 8888 -j DROP

iptables -t raw -A PREROUTING -m string --algo bm --string linuxcore -p tcp -i eth0 --dport 8888 -j DROP

iptables -t nat -A PREROUTING -p tcp --dport 8888 -m string --algo bm --string "linuxcore" -j REDIRECT --to-port 7777

iptables -A INPUT -t nat -p tcp --dport 8888 -m string --algo bm --string "linuxcore" -j DROP

I want to do this from iptables not the webserver because the server may not have a webserver and those ports are working on internal proxy or something like ..etc

© Server Fault or respective owner

Related posts about linux

Related posts about centos