Freeradius + acctupdate option

David Riches david at candengo.com
Thu Sep 13 10:25:00 UTC 2007


Just a quick question regarding the post below if you don’t mind.

Ive tried to append –acctupdate to the config file, but it results in an
error being thrown (unknown command) – is this option still supported?

Lastly,

I don’t have attrs.accounting_response file – ive installed a few times now
but never end up with this file – could someone please email me a copy?

Regards to all

David

Original Post:

If you need to manage multiple concurrent login and you want to have 
Session-Timeout dinamically update on coovachilli when a user login
multiple time, David add an amazing option, --acctupdate, that get
the NON-standard response to acctupdate packets to radius with some
attributes, like the Session-Timeout.

But now the problem is: How to make it working with freeradius and mysql?

Well, this is how:

Firt of all, look at
http://coova.org/wiki/index.php/CoovaChilli/WithFreeRADIUS and do the
required changes to attrs.accounting_response file.

Now, on radiusd.conf, in the module {} section, 
add this:

   attr_rewrite updatesessiontimeout {
      attribute = Session-Timeout
      searchin = reply
      searchfor = "[+ ]"
      replacewith = "%{sql:SELECT ch.Value-IF(SUM(acct.AcctSessionTime) IS
NULL, 0, SUM(acct.AcctSessionTime)) \
                      FROM radcheck AS ch LEFT JOIN radacct AS acct \
                      ON acct.Username=ch.UserName AND
acct.AcctSessionId!='%{Acct-Session-Id}'\
                      AND acct.AcctUniqueId!='%{Acct-Unique-Session-Id}' \
                      WHERE ch.UserName='%{User-Name}' AND
ch.Attribute='Max-All-Session'"
      new_attribute = yes
      append = no
   }

Now, in the acctupdate {} section add simply updatesessiontimeout and
voila', le jeux son fait!

This assume that you have Max-All-Session in radcheck table, if you have it
in radgroupcheck you need to 
modify a bit the sql query.

Just because isn't documented:

If you need to manage multiple concurrent login and you want to have 
Session-Timeout dinamically update on coovachilli when a user login
multiple time, David add an amazing option, --acctupdate, that get
the NON-standard response to acctupdate packets to radius with some
attributes, like the Session-Timeout.

But now the problem is: How to make it working with freeradius and mysql?

Well, this is how:

Firt of all, look at
http://coova.org/wiki/index.php/CoovaChilli/WithFreeRADIUS and do the
required changes to attrs.accounting_response file.

Now, on radiusd.conf, in the module {} section, 
add this:

   attr_rewrite updatesessiontimeout {
      attribute = Session-Timeout
      searchin = reply
      searchfor = "[+ ]"
      replacewith = "%{sql:SELECT ch.Value-IF(SUM(acct.AcctSessionTime) IS
NULL, 0, SUM(acct.AcctSessionTime)) \
                      FROM radcheck AS ch LEFT JOIN radacct AS acct \
                      ON acct.Username=ch.UserName AND
acct.AcctSessionId!='%{Acct-Session-Id}'\
                      AND acct.AcctUniqueId!='%{Acct-Unique-Session-Id}' \
                      WHERE ch.UserName='%{User-Name}' AND
ch.Attribute='Max-All-Session'"
      new_attribute = yes
      append = no
   }

Now, in the acctupdate {} section add simply updatesessiontimeout and
voila', le jeux son fait!

This assume that you have Max-All-Session in radcheck table, if you have it
in radgroupcheck you need to 
modify a bit the sql query.



No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.485 / Virus Database: 269.13.16/1004 - Release Date: 12/09/2007
17:22
 





More information about the Cap mailing list