Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Radius Client Module

by amphiplex (Monk)
on Jun 28, 2002 at 10:21 UTC ( [id://177983]=perlquestion: print w/replies, xml ) Need Help??

amphiplex has asked for the wisdom of the Perl Monks concerning the following question:

I need to write a simple script checking username and password against a Radius Server.
The only module I have found so far is RadiusPerl-0.05, which is rather old (1997).
Are there any newer modules providing radius client functions ?

Thanks,
      Kurt

Replies are listed 'Best First'.
Re: Radius Client Module
by rob_au (Abbot) on Jun 28, 2002 at 10:59 UTC
    Yep, there are the Net::Radius modules which incorporate methods for building packets for authentication and accounting against a Radius server - I have used these modules fairly extensively under their older namesake, RADIUS::Dictionary and RADIUS::Packet.

    An example of usage of these Perl modules can be found in the System RADIUS Client Daemon project on Freshmeat here - From the code base for the next (and long overdue) release for this project ...

    #!/usr/bin/perl use Net::Radius::Dictionary; use Net::Radius::Packet (); use Socket; . . . sub build_radius_packet { my (%attribute) = @_; my $packet = Net::Radius::Packet->new($CONFIG->{'dictionary'}); if (defined $packet) { $packet->set_code('Accounting-Request'); $packet->set_identifier(inet_ntoa(inet_aton($CONFIG->{'hostnam +e'}))); $packet->set_authenticator(undef); $packet->set_attr($_, $attribute{$_}) foreach sort keys %attri +bute; $packet->dump if $CONFIG->{'debug'}; } return $packet; } sub send_radius_packet { my ($packet) = @_; my $response; return undef unless socket(SOCK_UDP, PF_INET, SOCK_DGRAM, getproto +byname('udp')); my $data = Net::Radius::Packet::auth_resp($packet->pack, $CONFIG-> +{'secret'}); for (1..$CONFIG->{'retry'}) { send(SOCK_UDP, $data, 0, $remote_addr); sleep 1; vec(my $rbit, fileno(SOCK_UDP), 1) = 1; vec(my $wbit, fileno(SOCK_UDP), 1) = 1; $response = select($rbit, $wbit, ($rbit | $wbit), $CONFIG->{'t +imeout'}); last if $response > 1; } close(SOCK_UDP); return $response; }

     

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://177983]
Approved by rob_au
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found