OPNsense Forum

English Forums => Development and Code Review => Topic started by: mseelig on February 09, 2023, 06:00:35 pm

Title: Cleaning Sessions
Post by: mseelig on February 09, 2023, 06:00:35 pm
Hi,

I am using the Local Directory Users with CaptivePortal. A user subscribes and gets credit for a certain time which is defined by the Expire Date attribute. To prevent, that the user has to login all the time, I set Hard Timeout and Cear Timeout to zero.

Of course I run into the problem now, that once a session has ben created for a user, opnsense will not check if the Expiration Date of the user using this session has expired already.

My Idea was to create a cron job who would iterate through the zone sessions and disconnect every zone where the user has expired. So far so good. I was able to create a little python script to iterate through the sessions from the zone and I also would be able to disconnect. But I am not able to lookup the user to check the expiration date with the API.

So I think I need to write a php class to resolve that. Is it possible to have a cron job in php to do the job?

Michael