Chetan Gaonker | 7f4bf74 | 2016-05-04 15:56:08 -0700 | [diff] [blame] | 1 | # Rather than maintaining separate (GDBM) databases of |
| 2 | # accounting info for each counter, this module uses the data |
| 3 | # stored in the raddacct table by the sql modules. This |
| 4 | # module NEVER does any database INSERTs or UPDATEs. It is |
| 5 | # totally dependent on the SQL module to process Accounting |
| 6 | # packets. |
| 7 | # |
| 8 | # The sql-module-instance' parameter holds the instance of the sql |
| 9 | # module to use when querying the SQL database. Normally it |
| 10 | # is just "sql". If you define more and one SQL module |
| 11 | # instance (usually for failover situations), you can |
| 12 | # specify which module has access to the Accounting Data |
| 13 | # (radacct table). |
| 14 | # |
| 15 | # The 'reset' parameter defines when the counters are all |
| 16 | # reset to zero. It can be hourly, daily, weekly, monthly or |
| 17 | # never. It can also be user defined. It should be of the |
| 18 | # form: |
| 19 | # num[hdwm] where: |
| 20 | # h: hours, d: days, w: weeks, m: months |
| 21 | # If the letter is ommited days will be assumed. In example: |
| 22 | # reset = 10h (reset every 10 hours) |
| 23 | # reset = 12 (reset every 12 days) |
| 24 | # |
| 25 | # The 'key' parameter specifies the unique identifier for the |
| 26 | # counter records (usually 'User-Name'). |
| 27 | # |
| 28 | # The 'query' parameter specifies the SQL query used to get |
| 29 | # the current Counter value from the database. There are 3 |
| 30 | # parameters that can be used in the query: |
| 31 | # %b unix time value of beginning of reset period |
| 32 | # %e unix time value of end of reset period |
| 33 | # |
| 34 | # The 'check_name' parameter is the name of the 'check' |
| 35 | # attribute to use to access the counter in the 'users' file |
| 36 | # or SQL radcheck or radcheckgroup tables. |
| 37 | # |
| 38 | # DEFAULT Max-Daily-Session > 3600, Auth-Type = Reject |
| 39 | # Reply-Message = "You've used up more than one hour today" |
| 40 | # |
| 41 | sqlcounter dailycounter { |
| 42 | sql_module_instance = sql |
| 43 | dialect = ${modules.sql.dialect} |
| 44 | |
| 45 | counter_name = Daily-Session-Time |
| 46 | check_name = Max-Daily-Session |
| 47 | reply_name = Session-Timeout |
| 48 | |
| 49 | key = User-Name |
| 50 | reset = daily |
| 51 | |
| 52 | $INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf |
| 53 | } |
| 54 | |
| 55 | sqlcounter monthlycounter { |
| 56 | sql_module_instance = sql |
| 57 | dialect = ${modules.sql.dialect} |
| 58 | |
| 59 | counter_name = Monthly-Session-Time |
| 60 | check_name = Max-Monthly-Session |
| 61 | reply_name = Session-Timeout |
| 62 | key = User-Name |
| 63 | reset = monthly |
| 64 | |
| 65 | $INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf |
| 66 | } |
| 67 | |
| 68 | sqlcounter noresetcounter { |
| 69 | sql_module_instance = sql |
| 70 | dialect = ${modules.sql.dialect} |
| 71 | |
| 72 | counter_name = Max-All-Session-Time |
| 73 | check_name = Max-All-Session |
| 74 | key = User-Name |
| 75 | reset = never |
| 76 | |
| 77 | $INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf |
| 78 | } |
| 79 | |
| 80 | # |
| 81 | # Set an account to expire T seconds after first login. |
| 82 | # Requires the Expire-After attribute to be set, in seconds. |
| 83 | # You may need to edit raddb/dictionary to add the Expire-After |
| 84 | # attribute. |
| 85 | sqlcounter expire_on_login { |
| 86 | sql_module_instance = sql |
| 87 | dialect = ${modules.sql.dialect} |
| 88 | |
| 89 | counter_name = Expire-After-Initial-Login |
| 90 | check_name = Expire-After |
| 91 | key = User-Name |
| 92 | reset = never |
| 93 | |
| 94 | $INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf |
| 95 | } |