2 # This file contains the configuration for experimental modules.
4 # By default, it is NOT included in the build.
10 # Configuration for the Python module.
12 # Where radiusd is a Python module, radiusd.py, and the
13 # function 'authorize' is called. Here is a dummy piece
16 # def authorize(params):
18 # return (5, ('Reply-Message', 'banned'))
20 # The RADIUS value-pairs are passed as a tuple of tuple
21 # pairs as the first argument, e.g. (('attribute1',
22 # 'value1'), ('attribute2', 'value2'))
24 # The function return is a tuple with the first element
25 # being the return value of the function.
26 # The 5 corresponds to RLM_MODULE_USERLOCK. I plan to
27 # write the return values as Python symbols to avoid
30 # The remaining tuple members are the string form of
31 # value-pairs which are passed on to pairmake().
34 mod_authorize = radiusd
35 func_authorize = authorize
39 # Configuration for the example module. Uncommenting it will cause it
40 # to get loaded and initialized, but should have no real effect as long
41 # it is not referencened in one of the autz/auth/preacct/acct sections
44 # allowed values: {no, yes}
47 # An integer, of any value.
51 string = "This is an example configuration string"
53 # An IP address, either in dotted quad (1.2.3.4) or hostname
62 string = "This is a different string"
68 # This module is an SQL enabled version of the counter module.
70 # Rather than maintaining seperate (GDBM) databases of accounting info
71 # for each counter, this module uses the data stored in the raddacct
72 # table by the sql modules. This module NEVER does any database
73 # INSERTs or UPDATEs. It is totally dependent on the SQL module
74 # to process Accounting packets.
76 # The 'sqlmod_inst' parameter holds the instance of the sql module to use
77 # when querying the SQL database. Normally it is just "sql".
78 # If you define more and one SQL module instance
79 # (usually for failover situations), you can specify which module
80 # has access to the Accounting Data (radacct table).
82 # The 'reset' parameter defines when the counters are all reset to
83 # zero. It can be hourly, daily, weekly, monthly or never.
84 # It can also be user defined. It should be of the form:
86 # h: hours, d: days, w: weeks, m: months
87 # If the letter is ommited days will be assumed. In example:
88 # reset = 10h (reset every 10 hours)
89 # reset = 12 (reset every 12 days)
91 # The 'key' parameter specifies the unique identifier for the counters
92 # records (usually 'User-Name').
94 # The 'query' parameter specifies the SQL query used to get the
95 # current Counter value from the database. There are 3 parameters
96 # that can be used in the query:
98 # %b unix time value of beginning of reset period
99 # %e unix time value of end of reset period
101 # The 'check-name' parameter is the name of the 'check' attribute to use to access
102 # the counter in the 'users' file or SQL radcheck or radcheckgroup
105 # DEFAULT Max-Daily-Session > 3600, Auth-Type = Reject
106 # Reply-Message = "You've used up more than one hour today"
109 sqlcounter dailycounter {
110 counter-name = Daily-Session-Time
111 check-name = Max-Daily-Session
112 sqlmod-inst = sqlcca3
116 # This query properly handles calls that span from the previous reset period
117 # into the current period but involves more work for the SQL server than those below
118 query = "SELECT SUM(AcctSessionTime - GREATEST((%b - UNIX_TIMESTAMP(AcctStartTime)), 0)) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b'"
120 # This query ignores calls that started in a previous reset period and
121 # continue into into this one. But it is a little easier on the SQL server
122 # query = "SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='%{%k}' AND AcctStartTime > FROM_UNIXTIME('%b')"
124 # This query is the same as above, but demonstrates an additional
125 # counter parameter '%e' which is the timestamp for the end of the period
126 # query = "SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='%{%k}' AND AcctStartTime BETWEEN FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')"
129 sqlcounter monthlycounter {
130 counter-name = Monthly-Session-Time
131 check-name = Max-Monthly-Session
132 sqlmod-inst = sqlcca3
136 # This query properly handles calls that span from the previous reset period
137 # into the current period but involves more work for the SQL server than those below
138 query = "SELECT SUM(AcctSessionTime - GREATEST((%b - UNIX_TIMESTAMP(AcctStartTime)), 0)) FROM radacct WHERE UserName='%{%k}' AND UNIX_TIMESTAMP(AcctStartTime) + AcctSessionTime > '%b'"
140 # This query ignores calls that started in a previous reset period and
141 # continue into into this one. But it is a little easier on the SQL server
142 # query = "SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='%{%k}' AND AcctStartTime > FROM_UNIXTIME('%b')"
144 # This query is the same as above, but demonstrates an additional
145 # counter parameter '%e' which is the timestamp for the end of the period
146 # query = "SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='%{%k}' AND AcctStartTime BETWEEN FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')"