<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META content="text/html; charset=utf-8" http-equiv=CONTENT-TYPE>
<META name=GENERATOR content="MSHTML 8.00.6001.18702">
<STYLE type=text/css>@page {margin: 0.79in; }
P {
MARGIN-BOTTOM: 0.08in
}
</STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2 face=Arial>Do you manage to fix your problem?</FONT></DIV>
<DIV><FONT size=2 face=Arial>Kindly share your solution. I am interested in
knowing how I can configure my freeradius to limit users by both time and
max download size</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>e.g. 1usd for 1 hour or 20MB (whichever comes
first).</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>charles</FONT></DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="FONT: 10pt arial; BACKGROUND: #e4e4e4; font-color: black"><B>From:</B>
<A title=hr.hasani@gmail.com href="mailto:hr.hasani@gmail.com">Hamid Reza
Hasani</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=freeradius-users@lists.freeradius.org
href="mailto:freeradius-users@lists.freeradius.org">freeradius-users@lists.freeradius.org</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Sunday, November 29, 2009 5:45
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Session-Octets-Limit and
sqlcounter</DIV>
<DIV><BR></DIV>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4>Hi, </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4>I'm using freeradius-2.1.6, and I'm
going to make a download limitation for my users. I used sqlcounter module and
config it as follow: </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>sqlcounter monthlydownload {
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>counter-name =
"Monthly-Download-Byte" </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>check-name = "Max-Monthly-Download"
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>reply-name = "Session-Octets-Limit"
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>key = "User-Name" </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>sqlmod-inst = "sql" </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>query = "SELECT
SUM(AcctOutputOctets+AcctInputOctets) FROM radacct WHERE UserName='%{%k}' AND
AcctStartTime > FROM_UNIXTIME('%b')" </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>reset = "monthly" </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>safe-characters =
"@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>}</FONT> </P>
<P style="MARGIN-BOTTOM: 0in"></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4><FONT size=2></FONT>According to
the log messages, it shows anything is OK: </FONT></P>
<P style="MARGIN-BOTTOM: 0in"></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sqlcounter: Sent Reply-Item for
user hrh, Type=Session-Octets-Limit, value=600106145 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>++[monthlydownload] returns ok
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4><FONT size=2></FONT>But in
proceeding it shows me what it sent, and there isn't Session-Octets-Limit! as
you can see bellow: </FONT></P>
<P style="MARGIN-BOTTOM: 0in"></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Sending Access-Accept of id 222 to
127.0.0.1 port 32769 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Framed-IP-Address := 20.20.20.1
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Framed-IP-Netmask := 255.255.255.0
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Session-Timeout = 5460 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Finished request 0. </FONT></P>
<P style="MARGIN-BOTTOM: 0in"></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4><FONT size=2></FONT>Where is my
problem? </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4>more log is available at the end of
message. </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4>Thanks for you helps. </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4>------</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4>Ya Ali</FONT></P>
<P style="MARGIN-BOTTOM: 0in"></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4>Hamid Reza Hasani</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4><BR></FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4>More Log:</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=4><FONT size=2>Module: Linked to
module rlm_sqlcounter </FONT></FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Module: Instantiating
monthlydownload </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>sqlcounter monthlydownload {
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>counter-name =
"Monthly-Download-Byte" </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>check-name = "Max-Monthly-Download"
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>reply-name = "Session-Octets-Limit"
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>key = "User-Name" </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>sqlmod-inst = "sql" </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>query = "SELECT
SUM(AcctOutputOctets+AcctInputOctets) FROM radacct WHERE UserName='%{%k}' AND
AcctStartTime > FROM_UNIXTIME('%b')" </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>reset = "monthly" </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>safe-characters =
"@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>} </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sqlcounter: Reply attribute
Session-Octets-Limit is number 3009 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sqlcounter: Counter attribute
Monthly-Download-Byte is number 11273 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sqlcounter: Check attribute
Max-Monthly-Download is number 11274 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sqlcounter: Current Time:
1259506851 [2009-11-29 18:30:51], Next reset 1259613000 [2009-12-01 00:00:00]
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sqlcounter: Current Time:
1259506851 [2009-11-29 18:30:51], Prev reset 1257021000 [2009-11-01 00:00:00]
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Module: Checking preacct {...} for
more modules to load </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>. </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>. </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>. </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sqlcounter: Entering module
authorize code </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>sqlcounter_expand: 'SELECT
SUM(AcctOutputOctets+AcctInputOctets) FROM radacct WHERE
UserName='%{User-Name}' AND AcctStartTime > FROM_UNIXTIME('1257021000')'
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>[monthlydownload] expand: SELECT
SUM(AcctOutputOctets+AcctInputOctets) FROM radacct WHERE
UserName='%{User-Name}' AND AcctStartTime > FROM_UNIXTIME('1257021000')
-> SELECT SUM(AcctOutputOctets+AcctInputOctets) FROM radacct WHERE
UserName='hrh' AND AcctStartTime > FROM_UNIXTIME('1257021000') </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>sqlcounter_expand: '%{sql:SELECT
SUM(AcctOutputOctets+AcctInputOctets) FROM radacct WHERE UserName='hrh' AND
AcctStartTime > FROM_UNIXTIME('1257021000')}' </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>[monthlydownload] sql_xlat
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>[monthlydownload] expand:
%{User-Name} -> hrh </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>[monthlydownload] sql_set_user
escaped user --> 'hrh' </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>[monthlydownload] expand: SELECT
SUM(AcctOutputOctets+AcctInputOctets) FROM radacct WHERE UserName='hrh' AND
AcctStartTime > FROM_UNIXTIME('1257021000') -> SELECT
SUM(AcctOutputOctets+AcctInputOctets) FROM radacct WHERE UserName='hrh' AND
AcctStartTime > FROM_UNIXTIME('1257021000') </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>[monthlydownload] expand:
/usr/var/log/radius/sqltrace.sql -> /usr/var/log/radius/sqltrace.sql
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sql (sql): Reserving sql socket
id: 3 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sql_mysql: query: SELECT
SUM(AcctOutputOctets+AcctInputOctets) FROM radacct WHERE UserName='hrh' AND
AcctStartTime > FROM_UNIXTIME('1257021000') </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>[monthlydownload] sql_xlat finished
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sql (sql): Released sql socket
id: 3 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>[monthlydownload] expand:
%{sql:SELECT SUM(AcctOutputOctets+AcctInputOctets) FROM radacct WHERE
UserName='hrh' AND AcctStartTime > FROM_UNIXTIME('1257021000')} ->
100213 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sqlcounter: Check item is
greater than query result </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sqlcounter: Authorized user
hrh, check_item=600000000, counter=100213 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>rlm_sqlcounter: Sent Reply-Item for
user hrh, Type=Session-Octets-Limit, value=600106145 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>++[monthlydownload] returns ok
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>. </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>. </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>. </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Sending Access-Accept of id 222 to
127.0.0.1 port 32769 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Framed-IP-Address := 20.20.20.1
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Framed-IP-Netmask := 255.255.255.0
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Session-Timeout = 5460 </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Finished request 0. </FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Going to the next request
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"><FONT size=2>Waking up in 4.9 seconds.
</FONT></P>
<P style="MARGIN-BOTTOM: 0in"></P>
<P></P>
<P></P>________________________________________________________________
<DIV
style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; WIDTH: 468px; BORDER-TOP: 0px; BORDER-RIGHT: 0px; solid: ">
<FORM method=get action=http://order.1and1.com/dcjump target=_blank>
<P align=center>5 free Domains with Select Hosting Plans. Get yours!</P>
<CENTER>
<TABLE border=0 width=320>
<TBODY>
<TR>
<TD class=form><INPUT value=25085883 type=hidden name=k_id> <INPUT
maxLength=500 name=domain> </TD>
<TD><SELECT style="WIDTH: 60px" name=tld> <OPTION selected
value=com>com</OPTION> <OPTION value=net>net</OPTION> <OPTION
value=org>org</OPTION> <OPTION value=info>info</OPTION> <OPTION
value=us>us</OPTION> <OPTION value=name>name</OPTION> <OPTION
value=biz>biz</OPTION> <OPTION value=cc>cc</OPTION> <OPTION
value=tv>tv</OPTION> <OPTION value=ws>ws</OPTION> <OPTION
value=mobi>mobi</OPTION></SELECT> </TD>
<TD> </TD>
<TD><INPUT value="Check Domain" type=submit name=Submit>
</TD></TR></TBODY></TABLE></CENTER></FORM></DIV>
<P>
<HR>
<P></P>-<BR>List info/subscribe/unsubscribe? See
http://www.freeradius.org/list/users.html</BLOCKQUOTE><p></p><p></p>________________________________________________________________
<div style='border:0px; solid black; width:468px;'>
<form method='get' target='_blank' ACTION='http://order.1and1.com/dcjump'>
<p align='center'>5 free Domains with Select Hosting Plans. Get yours!</p>
<center> <table border='0' width='320'>
<tr>
<td class='form'>
<input name='k_id' value='25085883' type='hidden'/>
<input size='20' maxlength='500' name='domain' type='text'/>
</td>
<td>
<select style='width:60px' name='tld'>
<option value='com'>com</option>
<option value='net'>net</option>
<option value='org'>org</option>
<option value='info'>info</option>
<option value='us'>us</option>
<option value='name'>name</option>
<option value='biz'>biz</option>
<option value='cc'>cc</option>
<option value='tv'>tv</option>
<option value='ws'>ws</option>
<option value='mobi'>mobi</option>
</select>
</td>
<td>
</td>
<td>
<input type='submit' name='Submit' value='Check Domain'/>
</td>
</tr>
</table>
</center> </form>
</div>
</BODY></HTML>