Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
01-25-2013, 08:20 PM
|
#1
|
LQ Newbie
Registered: Jan 2013
Posts: 13
Rep: 
|
How to deny access to https youtube,facebook
Hello, Im having a problem on blocking https access to youtube and facebook....
Im running squid proxy in transparent mode....
they say you cant block https on certain sites like youtube and facebook if squid is in transparent mode.
this thread says its possibles using iptables but he didnt posted how..
http://www.linuxquestions.org/questi...-squid-750621/
anybody know how to do it?
heres my IPTABLES:
Quote:
# Generated by iptables-save v1.4.7 on Thu Jan 24 14:24:59 2013
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.100.1:3128
-A POSTROUTING -o eth1 -j MASQUERADE
COMMIT
# Completed on Thu Jan 24 14:24:59 2013
# Generated by iptables-save v1.4.7 on Thu Jan 24 14:24:59 2013
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [26:3295]
-A INPUT -i eth1 -p icmp -m icmp --icmp-type 8 -j DROP
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp --dport 3128 -j ACCEPT
-A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth0 -o eth1 -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 25 -j ACCEPT
COMMIT
# Completed on Thu Jan 24 14:24:59 2013
|
and my squid.conf:
Quote:
#
# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
#ACL blocksites
acl blocksites dstdomain "/etc/squid/blockedsites.squid"
#ACL blockkeywords
acl blockkeywords url_regex -i "/etc/squid/blockkeywords.squid"
# Allow Yahoo Messenger
acl YIM_ports port 5050
acl YIM_domains dstdomain .yahoo.com .yahoo.co.jp
acl YIM_hosts dstdomain scs.msg.yahoo.com cs.yahoo.co.jp
acl YIM_methods method CONNECT
http_access allow YIM_methods YIM_ports YIM_hosts
http_access allow YIM_methods YIM_ports YIM_domains
#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
# Deny access to blocksites ACL
http_access deny blocksites
# Deny access to blockkeywords ACL
http_access deny blockkeywords
http_access deny manager
# Deny requests to certain unsafe ports
http_access deny !Safe_ports
# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
http_access deny all
# Squid normally listens to port 3128
http_port 3128 intercept
# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?
# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/spool/squid 32 16 256
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid
# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
# set visible_hostname (specify hostname)
visible_hostname squid.prototype.commm
|
|
|
|
01-26-2013, 03:24 AM
|
#2
|
Member
Registered: Aug 2008
Distribution: Devuan; Gentoo; FreeBSD
Posts: 239
Rep:
|
talkblock
have you tried hosts file for local block? or you could create dns entry pointing to 404.
|
|
|
01-26-2013, 04:45 AM
|
#3
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Question, do you want to block youtube and facebook or just ssl access to those sites?
|
|
|
01-27-2013, 09:36 PM
|
#4
|
LQ Newbie
Registered: Jan 2013
Posts: 13
Original Poster
Rep: 
|
i want to block both http and https access to those site...Ive already managed to block only http.. Now users found a way to access and that's through https..
|
|
|
01-27-2013, 09:37 PM
|
#5
|
LQ Newbie
Registered: Jan 2013
Posts: 13
Original Poster
Rep: 
|
Quote:
Originally Posted by darthaxul
have you tried hosts file for local block? or you could create dns entry pointing to 404.
|
kindly tell me how to do that. Please... 
|
|
|
01-28-2013, 04:59 AM
|
#6
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Why not use nslookup to determine the IP addresses of Youtube and facebook and block the IP addresses in iptables. Or add the domains to the acl lists for squid.
According to your configuration, the block list is at
acl blocksites dstdomain "/etc/squid/blockedsites.squid"
Have entries like
.youtube.com
.facebook.com
|
|
|
01-28-2013, 09:33 PM
|
#7
|
LQ Newbie
Registered: Jan 2013
Posts: 13
Original Poster
Rep: 
|
Quote:
Originally Posted by jschiwal
Why not use nslookup to determine the IP addresses of Youtube and facebook and block the IP addresses in iptables. Or add the domains to the acl lists for squid.
According to your configuration, the block list is at
acl blocksites dstdomain "/etc/squid/blockedsites.squid"
Have entries like
.youtube.com
.facebook.com
|
it didn't work on squid
|
|
|
01-28-2013, 11:00 PM
|
#8
|
Member
Registered: Aug 2005
Location: Malaysia - KULMY / CNXTH
Distribution: Slackware, Fedora, FreeBSD, Sun O/S 5.10, CentOS
Posts: 787
Rep:
|
Could you try edit the /etc/hosts
127.0.0.1 facebook.com
127.0.0.1 youtube.com
|
|
|
01-28-2013, 11:52 PM
|
#9
|
LQ Newbie
Registered: Jan 2013
Posts: 13
Original Poster
Rep: 
|
Quote:
Originally Posted by routers
Could you try edit the /etc/hosts
127.0.0.1 facebook.com
127.0.0.1 youtube.com
|
what am i gonna suppose to do with this?add it to the host? or to the host deny?
|
|
|
01-29-2013, 12:03 AM
|
#10
|
Member
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Rep: 
|
Adding the entry in your hosts could able to block facebook & youtube access on Just on the pc which you had made host entry .You want to block facebook & youtube on all user pc configure squid .
Make a entry in squid configuration file to block facebook & youtube.
acl badsite dstdomain .facebook.com .youtube
http_reply_access deny badsite
http_access deny CONNECT badsite
|
|
|
01-29-2013, 12:43 AM
|
#11
|
LQ Newbie
Registered: Jan 2013
Posts: 13
Original Poster
Rep: 
|
Quote:
Originally Posted by arun5002
Adding the entry in your hosts could able to block facebook & youtube access on Just on the pc which you had made host entry .You want to block facebook & youtube on all user pc configure squid .
Make a entry in squid configuration file to block facebook & youtube.
acl badsite dstdomain .facebook.com .youtube
http_reply_access deny badsite
http_access deny CONNECT badsite
|
thank you for this but, it didnt work at all.... im running squid in transparent mode...
|
|
|
02-01-2013, 08:55 PM
|
#12
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Editing /etc/hosts will only redirect the addresses on the proxy device.
|
|
|
02-01-2013, 08:57 PM
|
#13
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Did you edit /etc/squid/blockedsites.squid?
|
|
|
02-02-2013, 12:17 AM
|
#14
|
Member
Registered: Aug 2012
Distribution: Debian, CentOS
Posts: 74
Rep: 
|
Quote:
# Squid normally listens to port 3128
http_port 3128 intercept
|
From the above config. it seems your are trying to use squid as a transparent proxy.
Quote:
-A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.100.1:3128
|
From the this iptable rule your are redirecting only port 80 ie. HTTP traffic to the squid proxy, hence the HTTPS traffic isn't getting redirected to Squid.
Redirecting HTTPS traffic could get a bit tricky, you might need ure users to import certificates in their browsers before you do that.
|
|
|
02-22-2013, 01:04 AM
|
#15
|
LQ Newbie
Registered: Jan 2013
Posts: 13
Original Poster
Rep: 
|
i still cant find a way to do this...some say a script would do the trick... anybody got one?
|
|
|
All times are GMT -5. The time now is 03:46 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|