LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   iptable rules to block https://www.facebook.com (https://www.linuxquestions.org/questions/linux-newbie-8/iptable-rules-to-block-https-www-facebook-com-919096/)

bala.linuxtech 12-07-2012 05:21 AM

Quote:

Originally Posted by adol83 (Post 4844341)
Keep in mind that a workaround to bypass bad dns entry are tools and programs like ultrasurf that allow you to use another dns.

Hi

Just block that work "Facebook" From your conf file using url_regx -i module

For example

ACL Section

# Acl Block_words url_regex -i "facebook"

Http Section

# http_access Block_words deny

Then restart your squid

Hope it will help you !!

Regards
Bala.Linuxtech

mandyapenguin 12-07-2012 10:04 AM

Quote:

Just block that work "Facebook" From your conf file using url_regx -i module
Dear bala.linuxtech,
As I have already told, this works only if we go through browser settings in each PC. Since I have configured it as transparent proxy and since each user is having sudo privileges in their PC they can remove browser settings and can access https://www.facebook.com. So found a way to completely block it from coolsg5636 post.
Code:

iptables -I FORWARD -p tcp -d dest_ip --dport des_port -j DROP
or even we can completely block all ports if we are suspecting that https://www.facebook.com is using other ports than 443, using
Code:

iptables -I FORWARD -d dest_ip -j DROP
The above rule worked me great and no one is able to access https://wwww.facebook.com since a year until/unless we allowed particular IP to access it or apart from some bypass softwares/sites. I am glad I could also blocked those too using the same way and also with squid ACLs.

mandyapenguin 12-07-2012 10:23 AM

Once again thank you all.

adol83 12-19-2012 04:41 AM

By the way,

What if you use a program like Ultraserf to bypass your proxy?

You could manage to workaround again that limit, or not?

mandyapenguin 12-19-2012 08:16 AM

Quote:

Originally Posted by adol83 (Post 4852696)
By the way,

What if you use a program like Ultraserf to bypass your proxy?

You could manage to workaround again that limit, or not?

As I know, finding out bypassing PC's destination IPs from firewall log and running
Code:

iptables -I FORWARD -d dest_ip -j DROP
is enough.

disappear 02-12-2013 04:21 AM

Hi to all,maybe this is off topic but i have to try to ask.I have 2 laptops,and i want to block traffic to facebook,from one to another.Commands which i used:
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -I PREROUTING -m tcp -p tcp -d www.facebook.com --dport 443 -j DROP
arpspoof -i wlan0 192.168.1.1 (gateway of my router)
but i have still access to facebook site,any ideas
regards

chaiklang9 11-18-2015 10:35 PM

iptables -I FORWARD -s 1.2.3.4 -m string --string facebook.com -j DROP --algo bm


All times are GMT -5. The time now is 11:19 AM.