1

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,

Ramon Araujo
  • 113
  • 1
  • 6

1 Answers1

1

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
...
user9517
  • 114,104
  • 20
  • 206
  • 289