FreeRadius + Captive Portal Expiration counter



  • Hello,

    I'm trying to figure out how to set the expiration attribute of Freeradius to a specific time after the users first logon through the Captive Portal. Basically creating a continuous count of the session.

    Example- Users login to the CP for the first time using the Freeradius authentication, then i want to set an experiation time of 1-week after this first login. However i don't know when the user will login for the first time so I can't preset the experiation date for the account since I Won't know the original date of the login.

    Is there a way to pass this attribute witht he calculation from the CP with an additional Post-Auth? Would i need to switch to SQL DB from the USERS file?

    I'm using Pfsense 2.1 and FR 2.2 using the rlm_counter with the USERS file.



  • What you can try is to use "Amount-of-time" with freeradius.
    https://doc.pfsense.org/index.php/FreeRADIUS_2.x_package#Accounting_with_Captive_Portal

    But I am not sure if this really works because there are bugs/problems or whatever with the accounting information sent from CP to RADIUS.

    But if I understand you correctly the ideal thing for your would be the pfsense voucher system. If someone logs in the first time the counter starts and stops after 1 week or any other time you created the voucher for.



  • thansk for the reply nacht.

    the only problem is that i have some time period (1 hour) where i would need to pause the timer and this is not possible with the voucher.

    I had read some where you can create modules for the time counter or edit the expiration module with the new calculation. However in my past experience when I edit these modules after I reboot the system it erases my configs and replaces it with the defaults.

    Also do you know if this would work with the CP on the pfsense? I knwo that on the 2.1 you can have it send custom radius commands.



  • @fsantaana:

    thansk for the reply nacht.

    the only problem is that i have some time period (1 hour) where i would need to pause the timer and this is not possible with the voucher.

    I had read some where you can create modules for the time counter or edit the expiration module with the new calculation. However in my past experience when I edit these modules after I reboot the system it erases my configs and replaces it with the defaults.

    Also do you know if this would work with the CP on the pfsense? I knwo that on the 2.1 you can have it send custom radius commands.

    If you need to make changes which should be persitent you should modify the following file:

    /usr/local/pkg/freeradius.inc
    

    Perhaps it could be easier to make a diff from the freeradius.inc original file and the one you modified. Then install the "System Patches" package and as your diff there. Then the patch will be applied after firmware updates or even if you update the package and changes outside of the part you did will not be affected.

    As I said - I don't know how good and which commands CP sends and if it would be possible.