I am using Freeradius 2.1.6. I have a working setup of freeradius with perl scripts inside authorize and accounting sections. Everything works great when i am using only one script. But. if i add another script to do some other stuff for example in post-auth section i get errors in log and freeradius dies. Error i get is: Error: rlm_perl: perl_embed:: module = /etc/raddb/config_dialup/perl_script_2.pl , func = post_auth exit status= Undefined subroutine &main::post_auth called. My perl setup is like this: perl perl_script_1 { module = ${confdir}/config_dialup/perl_script_1.pl func_authorize = authorize_check_username func_accounting = accounting_check_username } perl perl_script_2 { module = ${confdir}/config_dialup/perl_script_2.pl } If i put everything into one script, like this: perl perl_script_1 { module = ${confdir}/config_dialup/perl_script_1.pl func_authorize = authorize_check_username func_accounting = accounting_check_username } perl perl_script_2 { module = ${confdir}/config_dialup/perl_script_1.pl } then everything is ok. Did any of you had these problems? Thank you
I am using Freeradius 2.1.6.
I have a working setup of freeradius with perl scripts inside authorize and accounting sections. Everything works great when i am using only one script. But. if i add another script to do some other stuff for example in post-auth section i get errors in log and freeradius dies.
Error i get is: Error: rlm_perl: perl_embed:: module = /etc/raddb/config_dialup/perl_script_2.pl , func = post_auth exit status= Undefined subroutine &main::post_auth called.
Have you defined func_post_auth? Ivan Kalik Kalik Informatika ISP
Ivan Kalik wrote:
Have you defined func_post_auth?
Ivan Kalik Kalik Informatika ISP
Left everything by default. Made script by using example.pl as template. Both scripts are looking exactly the same, except that i don't use default function names for perl_script_1. perl perl_script_1 { module = ${confdir}/config_dialup/perl_script_1.pl func_authorize = authorize_check_username func_accounting = accounting_check_username } perl perl_script_2 { module = ${confdir}/config_dialup/perl_script_2.pl } This means that perl will use default function names for perl_script_2 and different function names for perl_script_1, right? or am i missing something? Igor
Ivan Kalik wrote:
Have you defined func_post_auth?
Ivan Kalik Kalik Informatika ISP
Left everything by default. Made script by using example.pl as template. Both scripts are looking exactly the same, except that i don't use default function names for perl_script_1.
perl perl_script_1 { module = ${confdir}/config_dialup/perl_script_1.pl func_authorize = authorize_check_username func_accounting = accounting_check_username }
perl perl_script_2 {
module = ${confdir}/config_dialup/perl_script_2.pl }
Is that a no? Neither of these instances you have posted has func_post_auth defined. Ivan Kalik Kalik Informatika ISP
Ivan Kalik wrote:
perl perl_script_1 { module = ${confdir}/config_dialup/perl_script_1.pl func_authorize = authorize_check_username func_accounting = accounting_check_username }
perl perl_script_2 {
module = ${confdir}/config_dialup/perl_script_2.pl }
Is that a no? Neither of these instances you have posted has func_post_auth defined.
Ivan Kalik Kalik Informatika ISP
Yes, that is a no. I only defined functions for which i changed names. Didn't define functions that are left with default name. I did it that way because in original perl all func_* are commented out. Here is an example. i was using authorize section for this: Just tested it. It doesn't work in both cases, with func_authorize defined and without it. In authorize section i have put dummy: authorize { ***** dummy ***** } in modules/perl: perl dummy { module = ${confdir}/scripts/dummy.pl func_authorize = authorize } in dummy.pl: use strict; use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK); use Data::Dumper; #my %RAD_REQUEST; #my %RAD_REPLY; #my %RAD_CHECK; use constant RLM_MODULE_REJECT=> 0;# /* immediately reject the request */ use constant RLM_MODULE_FAIL=> 1;# /* module failed, don't reply */ use constant RLM_MODULE_OK=> 2;# /* the module is OK, continue */ use constant RLM_MODULE_HANDLED=> 3;# /* the module handled the request, so stop. */ use constant RLM_MODULE_INVALID=> 4;# /* the module considers the request invalid. */ use constant RLM_MODULE_USERLOCK=> 5;# /* reject the request (user is locked out) */ use constant RLM_MODULE_NOTFOUND=> 6;# /* user not found */ use constant RLM_MODULE_NOOP=> 7;# /* module succeeded without doing anything */ use constant RLM_MODULE_UPDATED=> 8;# /* OK (pairs modified) */ use constant RLM_MODULE_NUMCODES=> 9;# /* How many return codes there are */ sub authorize { &radiusd::radlog(0, "DUMMY"); return RLM_MODULE_OK; } It ends with freeradius crashing. If i disable all other perl calls and leave only dummy.pl works with no problems. Same goes for other way around. Basicaly, any combination that involves only one perl script works without any problems. If i use two perl scripts in any combination freeradius crashes.
It ends with freeradius crashing. If i disable all other perl calls and leave only dummy.pl works with no problems. Same goes for other way around. Basicaly, any combination that involves only one perl script works without any problems. If i use two perl scripts in any combination freeradius crashes.
Let me see if I understand well: you can run multiple perl module instances as long as they execute same script; if different instances run different scripts - freeradius crashes! I will try to emulate this tonight. I haven't tried this scenario. But I can run perl + radcheck (also perl script, but not called through perl module) without problems. Ivan Kalik Kalik Informatika ISP
Here's a small excerpt from debug output I have showing this problem: Tue Jul 21 09:32:36 2009 : Error: rlm_perl: perl_embed:: module = /usr/local/etc/raddb/write_log_data.pl , func = post_auth_reject exit status= Undefined subroutine &main::post_auth_reject called. Segmentation fault: 11 (core dumped) Subroutine post_auth_reject definitely exists in write_log_data.pl and this same script/config is working in my Production 2.0.3 and 2.0.5 systems. -----Original Message----- From: freeradius-users-bounces+neal.garber=energyeast.com@lists.freeradius.org [mailto:freeradius-users-bounces+neal.garber=energyeast.com@lists.freeradius.org] On Behalf Of Ivan Kalik Sent: Friday, July 24, 2009 10:43 AM To: FreeRadius users mailing list Subject: Re: rlm_perl problems]
It ends with freeradius crashing. If i disable all other perl calls and leave only dummy.pl works with no problems. Same goes for other way around. Basicaly, any combination that involves only one perl script works without any problems. If i use two perl scripts in any combination freeradius crashes.
Let me see if I understand well: you can run multiple perl module instances as long as they execute same script; if different instances run different scripts - freeradius crashes! I will try to emulate this tonight. I haven't tried this scenario. But I can run perl + radcheck (also perl script, but not called through perl module) without problems. Ivan Kalik Kalik Informatika ISP - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Ivan Kalik wrote:
It ends with freeradius crashing. If i disable all other perl calls and leave only dummy.pl works with no problems. Same goes for other way around. Basicaly, any combination that involves only one perl script works without any problems. If i use two perl scripts in any combination freeradius crashes.
Let me see if I understand well: you can run multiple perl module instances as long as they execute same script; if different instances run different scripts - freeradius crashes!
I will try to emulate this tonight. I haven't tried this scenario. But I can run perl + radcheck (also perl script, but not called through perl module) without problems. Yes, i can define multiple perl instances as long as they call same perl script. It looks like two different perl scripts cannot coexist in memory at the same time. Workaround for now is to have one perl script active and through func_* definitions have different functions called and do tasks needed, like i stated in one of my examples earlier in this thread.
P.S. chekrad works for me too, i use it for simultaneous-use. I was trying to use unlang as much as possible, but there are two tasks left that i need perl for. Thank you, Igor
Igor, What version of perl and what O/S are you using? I'm using FreeBSD 7.2 with perl 5.8.9. The reason I hadn't submitted this sooner is I wanted to rule out an issue with perl (our Productions servers are running an older version of FreeBSD and perl).
Garber, Neal wrote:
Igor,
What version of perl and what O/S are you using? I'm using FreeBSD 7.2 with perl 5.8.9. The reason I hadn't submitted this sooner is I wanted to rule out an issue with perl (our Productions servers are running an older version of FreeBSD and perl). perl, v5.8.8 built for x86_64-linux-thread-multi, installed with yum OS: CentOS X64, kernel 2.6.18-128.1.10.el5
freeradius installed from rpm, rpm made with freeradius.spec file: %define _prefix /usr/local/freeradius %configure --prefix=%{_prefix} \ --with-system-libtool \ --disable-ltdl-install \ --with-ltdl-lib=/usr/lib \ --with-ltdl-include=/usr/include \ --with-large-files --with-udpfromto --with-edir \ --with-rlm-krb5-include-dir=/usr/kerberos/include \ --with-rlm-krb5-lib-dir=/usr/kerberos/lib \ --with-logdir=/var/log/radius
Garber, Neal wrote:
Igor,
What version of perl and what O/S are you using? I'm using FreeBSD 7.2 with perl 5.8.9. The reason I hadn't submitted this sooner is I wanted to rule out an issue with perl (our Productions servers are running an older version of FreeBSD and perl). perl, v5.8.8 built for x86_64-linux-thread-multi, installed with yum OS: CentOS X64, kernel 2.6.18-128.1.10.el5
freeradius installed from rpm, rpm made with freeradius.spec file: %define _prefix /usr/local/freeradius %configure --prefix=%{_prefix} \ --with-system-libtool \ --disable-ltdl-install \ --with-ltdl-lib=/usr/lib \ --with-ltdl-include=/usr/include \ --with-large-files --with-udpfromto --with-edir \ --with-rlm-krb5-include-dir=/usr/kerberos/include \ --with-rlm-krb5-lib-dir=/usr/kerberos/lib \ --with-logdir=/var/log/radius
Slackware 12.1, perl 5.8.7. I am afraid I can't emulate this. test1 and test2 run copies of example.pl. I have edited them so they are not identical (just in case). Result: ... [files] users: Matched entry tnt at line 1 ++[files] returns ok rlm_perl: Added pair User-Name = tnt rlm_perl: Added pair User-Password = xxxxx rlm_perl: Added pair NAS-Port = 0 rlm_perl: Added pair NAS-IP-Address = 212.200.152.xx rlm_perl: Added pair Cleartext-Password = xxxxx ++[test1] returns ok ++[expiration] returns noop ++[logintime] returns noop ++[pap] returns updated Found Auth-Type = PAP +- entering group PAP {...} [pap] login attempt with password "xxxxx" [pap] Using clear text password "xxxxx" [pap] User authenticated successfully ++[pap] returns ok +- entering group post-auth {...} rlm_perl: Added pair User-Name = tnt rlm_perl: Added pair User-Password = xxxxx rlm_perl: Added pair NAS-IP-Address = 212.200.152.xx rlm_perl: Added pair NAS-Port = 0 rlm_perl: Added pair Cleartext-Password = xxxxx rlm_perl: Added pair Auth-Type = PAP ++[test2] returns ok ++[exec] returns noop Sending Access-Accept of id 104 to 127.0.0.1 port 37266 Finished request 0. Going to the next request Waking up in 4.9 seconds. Cleaning up request 0 ID 104 with timestamp +5 Ready to process requests. Two perl instances running different perl scripts! I would suggest following instructions in doc/bugs to find out what is causing the segfault. PS. My test server is running 2.1.7 pre-release (http://git.freeradius.org/pre/). Try upgrading to that and see if the problem goes away. Ivan Kalik Kalik Informatika ISP
Two perl instances running different perl scripts! I would suggest following instructions in doc/bugs to find out what is causing the segfault.
rlm_perl is acting very strangely on my 2.1.6 test system (beyond what I've already mentioned). I have two instances of a script called write_log_data.pl that are called in post_auth. One instance is called write_log_accept (post_auth = post_auth_accept) and the other is write_log_reject (post_auth = post_auth_reject). I have another script called dumplists.pl that is not called in post_auth at all. When I was testing (trying to recreate SegFault), post_auth_accept was calling dumplists.pl (I added subroutines post_auth_accept and post_auth_reject to dumplists.pl and had them write msgs via &radiusd::radlog). I changed the message in dumplists.pl post_auth_accept and restarted. Now rlm_perl properly called script write_log_data.pl sub post_auth_accept - but output an error that it couldn't find it. So, it returned reject which caused an attempt to call write_log_data sub post_auth_reject; which also output an error saying it couldn't find it (undefined subroutine as Igor and I described in previous msgs). So, I took your advice above and rebuilt FR with symbols and ran Under gdb. But, I also decided to look back at the build output for rlm_perl. I believe the errors below are causing my problems (redundant declarations coming from /usr/include). I'm thinking it should be using the perl version of the definitions as opposed to the version in /usr/include. I'll test this theory.. I can post the FR debug and gdb output if someone thinks the errors below are normal. Igor: Can you rebuild FR and look at the output of rlm_perl on your system to see if you see similar errors? Here is the output from building rlm_perl on my system: Making all in rlm_perl... gmake[6]: Entering directory `/usr/ports/net/freeradius2/work/freeradius-server-2.1.6/src/modules/rlm_perl' /usr/local/bin/libtool --mode=compile cc -pipe -I/usr/local/include -L/usr/local/lib -DLDAP_DEPRECATED -pthread -Wall -D_GNU_SOURCE -g -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef -I/usr/ports/net/freeradius2/work/freeradius-server-2.1.6/src -I/usr/ports/net/freeradi us2/work/freeradius-server-2.1.6/libltdl `perl -MExtUtils::Embed -e ccopts` -c rlm_perl.c mkdir .libs cc -pipe -I/usr/local/include -L/usr/local/lib -DLDAP_DEPRECATED -pthread -Wall -D_GNU_SOURCE -g -Wshadow -Wpointer-arith -Wcast-qua l -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef -I/usr/ports/net/freeradius2/work/freeradius-server-2.1.6/src -I/usr/ports/net/freeradius2/work/freeradius-server-2.1.6/liblt dl -DAPPLLIB_EXP=\"/usr/local/lib/perl5/5.8.9/BSDPAN\" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/ include -I/usr/local/lib/perl5/5.8.9/mach/CORE -c rlm_perl.c -fPIC -DPIC -o .libs/rlm_perl.o In file included from rlm_perl.c:39: /usr/local/lib/perl5/5.8.9/mach/CORE/perl.h:1207: warning: redundant redeclaration of 'strerror' /usr/include/string.h:83: warning: previous declaration of 'strerror' was here In file included from rlm_perl.c:39: /usr/local/lib/perl5/5.8.9/mach/CORE/perl.h:3380: warning: redundant redeclaration of 'getuid' /usr/include/unistd.h:349: warning: previous declaration of 'getuid' was here /usr/local/lib/perl5/5.8.9/mach/CORE/perl.h:3381: warning: redundant redeclaration of 'geteuid' /usr/include/unistd.h:342: warning: previous declaration of 'geteuid' was here /usr/local/lib/perl5/5.8.9/mach/CORE/perl.h:3382: warning: redundant redeclaration of 'getgid' /usr/include/unistd.h:343: warning: previous declaration of 'getgid' was here /usr/local/lib/perl5/5.8.9/mach/CORE/perl.h:3383: warning: redundant redeclaration of 'getegid' /usr/include/unistd.h:341: warning: previous declaration of 'getegid' was here /usr/local/lib/perl5/5.8.9/mach/CORE/perl.h:3678: warning: redundant redeclaration of 'mktemp' /usr/include/unistd.h:506: warning: previous declaration of 'mktemp' was here /usr/local/lib/perl5/5.8.9/mach/CORE/perl.h:3680: warning: redundant redeclaration of 'atof' /usr/include/stdlib.h:86: warning: previous declaration of 'atof' was here In file included from rlm_perl.c:39: /usr/local/lib/perl5/5.8.9/mach/CORE/perl.h:3771: warning: redundant redeclaration of 'crypt' /usr/include/unistd.h:427: warning: previous declaration of 'crypt' was here /usr/local/lib/perl5/5.8.9/mach/CORE/perl.h:3777: warning: redundant redeclaration of 'getenv' /usr/include/stdlib.h:95: warning: previous declaration of 'getenv' was here /usr/local/lib/perl5/5.8.9/mach/CORE/perl.h:3788: warning: redundant redeclaration of 'getlogin' /usr/include/unistd.h:345: warning: previous declaration of 'getlogin' was here rlm_perl.c: In function 'rlm_perl_get_handles': rlm_perl.c:164: warning: cast to pointer from integer of different size rlm_perl.c: In function 'rlm_perl_destruct': rlm_perl.c:206: warning: declaration of 'my_perl' shadows a previous local rlm_perl.c:197: warning: shadowed declaration is here rlm_perl.c: In function 'rlm_perl_make_key': rlm_perl.c:238: warning: passing argument 2 of 'pthread_key_create' from incompatible pointer type rlm_perl.c: In function 'rlm_perl_clone': rlm_perl.c:268: warning: format '%d' expects type 'int', but argument 3 has type 'pthread_t' rlm_perl.c: In function 'xs_init': rlm_perl.c:276: warning: initialization discards qualifiers from pointer target type rlm_perl.c:279: warning: passing argument 2 of 'Perl_newXS' discards qualifiers from pointer target type rlm_perl.c: In function 'perl_xlat': rlm_perl.c:362: warning: value computed is not used rlm_perl.c: In function 'perl_instantiate': rlm_perl.c:429: warning: assignment discards qualifiers from pointer target type rlm_perl.c:433: warning: assignment discards qualifiers from pointer target type rlm_perl.c:477: warning: passing argument 2 of 'Perl_newXS' discards qualifiers from pointer target type rlm_perl.c:477: warning: passing argument 4 of 'Perl_newXS' discards qualifiers from pointer target type rlm_perl.c: In function 'perl_store_vps': rlm_perl.c:524: warning: assignment discards qualifiers from pointer target type rlm_perl.c:537: warning: value computed is not used rlm_perl.c:549: warning: value computed is not used rlm_perl.c: In function 'rlmperl_call': rlm_perl.c:704: warning: value computed is not used
I've been debating sending a similar message to the list as well. I am also experiencing the same problem with 2.1.6 (undefined subroutines that *clearly* exist in the script) and Seg Faults. I have reinstalled perl and then reinstalled FreeRadius to see if I can work around the issue with no success. Even the example.pl that comes with FR 2.1.6 fails. Currently, I have some of my scripts disabled to workaround the problem. -----Original Message----- From: freeradius-users-bounces+neal.garber=energyeast.com@lists.freeradius.org [mailto:freeradius-users-bounces+neal.garber=energyeast.com@lists.freeradius.org] On Behalf Of Igor Smitran Sent: Friday, July 24, 2009 8:30 AM To: freeradius-users@lists.freeradius.org Subject: rlm_perl problems] I am using Freeradius 2.1.6. I have a working setup of freeradius with perl scripts inside authorize and accounting sections. Everything works great when i am using only one script. But. if i add another script to do some other stuff for example in post-auth section i get errors in log and freeradius dies. Error i get is: Error: rlm_perl: perl_embed:: module = /etc/raddb/config_dialup/perl_script_2.pl , func = post_auth exit status= Undefined subroutine &main::post_auth called. My perl setup is like this: perl perl_script_1 { module = ${confdir}/config_dialup/perl_script_1.pl func_authorize = authorize_check_username func_accounting = accounting_check_username } perl perl_script_2 { module = ${confdir}/config_dialup/perl_script_2.pl } If i put everything into one script, like this: perl perl_script_1 { module = ${confdir}/config_dialup/perl_script_1.pl func_authorize = authorize_check_username func_accounting = accounting_check_username } perl perl_script_2 { module = ${confdir}/config_dialup/perl_script_1.pl } then everything is ok. Did any of you had these problems? Thank you - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
participants (3)
-
Garber, Neal -
Igor Smitran -
Ivan Kalik