[RADIATOR] Attribute values list

Hugh Irvine hugh at open.com.au
Tue Mar 16 16:15:38 CDT 2010


Hello Carlos -

There is an example hook in "goodies/hooks.txt" that does this for multiple "cisco-avpairs".

You would use something similar for your repeated attributes in a PreClientHook.

Then you can set up your Handlers using the decoded attributes.

hope that helps

regards

Hugh

BTW - here is the hook code for your convenience

.....

This hook is designed to parse multiple cisco-avpairs.

Contributed by:

Chris.Patterson at transact.com.au

All I'm doing here is taking each cisco-avpair attribute from the incoming packet and adding new attributes onto the same incoming packet.

eg:
        cisco-avpair = "task_id=62"
        cisco-avpair = "timezone=UTC"
        cisco-avpair = "service=shell"
        cisco-avpair = "priv-lvl=0"
        cisco-avpair = "cmd=exit <cr>"

become:
		task_id = 62
		timezone = UTC
		service = shell
		priv-lvl = 0
		cmd = "exit <cr>"

Hope this assists people in their endeavours!

Cheers
Chris.


radiator.cfg

<Handler>
	PreProcessingHook	file:"%D/createavpairs"
	<AuthBy SQL>
		DBSource	dbi:mysql:radius
		DBUsername	test
		DBAuth		test

		AccountingTable	ACCOUNTING
		AcctColumnDef		TIMESTAMP,Timestamp,integer
		AcctColumnDef		NASIP,NAS-IP-Address
		AcctColumnDef		USERNAME,User-Name
		AcctColumnDef		CALLLINGID,Calling-Station-Id
		AcctColumnDef		PRIVLVL,priv-lvl
		AcctColumnDef		CMD,cmd
	</AuthBy>
</Handler>


createavpairs

sub {
	my $p=${$_[0]};
	if (my @avpair = $p->get_attr('cisco-avpair')) {
		foreach my $avpair (@avpair) {
			$p->add_attr(split('=',$avpair));
		}
	}
}



On 16 Mar 2010, at 21:20, Carlos Parada wrote:

> Hi all,
> 
> I need to access to the list of values of a given attribute (when the attribute is repeated in a packet):
> - I need for example to write all values (or the nth value) in the Log file.
> - Using the perl code (code new issues) I need t know how to access the list of values.
> - In the handler matching rules, I need to say something like "if any of the values match this value or regexp"
> 
> How could I do all that (or at least some issues)? Any clues?
> 
> 
> Regards,
> Carlos Parada
> 
> _______________________________________________
> radiator mailing list
> radiator at open.com.au
> http://www.open.com.au/mailman/listinfo/radiator



NB: 

Have you read the reference manual ("doc/ref.html")?
Have you searched the mailing list archive (www.open.com.au/archives/radiator)?
Have you had a quick look on Google (www.google.com)?
Have you included a copy of your configuration file (no secrets), 
together with a trace 4 debug showing what is happening?

-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows, MacOS X.
Includes support for reliable RADIUS transport (RadSec),
and DIAMETER translation agent.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.
-
CATool: Private Certificate Authority for Unix and Unix-like systems.





More information about the radiator mailing list