Unable to authenticate with rlm_perl

2008-04-02 Thread johnson elangbam
hi,
I am trying to used the rlm_perl for authentication, I've found reading
all the perl modules, but wouldn't able to handle the username from the
client. For the testing purpose I've put this simple script in the perl
program

if ($RAD_REQUEST{'User-Name'} eq john)
  {
 $RAD_REPLY{'A message'} =  Accepting John;
 return RLM_MODULE_OK;

   }
 else
  {
 $RAD_REPLY{'A message'} = Rececting users;
 return RLM_MODULE_REJECT;
  }

unfortunately everytime i try to authenticate the user john regardless of
the password, the server rejects all the time

here is the piece of output after rejecting the users

rad_recv: Access-Request packet from host 127.0.0.1 port 32866, id=177,
length=56
User-Name = john
User-Password = password
NAS-IP-Address = 127.0.0.1
NAS-Port = 0
+- entering group authorize
++[preprocess] returns ok
perl_pool: item 0x9e63c98 asigned new request. Handled so far: 1
found interpetator at address 0x9e63c98
rlm_perl: Added pair User-Name = john
rlm_perl: Added pair User-Password = password
rlm_perl: Added pair NAS-Port = 0
rlm_perl: Added pair NAS-IP-Address = 127.0.0.1
perl_pool total/active/spare [32/0/32]
Unreserve perl at address 0x9e63c98
++[perl] returns ok
rlm_realm: No '@' in User-Name = john, looking up realm NULL
rlm_realm: No such realm NULL
++[suffix] returns noop
  rlm_eap: No EAP-Message, not doing EAP
++[eap] returns noop
users: Matched entry DEFAULT at line 203
++[files] returns ok
++[expiration] returns noop
++[logintime] returns noop
rlm_pap: WARNING! No known good password found for the user.
Authentication may fail because of this.
++[pap] returns noop
  rad_check_password:  Found Auth-Type Perl
auth: type Perl
+- entering group Perl
perl_pool: item 0xa08e5d8 asigned new request. Handled so far: 1
found interpetator at address 0xa08e5d8
1,bill,Cleartext-Password,bill,:=
Use of uninitialized value in string eq at
/usr/local/etc/raddb/example.pmline 126.
rlm_perl: Added pair User-Name = john
rlm_perl: Added pair User-Password = password
rlm_perl: Added pair NAS-IP-Address = 127.0.0.1
rlm_perl: Added pair NAS-Port = 0
rlm_perl: Added pair Auth-Type = Perl
perl_pool total/active/spare [32/0/32]
Unreserve perl at address 0xa08e5d8
++[perl] returns reject
auth: Failed to validate the user.
Login incorrect: [john/password] (from client localhost port 0)
  Found Post-Auth-Type Reject
+- entering group REJECT
expand: %{User-Name} - john
 attr_filter: Matched entry DEFAULT at line 11
++[attr_filter.access_reject] returns updated
Delaying reject of request 0 for 1 seconds
Going to the next request
Waking up in 0.9 seconds.
Sending delayed reject for request 0
Sending Access-Reject of id 177 to 127.0.0.1 port 32866
Waking up in 4.9 seconds.
Cleaning up request 0 ID 177 with timestamp +10
Ready to process requests.


Regards,
Elangbam Johnson
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Re: Unable to authenticate with rlm_perl

2008-04-02 Thread A . L . M . Buxey
Hi,

 client. For the testing purpose I've put this simple script in the perl
 program
 
 if ($RAD_REQUEST{'User-Name'} eq john)
   {
  $RAD_REPLY{'A message'} =  Accepting John;
  return RLM_MODULE_OK;
 
}
  else
   {
  $RAD_REPLY{'A message'} = Rececting users;
  return RLM_MODULE_REJECT;
   }

and in which subroutine is this sat? and are you calling perl
for that subroutine?  freeradius is also spewing out that your
perl example.pm has an error in in.  this basic example
might work for you

# examplev2 - version 0.0.1a
# Author:  Alan Buxey
# Date:   02/04/2008
# (c) alan buxey 2008 - you may modify/reuse this code so long
# as the known origin is marked - licenced under GPL etc

use strict;
use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK);

use constantRLM_MODULE_REJECT=0;#  /* immediately reject the request */
use constantRLM_MODULE_FAIL=  1;#  /* module failed, don't reply */
use constantRLM_MODULE_OK=2;#  /* the module is OK, continue */
use constantRLM_MODULE_HANDLED=   3;#  /* the module handled the request, 
so stop. */
use constantRLM_MODULE_INVALID=   4;#  /* the module considers the request 
invalid. */
use constantRLM_MODULE_USERLOCK=  5;#  /* reject the request (user is 
locked out) */
use constantRLM_MODULE_NOTFOUND=  6;#  /* user not found */
use constantRLM_MODULE_NOOP=  7;#  /* module succeeded without doing 
anything */
use constantRLM_MODULE_UPDATED=   8;#  /* OK (pairs modified) */
use constantRLM_MODULE_NUMCODES=  9;#  /* How many return codes there are 
*/

sub authorize {

if ($RAD_REQUEST{'User-Name'} eq john)
  {
 $RAD_REPLY{'Reply-Message'} =  Accepting John;
 return RLM_MODULE_OK;

   }
 else
  {
 $RAD_REPLY{'Reply-Message'} = Rejcecting users;
 return RLM_MODULE_REJECT;
  }

# end of the authorize subsection

}

alan
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html