LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-21-2011, 06:44 PM   #1
wolverene13
Member
 
Registered: May 2010
Location: Matiland, FL
Distribution: Debian Squeeze
Posts: 57

Rep: Reputation: 0
Using Squid to restrict access during certain hours, but only to certain sites


Hi,

I have been trying to get Squid to work so that I can restrict access to a particular web site during certain hours every night. I can't seem to get it working, however. I am still able to access the site. The following are the relevant lines from my squid.conf file:

acl restricted-domain dstdomain "/etc/squid/denied_domains.acl"
acl test time 19:00-20:00
acl bedtime time 22:00-23:59
acl nighttime time 00:00-05:00
http_access deny test
http_access deny restricted-domain bedtime
http_access deny restricted-domain nighttime
http_access deny all

http_access allow manager localhost
http_access deny manager

Thanks in advance.
 
Old 01-21-2011, 08:47 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Perhaps you need to specify the days even when it's all of them? Example:
Code:
acl test time SMTWHFA 19:00-20:00
EDIT: Actually, nevermind. I just saw an example of the Squid website where they don't specify the days so that's not going to be it. Do you have any http_access lines above these which might be conflicting?

Last edited by win32sux; 01-21-2011 at 08:50 PM.
 
Old 01-22-2011, 05:02 AM   #3
wolverene13
Member
 
Registered: May 2010
Location: Matiland, FL
Distribution: Debian Squeeze
Posts: 57

Original Poster
Rep: Reputation: 0
Figured it out

Ok, apparently, where the acl "localhost" is defined, 127.0.0.1/32 does not work for some reason. I had to make a new acl called localhost2 and put the actual IP of my eth0 port to get it to work. Then I had to add "http_access allow localhost2" as well. Solved. Thanks Win32sux for being the lone responder to my question.
 
Old 07-08-2012, 09:01 PM   #4
tetaguila
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by wolverene13 View Post
Ok, apparently, where the acl "localhost" is defined, 127.0.0.1/32 does not work for some reason. I had to make a new acl called localhost2 and put the actual IP of my eth0 port to get it to work. Then I had to add "http_access allow localhost2" as well. Solved. Thanks Win32sux for being the lone responder to my question.
Hi wolverine13, can you now post your new policy here? i have a similar problem now, my boss wants to limit the access of facebook from 11am-1pm and 6pm-8pm everyday. Better if you will give me an exact config based on this scenario. Tnx in advance.
 
Old 07-09-2012, 08:36 PM   #5
wolverene13
Member
 
Registered: May 2010
Location: Matiland, FL
Distribution: Debian Squeeze
Posts: 57

Original Poster
Rep: Reputation: 0
Glad to help!

Quote:
Originally Posted by tetaguila View Post
Hi wolverine13, can you now post your new policy here? i have a similar problem now, my boss wants to limit the access of facebook from 11am-1pm and 6pm-8pm everyday. Better if you will give me an exact config based on this scenario. Tnx in advance.
Sure, here it is, modified for your scenario:

Code:
#The contents of my "/etc/squid/denied_domains.acl" file:
.facebook.com

#Relevant ACL's from my squid.conf file:

acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32

#Below is the "localhost2" ACL I was referring to:

acl localhost2 src 10.10.20.3/32

#ACL to specify internal IP's
acl localnet src 10.0.0.0/16	# 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 for subnet that eth0 is in. Basically allows access from anything but 10.10.20.3 when combined with "localhost2" ACL 
acl restofnetwork src 10.10.20.0/24

#Specifies restricted domains
acl restricted-domain dstdomain "/etc/squid/denied_domains.acl"

#ACL to restrict between various times of day
acl midday time 11:00-13:00
acl evening time 18:00-20:00

# 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

#No Facebook between 11am and 1pm
http_access deny restricted-domain midday

#No Facebook between 6pm and 8pm
http_access deny restricted-domain evening

#Allows everything else anywhere
http_access allow localhost
http_access allow localhost2
http_access allow restofnetwork

# And finally deny all other access to this proxy
http_access deny all
The IP addresses are ones from my network, so you'll have to substitute IP's from yours
 
Old 07-11-2012, 08:11 PM   #6
tetaguila
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
Hi wolverine,

Thanks a lot for your effort to post it here with good explanation!

Regards,
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to restrict web accessing to different groups for different sites in squid 2.6 singh_chitranjan Linux - Server 1 05-19-2010 03:03 AM
how to restrict specific users to access restricted sites in squid subhojit Linux - Security 2 11-07-2009 10:15 AM
Using Squid to restrict access to sites asliyanage Linux - Security 7 07-27-2009 06:53 AM
Squid Problem (squid restrict some trusted sites.). jpmaxyusuf Linux - Networking 3 01-01-2009 11:33 AM
restrict access using squid, iptables? jgnasser Linux - Networking 3 04-13-2005 07:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:50 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration