permit access on date/hour intervals and policy.conf problem

Franz Angeli franz.angeli at gmail.com
Tue May 19 19:27:21 CEST 2015


Hi,

i need to have assigned Start_Time value stored on Database in
Start_Time attribute used by check_validity on my policy.conf

i think some like:

check_validity {
     update control {
       System-Date := "%l"
Start_Time := "%{sql:SELECT value FROM radcheck WHERE username =
%{User-Name} and attribute = Start_Time}"
Stop_Time := "%{sql:SELECT value FROM radcheck WHERE username =
%{User-Name} and attribute = Stop_Time}"

but i think is an incorrect syntax



2015-05-19 19:20 GMT+02:00 Alan DeKok <aland at deployingradius.com>:
> On May 19, 2015, at 12:49 PM, Franz Angeli <franz.angeli at gmail.com> wrote:
>> I need to be able to specify an interval of date and time for
>> accessing through a captive portal connected to freeradius;
>>
>> for example testuser can use network from 2015-05-01 17:00:00 to
>> 2015-05-01 18:00:00
>>
>> i create 3 custom attributes:
>>
>> ATTRIBUTE System-Date 3002 integer
>> ATTRIBUTE Start_Time 3000 integer
>> ATTRIBUTE Stop_Time 3001 integer
>
>   These should probably be of type "date", and not "integer".  But it won't make a huge amount of difference.
>
>> System-Date to store system data
>>
>> Start_Time to assign a start auth period for user
>>
>> Stop_Time to assign the end of auithentication permission.
>
>   That's fine.
>
>> for provisioning purpose i use Freeradius + MySQL and in my radcheck
>> table i have for example:
>>
>> testuser | Cleartext-Password | := | testuser
>> testuser | Start_Time         | := | 1430499600
>> testuser | Stop_Time          | := | 1430503200
>
>   That should work.
>
>> to check account validity i add on policy.conf :
>
>   That should work, too.
>
>> freeradius start without error, System-Date take the correct value for
>> Date but Start_Time and Stop_Time in this way seems to work with a
>> file not mysql...(yes my default site has check_validity in authorize
>> section)
>
>   That's good.
>
>> I don't know how use a query to assign database stored value for
>> Start_Time and Stop_TIme, is it possbile? I need some examples...
>
>   You are assigning the values from the database.  That's what the entries in the radcheck table do.
>
>   Perhaps you could describe in more detail what you want.
>
>   Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list