From 047e37fab6cfca6d21eb37d8baa81708d7e137d0 Mon Sep 17 00:00:00 2001 From: iBNu Maksum Date: Wed, 18 Oct 2023 14:35:58 +0700 Subject: [PATCH] Updated FreeRadius (markdown) --- FreeRadius.md | 79 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 7 deletions(-) diff --git a/FreeRadius.md b/FreeRadius.md index 25c0de8..796fdad 100644 --- a/FreeRadius.md +++ b/FreeRadius.md @@ -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 \ No newline at end of file +``` \ No newline at end of file