[HELP] FreeRadius and External Script
Hi i request your help because i don't understand the process of FreeRadius and i am limited in the time ;=) Very thanks to all men that accept to help me. I have installed FreeRadius and my Cisco can talk with it without problems. Now i want that FreeRadius start a perl script for get the authentification. i have read a HOWTO and used example.pl but with no real success because all request are valided. When i start manually the script, we have: ./example.pl: line 26: use: command not found ./example.pl: line 29: syntax error near unexpected token `(' ./example.pl: line 29: `use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK);' i thinks that when freeradius start the script, he have the same message and valid the connexion no ? What is the good process for create a small script ? Thanks jerome
Hi,
When i start manually the script, we have:
./example.pl: line 26: use: command not found ./example.pl: line 29: syntax error near unexpected token `(' ./example.pl: line 29: `use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK);'
how are you running this script manually? looks like you're trying to run it as a shell script.... perl ./example.pl
What is the good process for create a small script ?
take the example.pl file and modify it to suit your needs...then ensure that it is called (ensure that experimental.conf is included in the config and that you call the perl module where you want it - eg post-auth, auth or such. alan
A.L.M.Buxey@lboro.ac.uk a écrit :
Hi,
When i start manually the script, we have:
./example.pl: line 26: use: command not found ./example.pl: line 29: syntax error near unexpected token `(' ./example.pl: line 29: `use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK);'
how are you running this script manually? looks like you're trying to run it as a shell script....
perl ./example.pl
Ok, when i start with this command, no error.
What is the good process for create a small script ?
take the example.pl file and modify it to suit your needs...then ensure that it is called (ensure that experimental.conf is included in the config and that you call the perl module where you want it - eg post-auth, auth or such.
alan -
Ok, now i think's that this script are started but i don't understand hit, he have a lot of sub but sub are not launched. if i understand, i put all of my perl script into the sub test_call no ? Bye jerome
Hi,
Ok, now i think's that this script are started but i don't understand hit, he have a lot of sub but sub are not launched.
if i understand, i put all of my perl script into the sub test_call no ?
its quite easy. in the experimental.conf file you state which routines you would like to be called....and then when the PERL script is run, it will call the relevant subroutine for the method wanted..... or, if its an auth thent he auth subroutine gets called. if its a post-auth, then the post-auth routine gets called. no other routine gets called unless you specifically code the routing in the code to call another routine (basic PERL here) if all you want is to use PERL to do an authentication test (eg a DB call rather than using the built-in DB support), then ensure the authentication routine is enabled in experimental.conf, that experimental.conf is pulled in by the FreeRADIUS config and that 'perl' is listed in the authentication section of the FreeRADIUS config. (be that radiusd.conf or sites-enabled/whatever-file) its quite easy to test/debug by uncommenting all the test/debug routines in the example.pl and maybe by even opening your own file, writing junk to it...and then closing it. tail that file as you test. alan
A.L.M.Buxey@lboro.ac.uk a écrit :
Hi,
Ok, now i think's that this script are started but i don't understand hit, he have a lot of sub but sub are not launched.
if i understand, i put all of my perl script into the sub test_call no ?
its quite easy. in the experimental.conf file you state which routines you would like to be called....and then when the PERL script is run, it will call the relevant subroutine for the method wanted..... or, if its an auth thent he auth subroutine gets called. if its a post-auth, then the post-auth routine gets called. no other routine gets called unless you specifically code the routing in the code to call another routine (basic PERL here)
if all you want is to use PERL to do an authentication test (eg a DB call rather than using the built-in DB support), then ensure the authentication routine is enabled in experimental.conf, that experimental.conf is pulled in by the FreeRADIUS config and that 'perl' is listed in the authentication section of the FreeRADIUS config. (be that radiusd.conf or sites-enabled/whatever-file)
its quite easy to test/debug by uncommenting all the test/debug routines in the example.pl and maybe by even opening your own file, writing junk to it...and then closing it. tail that file as you test.
alan -
Very thanks for your help Alan ;=) I start a new test with: in radiusd.conf: modules { perl { # # The Perl script to execute on authorize, authenticate, # accounting, xlat, etc. This is very similar to using # Exec-Program-Wait = "/path/foo.pl", but it is persistent, # and therefore faster. # module = "/etc/raddb/Test-Auth.pl" func_accounting = accounting func_authenticate = authenticate func_authorize = authorize func_preacct = preacct func_checksimul = checksimul func_xlat = xlat } } authorize { } authenticate { Auth-Type Perl { perl } } in users.conf: DEFAULT Auth-Type = Perl Fall-Through = 1 If i understand, when he receive a authentification request of my cisco, he start the script (Test-Auth.pl are a copy of example.pl) it's correct ?
authorize { }
authenticate { Auth-Type Perl { perl } }
in users.conf:
DEFAULT Auth-Type = Perl Fall-Through = 1
If i understand, when he receive a authentification request of my cisco, he start the script (Test-Auth.pl are a copy of example.pl)
it's correct ?
No. If this is what you really have in authorize and authenticate it won't do a thing. *Add* Auth-Type perl to the default configuration and it will. If you delete everything - nothing will work. Ivan Kalik Kalik Informatika ISP
On Mon, Jan 5, 2009 at 10:05 AM, Phibee Network Operation Center <noc@phibee.net> wrote:
A.L.M.Buxey@lboro.ac.uk a écrit :
Hi,
When i start manually the script, we have:
./example.pl: line 26: use: command not found ./example.pl: line 29: syntax error near unexpected token `(' ./example.pl: line 29: `use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK);'
how are you running this script manually? looks like you're trying to run it as a shell script....
perl ./example.pl
Ok, when i start with this command, no error.
What is the good process for create a small script ?
take the example.pl file and modify it to suit your needs...then ensure that it is called (ensure that experimental.conf is included in the config and that you call the perl module where you want it - eg post-auth, auth or such.
alan -
Ok, now i think's that this script are started but i don't understand hit, he have a lot of sub but sub are not launched.
if i understand, i put all of my perl script into the sub test_call no ?
In the example file you have some functions (subs) that are called by freeradius. This is the list if you did not change perl config: #func_authenticate = authenticate #func_authorize = authorize #func_preacct = preacct #func_accounting = accounting #func_checksimul = checksimul #func_pre_proxy = pre_proxy #func_post_proxy = post_proxy #func_post_auth = post_auth #func_xlat = xlat #func_detach = detach These functions are the entry point to the perl module. test_call is just an example name, you can change it if you want and of course you can create (and call) more functions to suite your needs. You can even change location and name of perl module. Check perl config. Note: In freeradius 2.1.3 perl config is in raddb/modules/perl Regards Luciano
participants (4)
-
A.L.M.Buxey@lboro.ac.uk -
Luciano Afranllie -
Phibee Network Operation Center -
tnt@kalik.net