Search squid archive

Re: Account expiry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please do not reply to an existing question when asking a new question.
Changing the subject is not sufficient, your message is still a response
to the original, and gets threaded as such in thread aware mail clients
and mail archives.

On tor, 2008-07-03 at 11:32 +0800, Patrick G. Victoriano wrote:

> I want to give access a certain user to the internet at a certain date. What config should I enter to my conf to implement this
> setup

Here is two options. Either place the restriction in whatever user
database you are using, only keeping the account enabled at those dates,
or build the restriction using acl's in squid.conf.

Now, Squid acls as such is a little limited in this regards as it
doesn't support dates, only days of the week and time. But It's
reletively trivial to extend with an external acl evaluating the time..


Example external acl helper for date checks. Used like

external_acl_type datecheck /path/to/datecheck.sh

acl user_a_dates external datecheck startdate enddate

where startdate and enddate is given like YYYYMMDD where YYYY is year,
MM is month and DD is day.

### cut here ###
#!/bin/sh
while read start end; do
	today=`date +%Y%m%d`
	if [ $start -le $today && $end -ge $today ]; then
		echo OK
	else
		echo ERR
	fi
done
### END CUT ###

Depending on how the timezone is configured on your server you MAY need
to add a TZ variable in the beginning of the script defining your
timezone. But normally not needed.

TZ=yourtimezone
export TZ


Regards
Henrik

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux