Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two kinds of users accessing squid. I want the first group can access always internet, the second should only be allowed to access internet at certain times.

I have users on the same file (created with htpasswd).

How can achieve this?

Thanks in advance,

share|improve this question

1 Answer 1

up vote 1 down vote accepted

First of all you have to set up authentication

Add the following to the authentication section of your squid.conf

auth_param basic program /usr/lib/squid/ncsa_auth /usr/local/etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 8 hours

You will want to change the path to the password file to match your password file location. You may want to change the credentialsttl if you want people to authenticate more frequently.

In the a ACL section of your squid.conf add the following

acl allowed_anytime proxy_auth "/usr/local/etc/squid/allowed_anytime"
acl allowed_by_time proxy_auth "/usr/local/etc/squid/allowed_by_time"

acl allow_hours time SMTWHFA 09:00-17:00

http_access allow  allowed_anytime

http_access allow allowed_by_time allow_hours

http_access deny all

You may want to create your allowed_anytime and allowed_by_time elsewhere so change the paths above.

The file allowed_anytime should contain a list of users who can use the internet all the time e.g.

user1
user2
user3
...

The file allowed_by_time should contain a list of users who can use the internet during the time specified by the allow_hours acl e.g.

user4
user5
user6
user7
...
share|improve this answer
    
Thanks, it helped a lot! –  Ramon Araujo Feb 28 '11 at 23:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.