简体   繁体   中英

How does sqlcounter/data limit in Freeradius 3 work?

Have my captive portal environment setup using pfSense 2.3.4 with Freeradius 3.0.13 hosted on a Raspberry Pi 3 Model B with Rasparian Jessie. Authentication and everything is working as expected but can't get the sql counter for volume limit to work.

According to the documentation there are only examples how to set a max session time, daily usage (in time) but nothing for limiting the volume.

Have added this custom function in the sqlcounter file:

sqlcounter totalbytecounter {
  sql_module_instance = sql
  dialect = mysql

  counter_name = Max-Volume
  check_name = Acct-Output-Octets
  reply_name = Session-Timeout

  key = User-Name
  reset = never
  query = "SELECT ((SUM(`acctinputoctets`)+SUM(`acctoutputoctets`))) FROM radacct WHERE `username`='%{${key}}'"
}

But debug says

(34) totalbytecounter: WARNING: Couldn't find check attribute, control:Acct-Output-Octets, doing nothing...

Anyone that can help me in the right direction`? Thanks!

You need to provide a value for control:Acct-Output-Octets for the module to check against.

That can be in unlang with

update control {
    Acct-Output-Octets := 1024
}

or in the users file with

<username> Acct-Output-Octets := 1024

or as an entry in the radcheck table.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM