(RADIATOR) Multiple check items as logical OR

Hugh Irvine hugh at open.com.au
Fri Oct 11 06:18:37 CDT 2002


Hello David -

The answer to your question is "it depends". It depends on the 
complexity of the regular expression, and it also depends on the number 
of Handlers and where in the list this particular one is.

Specifically for Called-Station-Id's I would suggest either an AuthBy 
SQLRADIUS clause, or the special <CalledStationId ...> construct 
contained in "goodies/CalledStationId.pm" which keeps the 
Called-Station-Id's in a hash and does a lookup based on the value of 
the Called-Station-Id attribute.

regards

Hugh


On Friday, October 11, 2002, at 04:52 PM, <david.kramar at aliatel.cz> 
wrote:

> Hi Martin
>
> You can use regular expression like this:
>
> <Handeler Called-Station-Id =/1111|2222|3333|^33449900$/>
>
>
> match: 1111,*1111* number, where * any numer...
> match: ^33449900$ match only 33449900, not 334,3344990077 ....
>
>
> And same regular expr. you can use in db file, sql per user check.
>
> Hugh, one question: What is more speedy: Regular expression in Handler 
> or multiple Handler??
> i think little bit is more speedy multiple handler but no more than 5% 
> ...
>
> Hope help
> David
>
> -----Původní zpráva-----
> Od: Martin J. Laubach [mailto:mjl at laubach.at]
> Odesláno: 10. října 2002 23:14
> Komu: radiator at open.com.au
> Předmět: (RADIATOR) Multiple check items as logical OR
>
>
>   I want to discern whether an incoming call was for a certain
> phone number, so I add a check item Called-Station-Id = 1111.
> However, in reality, the phone number called may be 1111 or 2222,
> so I'd actually need an OR of two check items -- however, check
> items are always treated as logical AND which (apart from not
> making much sense to me) shoots me in the foot.
>
>   That problem could, of course, be done by adding a Handler especially
> for that situation -- however the client wants to keep most of
> the dialin configuration out of the radius.cfg file to centralize
> the data needing maintenance.
>
>   I have modified Radiator to interpret multiple occurrances
> of the same check item as logical OR. It's a ten line patch
> only -- however, I'm not sure whether (a) this doesn't break
> things in a subtle way (in fact it does break something, but
> that part is not used by my client anyway), and (b) it is the
> correct way to handle this (surely I'm not the first with that
> requirement, am I).
>
>   Comments, ideas, flames?
>
> 	mjl
> ===
> Archive at http://www.open.com.au/archives/radiator/
> Announcements on radiator-announce at open.com.au
> To unsubscribe, email 'majordomo at open.com.au' with
> 'unsubscribe radiator' in the body of the message.
> ===
> Archive at http://www.open.com.au/archives/radiator/
> Announcements on radiator-announce at open.com.au
> From owner-radiator at open.com.au Fri Oct 11 01:32:20 2002
Received: (from majordomo at localhost)
	by server1.open.com.au (8.11.0/8.11.0) id g9B6WKo04598
	for radiatorzz-list; Fri, 11 Oct 2002 01:32:20 -0500
X-Authentication-Warning: server1.open.com.au: majordomo set sender to owner-radiator at open.com.au using -f
Received: from entoo.connect.com.au (entoo.connect.com.au [192.189.54.8])
	by server1.open.com.au (8.11.0/8.11.0) with ESMTP id g9B6WIC04595
	for <radiator at open.com.au>; Fri, 11 Oct 2002 01:32:19 -0500
Received: from open.com.au (acc7-ppp139.mel.dialup.connect.net.au [210.10.130.139])
	by entoo.connect.com.au (Postfix) with ESMTP
	id 6F8C866C5E; Fri, 11 Oct 2002 21:19:04 +1000 (EST)
Date: Fri, 11 Oct 2002 21:22:50 +1000
Subject: Re: (RADIATOR) acct-start-time and acct-stop-time variables
Content-Type: text/plain; charset=US-ASCII; format=flowed
Mime-Version: 1.0 (Apple Message framework v546)
Cc: <radiator at open.com.au>
To: "Greg 'Rafiq' Clarkson" <gregc at netc.net.au>
From: Hugh Irvine <hugh at open.com.au>
In-Reply-To: <EKEOLHHCFIAEMADEHNNAMEEODCAA.gregc at netc.net.au>
Message-Id: <C6F53F1F-DD0B-11D6-AEBC-0003931DEC06 at open.com.au>
Content-Transfer-Encoding: 7bit
X-Mailer: Apple Mail (2.546)
Sender: owner-radiator at open.com.au
Precedence: bulk
List-Id: <radiator.list-id.open.com.au>


Hello Greg -

You are correct - there are no Acct-Start-Time or Acct-Stop-Time 
attributes.

You can either write a PreClientHook to add the corresponding 
pseudo-attributes to the accounting starts and accounting stops, or you 
can set up different Handlers.

# define Handlers

<Handler Acct-Status-Type = Start>
	.....
</Handler>

<Handler Acct-Status-Type = Stop>
	.....
</Handler>

<Handler Request-Type = Accounting-Request>
	.....
</Handler>

<Handler>
	.....
</Handler>


There are some example hooks in the file "goodies/hooks.txt".

regards

Hugh


On Friday, October 11, 2002, at 01:16 PM, Greg 'Rafiq' Clarkson wrote:

> Hi all,
>
> I am currently working with a contractor to integrate radiator 3.3.1 
> with
> freeside 1.4
>
> My freeside expert want me to insert 'Acct-Start-Time' and 
> 'Acct-Stop-Time'
> values into an sql database.
>
> The only values I know are 'start' and 'stop' records along with
> acct-session-time.
>
> I have grepped the dictionaries for these values without success.
>
> Do they exist as RADIUS attributes?
>
> BTW I know about the example in the manual:
> AcctColumnDef START_TIME,%b-0%{Acct-Session-Time},literal
>
> So just to test it I actually created 'Acct-Start-Time' and 
> 'Acct-Stop-Time'
> (see below) and they do insert timestamps into the database.  However, 
> they
> insert the SAME timestamp into each field.
>
> My freeside contractor wants it to only write into the acctstarttime 
> field
> when it is a start record and into the acctstoptime field when it is a 
> stop
> record.
>
> Anyhow for what it is worth I have included a reduced version of my 
> config
> file below.
>
>
> #
> # this is called by /usr/local/etc/rc.d/radius.sh
> #####################################################################
> ##
> ## Variable Definitions
> ##
>
> DefineGlobalVar dbSpec  dbi:Pg:dbname=radtest;host=localhost
> DefineGlobalVar dbUser  XXXXXXX
> DefineGlobalVar dbPass  XXXXXX
> ######################################################################
> ##
> ## Global parameters
> ##
>
> Trace   4
>
> PidFile         /var/run/radiator.pid
>
> User            radiator
> Group           radiator
>
> "radius-radacct.cfg" 133 lines, 3448 characters written
> greg at wiz-fiz:~: % cat radius-radacct.cfg
> # Configuration file for the Radiator RADIUS server.
> #
> # this is called by /usr/local/etc/rc.d/radius.sh
> #####################################################################
> ##
> ## Variable Definitions
> ##
>
> DefineGlobalVar dbSpec  dbi:Pg:dbname=radtest;host=localhost
> DefineGlobalVar dbUser  XXXXXXX
> DefineGlobalVar dbPass  XXXXXX
> ######################################################################
> ##
> ## Global parameters
> ##
>
> Trace   4
>
> PidFile         /var/run/radiator.pid
>
> User            radiator
> Group           radiator
>
> BindAddress     0.0.0.0
> AuthPort        1812
> AcctPort        1813
>
> DbDir           /usr/local/etc/radiator
> DictionaryFile  %D/dictionary
>
> LogDir          /var/log/radius
> # change logfile to null GC 120902
> LogFile
> #LogFile                %L/logfile.%Y-%m-%d
>
> UsernameCharset         a-zA-Z0-9\.\-_/%#@
> # rewrite usernames to lowercase
> RewriteUsername         tr/A-Z/a-z/
>
> ######################################################################
> ##
> ## Client Definitions
> ##
>
> ######################################################################
> ##
> ## AuthBy Definitions
> ##
>
> <AuthBy SQL>
>     Identifier   freeradius
>     NoDefault
>     IgnoreAccounting
>     DBSource    %{GlobalVar:dbSpec}
>     DBUsername  %{GlobalVar:dbUser}
>     DBAuth      %{GlobalVar:dbPass}
>     # AuthSelect
> </AuthBy>
>
> <AuthBy RADIUS>
>     Identifier  RadiusProxyAuth
>     IgnoreAccounting
>     Host        XXXXXXXXX
>     Secret      XXXXXXXXX
>     AuthPort    1812
>     AcctPort    1813
> </AuthBy>
>
> <AuthBy SQL>
>     Identifier  freeradius
>     IgnoreAuthentication
>     DBSource    %{GlobalVar:dbSpec}
>     DBUsername  %{GlobalVar:dbUser}
>     DBAuth      %{GlobalVar:dbPass}
>     HandleAcctStatusTypes Start,Stop
>     DateFormat  %Y-%m-%d %H:%M:%S
>
>     AccountingTable     radacct
>     AcctColumnDef       acctsessionid,Acct-Session-Id
>     AcctColumnDef       acctuniqueid,Acct-Unique-Id
>     AcctColumnDef       username,User-Name
>     AcctColumnDef       acctstatustype,Acct-Status-Type
>     AcctColumnDef       nasipaddress,NAS-IP-Address
>     AcctColumnDef       nasportid,NAS-Port,integer
>     AcctColumnDef       nasporttype,NAS-Port-Type
>     AcctColumnDef       acctstarttime,Acct-Start-Time,integer
>     AcctColumnDef       acctstoptime,Acct-Stop-Time,integer
>     #AcctColumnDef      acctstoptime,Timestamp,integer-date
>     AcctColumnDef       acctsessiontime,Acct-Session-Time,integer
>     AcctColumnDef       acctauthentic,Acct-Authentic,
>     AcctColumnDef       connectinfo_start,Connect-Info
>     AcctColumnDef       acctinputoctets,Acct-Input-Octets,integer
>     AcctColumnDef       acctoutputoctets,Acct-Output-Octets,integer
>     AcctColumnDef       calledstationid,Called-Station-Id
>     AcctColumnDef       callingstationid,Calling-Station-Id
>     AcctColumnDef       acctterminatecause,Ascend-Disconnect-Cause
>     AcctColumnDef       servicetype,Service-Type
>     AcctColumnDef       framedprotocol,Framed-Protocol
>     AcctColumnDef       framedipaddress,Framed-IP-Address
>     #AcctColumnDef      acctstartdelay,Acct-Delay-Time,integer
>     AcctColumnDef       acctstopdelay,Acct-Delay-Time,integer
>
>     AcctFailedLogFileName %L/detail.freeradius
> </AuthBy>
>
>
> ######################################################################
> ##
> ## SessionDatabase
> ##
>
> ######################################################################
> ##
> ## Logging
> ##
>
> ######################################################################
> ##
> ## Handler Definitions
> ##
>
> <Handler Request-Type=Accounting-Request>
>     AcctLogFileName     %L/detail_acc.%Y-%m
>     AuthByPolicy        ContinueAlways
>     AuthBy              freeradius
> </Handler>
>
> <Handler>
>     AcctLogFileName     %L/detail
>     AuthByPolicy        ContinueUntilAccept
>     AuthBy              freeradius
>     AuthBy              RadiusProxyAuth
> </Handler>
> greg at wiz-fiz:~: %
>
> ===
> Archive at http://www.open.com.au/archives/radiator/
> Announcements on radiator-announce at open.com.au
> To unsubscribe, email 'majordomo at open.com.au' with
> 'unsubscribe radiator' in the body of the message.
>
>

NB: I am travelling this week, so there may be delays in our 
correspondence.

-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows 95/98/2000, NT, MacOS X.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.

===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.
To unsubscribe, email 'majordomo at open.com.au' with
> 'unsubscribe radiator' in the body of the message.
>
>

NB: I am travelling this week, so there may be delays in our 
correspondence.

-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows 95/98/2000, NT, MacOS X.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.

===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list