<div dir="ltr">Hi,<div><br></div><div>I followed your instructions. Now I get the following errors:</div><div><br></div><div><div>(2) [-sql] = ok</div><div>(2) [expiration] = noop</div><div>(2) [logintime] = noop</div>
<div>(2) WARNING: pap : Auth-Type already set. Not setting to PAP</div><div>(2) [pap] = noop</div><div>(2) dailycounter : Entering module authorize code</div><div><font color="#cc0000">(2) ERROR: dailycounter : %{sql:SELECT SUM(acctsessiontime) FROM radacct WHERE username = '%{User-Name}' AND acctstarttime BETWEEN FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')}</font></div>
<div><font color="#cc0000">(2) ERROR: dailycounter : ^ Invalid variable expansion</font></div><div>(2) [dailycounter] = fail</div>
<div>(2) } # authorize = fail</div><div>(2) Using Post-Auth-Type Reject</div></div><div><br></div><div>/etc/freeradius/mods-enabled/sqlcounter <br></div><div><br></div><div><div>sqlcounter dailycounter{</div><div> counter_name = "Daily-Session-Time"</div>
<div> check_name = "Max-Daily-Session"</div><div> reply_name = "Session-Timeout"</div><div> sql_module_instance = "sql"</div><div> key = "User-Name"</div>
<div> reset = "daily"</div><div> cache-size = 5000</div><div> query = "SELECT SUM(acctsessiontime) FROM radacct WHERE username = '%{${</div><div>key}}' AND acctstarttime BETWEEN FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')"</div>
<div>}</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 12, 2014 at 11:27 PM, Russell Mike <span dir="ltr"><<a href="mailto:radius.sir@gmail.com" target="_blank">radius.sir@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="trebuchet ms, sans-serif">Do the following</font><div><font face="trebuchet ms, sans-serif"><br>
</font></div><div><font face="trebuchet ms, sans-serif"><br></font></div><div><span style="font-family:'trebuchet ms',sans-serif">STEP 1:</span><br>
</div><div><font face="trebuchet ms, sans-serif"><br></font></div><div><span style="font-family:'trebuchet ms',sans-serif">nano counters.conf</span><br></div><div>
<p><font face="trebuchet ms, sans-serif">sqlcounter dailycounter {</font></p>
<p><font face="trebuchet ms, sans-serif"> counter-name = "Daily-Session-Time"</font></p>
<p><font face="trebuchet ms, sans-serif"> check-name = "Max-Daily-Session"</font></p>
<p><font face="trebuchet ms, sans-serif"> reply-name = "Session-Timeout"</font></p>
<p><font face="trebuchet ms, sans-serif"> sqlmod-inst = "sql"</font></p>
<p><font face="trebuchet ms, sans-serif"> key = "User-Name"</font></p>
<p><font face="trebuchet ms, sans-serif"> reset = "daily"</font></p>
<p><font face="trebuchet ms, sans-serif"> cache-size = 5000</font></p>
<p><font face="trebuchet ms, sans-serif"> query = "SELECT SUM(acctsessiontime) FROM radacct WHERE username = '%{%k}' AND acctstarttime BETWEEN FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')"</font></p>
<p><span style="font-family:'trebuchet ms',sans-serif">}</span><br></p>
<p><font face="trebuchet ms, sans-serif"><br></font></p></div><div><font face="trebuchet ms, sans-serif">STEP 2:<br></font></div><div><font face="trebuchet ms, sans-serif"><br></font></div><div><font face="trebuchet ms, sans-serif">nano radiusd.conf</font></div>
<div>
<p><font face="trebuchet ms, sans-serif">instantiate {</font></p>
<p><font face="trebuchet ms, sans-serif"> dailycounter</font></p>
<p><font face="trebuchet ms, sans-serif">}</font></p>
<p><br></p></div><div><font face="trebuchet ms, sans-serif">STEP 3: </font></div><div><font face="trebuchet ms, sans-serif"><br></font></div><div><font face="trebuchet ms, sans-serif">nano sites-available/default</font></div>
<div><font face="trebuchet ms, sans-serif"><br></font></div><div>
<p><font face="trebuchet ms, sans-serif">authorize {</font></p></div><div>
<p><font face="trebuchet ms, sans-serif"> dailycounter</font></p><p><font face="trebuchet ms, sans-serif">}</font></p></div><div><font face="trebuchet ms, sans-serif"><br></font><div class="gmail_extra">
<font face="trebuchet ms, sans-serif">STEP 4: </font></div><div class="gmail_extra"><font face="trebuchet ms, sans-serif"><br></font></div><div class="gmail_extra">
<p><font face="trebuchet ms, sans-serif">accounting {</font></p><p><font face="trebuchet ms, sans-serif">sql</font></p><p><font face="trebuchet ms, sans-serif">}</font></p><p><font face="trebuchet ms, sans-serif">STEP 5: LOOK, THIS MUST BE <b><font color="#ff0000">CHECK & REPLY</font></b> ITEM NOT CHECK ONLY. BOB IS ALLOWED FOR 60 MINUTES, VALUE IS IN SECONDS. </font></p>
<p><font face="trebuchet ms, sans-serif"><span style="font-size:13px">Max-Daily-Session := 3600</span><br></font></p><p><span style="font-size:13px"><font face="trebuchet ms, sans-serif"><br></font></span></p>
<p><span style="font-size:13px"><font face="trebuchet ms, sans-serif">STEP 6: Restart Radius Daemon</font></span></p></div><span class="HOEnZb"><font color="#888888"><div class="gmail_extra">RM --</div></font></span><div class="gmail_extra">
<br><br><div class="gmail_quote"><div><div class="h5">
On Mon, May 12, 2014 at 11:28 AM, * <span dir="ltr"><<a href="mailto:zhex900@gmail.com" target="_blank">zhex900@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div class="h5">
<p dir="ltr">Hi,</p>
<p dir="ltr">I have to follow this tutorial to get the the session limit working. But looking at the debug output it seems the sql counter is not executed. No Session-Timeout is sent to NAS as well.</p>
<p dir="ltr">Accounting is working fine. I can see all the accounting information radacct time. </p>
<p dir="ltr">Here is my configuration. Please let me know if I should provide more information.</p>
<p dir="ltr">Jake He</p>
<p dir="ltr">FreeRADIUS V. 3</p>
<p dir="ltr">mods-enabled/sqlcounter </p>
<p dir="ltr">sqlcounter noresetcounter {<br>
sql_module_instance = sql<br>
#dialect = ${sql_module_instance}.dialect<br>
dialect = mysql<br>
counter_name = Daily-Session-Time<br>
check_name = Max-Daily-Session<br>
reply_name = Session-Timeout<br>
key = User-Name<br>
reset = never<br>
query = “SELECT SUM(AcctSessionTime) FROM radacct where UserName=’%{%k}’”<br>
} </p>
<p dir="ltr">sites-enabled/default:</p>
<p dir="ltr">authorize {</p>
<p dir="ltr">preprocess<br>
chap<br>
mschap<br>
suffix<br>
eap<br>
files<br>
sql<br>
pap<br>
noresetcounter<br>
}</p>
<p dir="ltr">radcheck:<br>
Max-Daily-Session:=60 for the user bob<br>
</p>
<br></div></div><div class="">-<br>
List info/subscribe/unsubscribe? See <a href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a><br></div></blockquote></div><br></div></div></div>
<br>-<br>
List info/subscribe/unsubscribe? See <a href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a><br></blockquote></div><br></div>