RE: Decreasing connection time (Session-Timeout)
Now, how could I subtract the elapsed time from the original Session- Timeout time? So that the user will, at the next login, only have 40minutes left.
SQLcounter is the module you need. J. -- Jonathan De Graeve IMELDA vzw Informatica Dienst Network System Engineer jonathan.de.graeve@imelda.be +32(0)15/50.52.98
In SQLCounter documentation they say "This module NEVER does any database INSERTs or UPDATEs." I can in fact grab the time elapsed and all kind of other information. But my main problem is to update my database with the new time. I found that chillispot sends to freeRadius this message when a user disconnects: Accounting-Request packet from host 127.0.0.1:1025, id=3, length=177 Acct-Status-Type = Stop User-Name = "mico" Calling-Station-Id = "00-11-00-19-00-00" Called-Station-Id = "00-11-00-65-00-00" NAS-Port-Type = Wireless-802.11 NAS-Port = 0 NAS-Port-Id = "00000000" NAS-IP-Address = 127.0.0.1 NAS-Identifier = "nas01" Framed-IP-Address = 192.168.189.2 Acct-Session-Id = "453dda2800000000" Acct-Input-Octets = 7347 Acct-Output-Octets = 10553 Acct-Input-Gigawords = 0 Acct-Output-Gigawords = 0 Acct-Input-Packets = 38 Acct-Output-Packets = 24 Acct-Session-Time = 121 Acct-Terminate-Cause = User-Request freeRadius than calls accounting_stop_query located in sql.conf and UPDATES the radacct table and its attributes with all these new values. What I'd like to do now is to execute a personalised sql query right after this default accounting_stop_query so that I could save/modify all the info I want. Or maybe is there another way to grab this Acct-Session-Time and User-Name to update the correct user and modify his time left. Any ideas? Cheers, mico "The only way to get rid of a temptation is to yield to it." (Oscar Wilde)
-----Original Message----- From: freeradius-users-bounces+micobros=gmail.com@lists.freeradius.org [mailto:freeradius-users-bounces+micobros=gmail.com@lists.freeradius.org] On Behalf Of Jonathan De Graeve Sent: dimanche 22 octobre 2006 17:20 To: FreeRadius users mailing list Subject: RE: Decreasing connection time (Session-Timeout)
Now, how could I subtract the elapsed time from the original Session- Timeout time? So that the user will, at the next login, only have 40minutes left.
SQLcounter is the module you need.
J.
-- Jonathan De Graeve IMELDA vzw Informatica Dienst Network System Engineer jonathan.de.graeve@imelda.be +32(0)15/50.52.98
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
The best way to update your DB with the new session-timeout value is to CREATE A TRIGGER in your database when a STOP request is sent by your NAS. In this STOP request you have all information you need. I supposed your hotspot has activated accounting option. The option of executing an external script when user finalizes not is a very good solution. With the solucion I exposed you have a sincronous DB data.
From: "micobros" <micobros@gmail.com> Reply-To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org> To: "'FreeRadius users mailing list'" <freeradius-users@lists.freeradius.org> Subject: RE: Decreasing connection time (Session-Timeout) Date: Tue, 24 Oct 2006 09:24:33 +0200
In SQLCounter documentation they say "This module NEVER does any database INSERTs or UPDATEs."
I can in fact grab the time elapsed and all kind of other information. But my main problem is to update my database with the new time.
_________________________________________________________________ Descubre la descarga digital con MSN Music. Más de un millón de canciones. http://music.msn.es/
Using triggers is a good idea too... The problem is that I don't know how to make stored routines. I could learn, but I need this little *demo* station to work for this afternoon :) For now, I'll simply make a little php script executed every 10 minutes to check the radacct table. And subtract the time elapsed from the Session-Timeout attribute... Cheers, mico "The only way to get rid of a temptation is to yield to it." (Oscar Wilde)
-----Original Message----- From: freeradius-users-bounces+micobros=gmail.com@lists.freeradius.org [mailto:freeradius-users-bounces+micobros=gmail.com@lists.freeradius.org] On Behalf Of Santiago Balaguer García Sent: mardi 24 octobre 2006 9:54 To: freeradius-users@lists.freeradius.org Subject: RE: Decreasing connection time (Session-Timeout)
The best way to update your DB with the new session-timeout value is to CREATE A TRIGGER in your database when a STOP request is sent by your NAS. In this STOP request you have all information you need. I supposed your hotspot has activated accounting option.
The option of executing an external script when user finalizes not is a very good solution. With the solucion I exposed you have a sincronous DB data.
From: "micobros" <micobros@gmail.com> Reply-To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org> To: "'FreeRadius users mailing list'" <freeradius-users@lists.freeradius.org> Subject: RE: Decreasing connection time (Session-Timeout) Date: Tue, 24 Oct 2006 09:24:33 +0200
In SQLCounter documentation they say "This module NEVER does any database INSERTs or UPDATEs."
I can in fact grab the time elapsed and all kind of other information. But my main problem is to update my database with the new time.
_________________________________________________________________ Descubre la descarga digital con MSN Music. Más de un millón de canciones. http://music.msn.es/
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
micobros wrote:
Using triggers is a good idea too...
The problem is that I don't know how to make stored routines. I could learn, but I need this little *demo* station to work for this afternoon :)
What db are you using? If you are using postgresql, you can use this as an example: http://lists.cistron.nl/pipermail/freeradius-users/2005-January/040297.html It's not hard. I actually have a stored procedure & trigger in the db which does exactly what you're after (for dialup) which I should be able to post tomorrow. g
For now, I'll simply make a little php script executed every 10 minutes to check the radacct table. And subtract the time elapsed from the Session-Timeout attribute...
Cheers,
mico
"The only way to get rid of a temptation is to yield to it." (Oscar Wilde)
-----Original Message----- From: freeradius-users-bounces+micobros=gmail.com@lists.freeradius.org [mailto:freeradius-users-bounces+micobros=gmail.com@lists.freeradius.org] On Behalf Of Santiago Balaguer García Sent: mardi 24 octobre 2006 9:54 To: freeradius-users@lists.freeradius.org Subject: RE: Decreasing connection time (Session-Timeout)
The best way to update your DB with the new session-timeout value is to CREATE A TRIGGER in your database when a STOP request is sent by your NAS. In this STOP request you have all information you need. I supposed your hotspot has activated accounting option.
The option of executing an external script when user finalizes not is a very good solution. With the solucion I exposed you have a sincronous DB data.
From: "micobros" <micobros@gmail.com> Reply-To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org> To: "'FreeRadius users mailing list'" <freeradius-users@lists.freeradius.org> Subject: RE: Decreasing connection time (Session-Timeout) Date: Tue, 24 Oct 2006 09:24:33 +0200
In SQLCounter documentation they say "This module NEVER does any database INSERTs or UPDATEs."
I can in fact grab the time elapsed and all kind of other information.
But
my main problem is to update my database with the new time.
_________________________________________________________________ Descubre la descarga digital con MSN Music. Más de un millón de canciones. http://music.msn.es/
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
freeRadius than calls accounting_stop_query located in sql.conf and UPDATES the radacct table and its attributes with all these new values.
What I'd like to do now is to execute a personalised sql query right after this default accounting_stop_query so that I could save/modify all the info I want.
Or maybe is there another way to grab this Acct-Session-Time and User-Name to update the correct user and modify his time left.
Any ideas?
I don't know if it's possible to add any number of SQL queries to the sql module: I let freeradius gurus the responsability to say... However you can instantiate a new sql module in sql.conf: sql my-sql-acct { ... Accounting_stop_query =" MY Customized SQL query" } Then in you radiusd.conf accounting section: accounting { sql my-sql-acct } You may also want to enable the 'my-sql-acct' only for your ChilliSpot NAS. You can do so by playing with Acct-Type (see doc/Acct-Type): * use acct_users to set Acct-Type:=custom-sql for your NAS-IP-Address * use an accounting section as below: Accouning { sql Acct-Type custom-sql { my-sql-acct } } HTH, Thibault
However you can instantiate a new sql module in sql.conf: sql my-sql-acct { ... Accounting_stop_query =" MY Customized SQL query"
}
Then in you radiusd.conf accounting section: accounting { sql my-sql-acct }
I tried this and freeRadius hangs at startup and says "my-sql-acct: Unknown Module". I added everything just like you said... (If I can manage to add this previous section) Modifying directly in chillispot is maybe a good choice. I'll give it a try... Cheers, mico "The only way to get rid of a temptation is to yield to it." (Oscar Wilde)
-----Original Message----- From: freeradius-users-bounces+micobros=gmail.com@lists.freeradius.org [mailto:freeradius-users-bounces+micobros=gmail.com@lists.freeradius.org] On Behalf Of Thibault Le Meur Sent: mardi 24 octobre 2006 9:56 To: 'FreeRadius users mailing list' Subject: RE : Decreasing connection time (Session-Timeout)
freeRadius than calls accounting_stop_query located in sql.conf and UPDATES the radacct table and its attributes with all these new values.
What I'd like to do now is to execute a personalised sql query right after this default accounting_stop_query so that I could save/modify all the info I want.
Or maybe is there another way to grab this Acct-Session-Time and User-Name to update the correct user and modify his time left.
Any ideas?
I don't know if it's possible to add any number of SQL queries to the sql module: I let freeradius gurus the responsability to say...
However you can instantiate a new sql module in sql.conf: sql my-sql-acct { ... Accounting_stop_query =" MY Customized SQL query"
}
Then in you radiusd.conf accounting section: accounting { sql my-sql-acct }
You may also want to enable the 'my-sql-acct' only for your ChilliSpot NAS. You can do so by playing with Acct-Type (see doc/Acct-Type): * use acct_users to set Acct-Type:=custom-sql for your NAS-IP-Address * use an accounting section as below: Accouning { sql Acct-Type custom-sql { my-sql-acct } }
HTH, Thibault
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
However you can instantiate a new sql module in sql.conf: sql my-sql-acct { ... Accounting_stop_query =" MY Customized SQL query"
}
Then in you radiusd.conf accounting section: accounting { sql my-sql-acct }
I tried this and freeRadius hangs at startup and says "my-sql-acct: Unknown Module". I added everything just like you said...
That's weird... It means that your my-sql-acct module definition wasn't read or accepted. You should try to run radiusd with "radiusd -X" and carefully read the output: this will tell where the problem is. If you can't find the issue, post the result of your "radiusd -X" (you could also add your radiusd.conf and sql.conf) and I'll have a look at it. Regards, Thibault
participants (5)
-
Graeme Lee -
Jonathan De Graeve -
micobros -
Santiago Balaguer García -
Thibault Le Meur