LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-24-2013, 02:26 PM   #16
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50

have you tried to block facebook via iptables (-m string):
http://blog.mynux.net/2011/08/iptabl...-facebook.html
 
Old 02-25-2013, 05:29 AM   #17
contozo
LQ Newbie
 
Registered: Jan 2013
Posts: 16

Rep: Reputation: Disabled
Why you dont try making an alias and block access to it? I did in this way on pfsense box and it works, think can work in linux too, but if you block it with alias non will be aviable to access facebook, even if you have PC's wich are not filtered in proxy.
 
Old 09-03-2013, 04:42 AM   #18
skyfly
LQ Newbie
 
Registered: Apr 2004
Location: Johannesburg, South Africa
Distribution: Redhat Fedora Slackware
Posts: 7

Rep: Reputation: 0
Block Facebook with iptables

Let's say your LAN IP range is 10.1.1.0/24 then:


### Block connections to Facebook #########################################################################

IPT="/sbin/iptables"

$IPT -A OUTPUT -p tcp -m string --string "facebook.com" --algo kmp -j DROP
$IPT -A FORWARD -d facebook.com -j DROP

echo "Obtaining Facebook IP ranges from whois..."

RESULT=$( /usr/bin/whois -h whois.radb.net '!gAS32934' | tr ' ' '\n' | sort -n -k1,1 -k2,2 -k3,3 -k4,4 )

arr=$(echo $RESULT | tr " " "\n")

if [ -f facebookips ] ; then
rm -f facebookips
fi

for x in $arr
do
echo "$x" >> facebookips
done

tail -n +6 facebookips > tmp.tmp
mv tmp.tmp facebookips

y=0

while read line
do
(( y++ ))
$IPT -I FORWARD -s 10.1.1.0/24 -d $line -j DROP
$IPT -A INPUT -p tcp -d $line --dport 443 -j REJECT
done <facebookips

echo "$y Facebook IP ranges blocked."

#################################################################################################### #######

Last edited by skyfly; 09-03-2013 at 04:44 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] iptable rules to block https://www.facebook.com mandyapenguin Linux - Newbie 20 02-12-2013 04:21 AM
Most YouTube videos and Facebook games won't play. LinuxLiker Linux - Software 13 04-19-2012 08:54 AM
Try to block https://facebook.com but cannot able to do this yet tanin007 Linux - Software 10 01-13-2012 08:09 AM
[SOLVED] how to deny block https sites for some users Winanjaya Linux - Security 10 11-30-2009 11:36 PM
deny access to youtube.com 7mza Linux - Networking 3 01-20-2009 04:48 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration