2014-09-05 - POC - Activate on First login (Or expiry from first login)

Header Data

From: Timothy White <ti***8@gmail.com>
Message Hash: 03a0b49ea49c42f28248ee5530afb272ed22e66d5b624bd89134704678b2b646
Message ID: <CAESLx0+hPPKEfVicr66E3xBVeeiPAUafhmxuGyA7v8mzxqkqVA@mail.gmail.com>
Reply To: N/A
UTC Datetime: 2014-09-05 20:16:51 UTC
Raw Date: Sat, 06 Sep 2014 13:16:51 +1000

Raw message

As many of you have requested, it would be nice to have a voucher expire a
certain amount of time from first use. For example, a 24 hour voucher from
first use.
https://github.com/GraseHotspot/grase-www-portal/issues/39

I have hopefully worked out the initial part, which is the Perl module that
Freeradius uses. I've created a new attribute called GRASE-ExpireAfter
which takes a string describing the relative date/time of when the account
should expire from first login. The format of the string should be the same
as the current Expiry string we set in the groups, however it's parsed by
the Perl parsedate function so may be slightly different. (
http://search.cpan.org/~muir/Time-ParseDate-2013.1113/lib/Time/ParseDate.pm
).

There is currently no GUI to the system, and there is no regular cronjob
which will be needed for relative expiries greater than 1 month. (Currently
due to how the archiving of the radacct table occurs, when the archiving
occurs the required data is lost and the relative expiry will be reset).

An example SQL command to give a relative expiry of 1 day from first use is:

INSERT INTO `radius`.`radcheck` (`UserName`, `Attribute`, `op`, `Value`)
VALUES ('tim', 'GRASE-ExpireAfter', ':=', '+1 day');

If you are using nightlies, the grase-conf-freeradius package should update
for you with "apt-get update; apt-get upgrade"

If you are using the stable version, and wish to be daring, you should be
able to manually install the grase-conf-freeradius package from the
nighlies without breaking anything. Find the latest version at
http://nightly.packages.grasehotspot.org/pool/main/g/grase-conf-freeradius/
(anything after 1.9.4.9 should work). You'll need to manually install
the libtime-modules-perl package first though.

Let me know how the initial step works, and if I've broken anything without
realising.

Thanks

Tim

Thread