So here is a perfect solution:
What you need:
- linux router for your network
- iptables firewall at least v1.3.7
Here are the rules:
Deny Yahoo Messenger packets:
iptables -I FORWARD -m string --string 'YMSG' --algo bm -j DROP
iptables -I FORWARD -m string --string 'messenger' --algo bm -j DROP
iptables -I FORWARD -m string --string 'meebo' --algo bm -j DROP
iptables -I FORWARD -m string --string 'buddy' --algo bm -j DROP
iptables -I FORWARD -m string --string 'webmessenger' --algo bm -j DROP
iptables -I FORWARD -m string --string 'web-messenger' --algo bm -j DROP
Deny facebook traffic rule:
iptables -I FORWARD -m string --string 'facebook' --algo bm -j DROP
Deny hi5 traffic rule:
iptables -I FORWARD -m string --string 'hi5' --algo bm -j DROP
and so on… you can modify these rules to fit your needs, you just need to edit the –string parameter
--string '
Using this solution to filter specified traffic you don’t have to worry about port, protocol, application , source or destination.
Hope it helps someone.
6 comments:
Thaaaaannnnks!!!
I've tried to block these sites many times with no success. But now this is working fine.
Regards
Really working rules. Thank a lot
thanks
i was struggling to block facebook
this help me lot
I've found this post really helpful. This is simple, neat and easy, thank you very much!
i still cannot block facebook via string command
It won't work when the remote side is HTTPS as iptables doesn't get to see the plaintext strings. So, it's kind of useless these days unless you block all HTTPS traffic as well.
Post a Comment