Updated FreeRadius (markdown)

iBNu Maksum 2023-10-18 14:35:58 +07:00
parent 22f31fb5f3
commit 047e37fab6

@ -114,6 +114,77 @@ mysql {
}
```
## Enable SQL Counter
SQLCounter Is a module that is used to record user statistics that are entered and written in the database, such as recording the time a user logs in, transfers data, and sessions.
activating the Access Period and Quota Limit
`mods-available/sqlcounter`
```
sqlcounter accessperiod {
sql_module_instance = sql
dialect = ${modules.sql.dialect}
counter_name = Max-Access-Period-Time
check_name = Access-Period
key = User-Name
reset = never
$INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf
}
sqlcounter quotalimit {
sql_module_instance = sql
dialect = ${modules.sql.dialect}
counter_name = Max-Volume
check_name = Max-Data
reply_name = Mikrotik-Total-Limit
key = User-Name
reset = never
$INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf
}
```
`mods-config/sql/counter/mysql/accessperiod.conf`
```
query = "\
SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(AcctStartTime) \
FROM radacct \
WHERE UserName='%{${key}}' \
ORDER BY AcctStartTime LIMIT 1"
```
`mods-config/sql/counter/mysql/quotalimit.conf`
```
query = "\
SELECT (SUM(acctinputoctets) + SUM(acctoutputoctets)) \
FROM radacct \
WHERE UserName='%{${key}}'"
```
`sites-enabled/default`
```
authorize {
expiration
logintime
quotalimit
dailycounter
accessperiod
monthlycounter
noresetcounter
}
```
```ln -s mods-available/sqlcounter mods-enabled/sqlcounter```
Restart Freeradius
```
@ -136,10 +207,4 @@ $radius_host = 'localhost';
$radius_user = 'phpnuxbill';
$radius_pass = 'phpnuxbill';
$radius_name = 'phpnuxbill';
```
## Enable SQL Counter
SQLCounter Is a module that is used to record user statistics that are entered and written in the database, such as recording the time a user logs in, transfers data, and sessions.
but you need to search how to use it
```