configuration parameters for perl module in rlm_perl

Chaigneau, Nicolas nicolas.chaigneau at capgemini.com
Fri Mar 14 14:41:03 CET 2014


Hello,

I had the same need.

I made some changes to rlm_perl to handle a configuration sub-section, eg:


perl my_perl_instance {
	filename = ${modconfdir}/perl/my_perl_script.pl
	
	# perl configuration items
	perl_conf {
		attribute = value
		another_attr = 1234
	}
}


I modified rlm_perl to read the subsection "perl_conf" in instantiate, populate a hash, and define a new perl hash passed to the perl code whenever a section is called.
This hash can be manipulated in the same way as the attribute hashes, for instance:

our (%RAD_REQUEST, %RAD_REPLY, %RAD_REQUEST_PROXY_REPLY, %RAD_CHECK, %RAD_PERLCONF);

my $value = $RAD_PERLCONF{'attribute'};



If people is interested, I can share the code.
I have no idea how to submit a git patch though, but I can provide the modified file as is.





> -----Message d'origine-----
> De : freeradius-users-
> bounces+nicolas.chaigneau=capgemini.com at lists.freeradius.org
> [mailto:freeradius-users-
> bounces+nicolas.chaigneau=capgemini.com at lists.freeradius.org] De la
> part de Thomas Glanzmann
> Envoyé : vendredi 14 mars 2014 14:26
> À : FreeRadius users mailing list
> Objet : Re: configuration parameters for perl module in rlm_perl
> 
> Hallo,
> 
> > is there are recommended way to pass configuration parameter to a
> > rlm_perl module?
> 
> I had the same problem and came to the conclusion it is not possible
> without changing the FreeRadius code. I solved it by using two
> configuration directories and symlinking the perl code and extracting
> the basename within the perl module:
> 
> our $mandant = dirname($0) . '/';
> 
> It also seems to be possible to do something like that: Which I don't
> liked:
> 
> perl_flags ='-e "\$ENV{mandant} = \"VDI\"; do \"/path/to/file\"';
> 
> Cheers,
>         Thomas
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.



More information about the Freeradius-Users mailing list