Authen::Radius
provide simple Radius client facilities
- Provided by: libauthen-radius-perl (Version: 0.24-1)
- Report a bug
provide simple Radius client facilities
use Authen::Radius;
$r = new Authen::Radius(Host => 'myserver', Secret => 'mysecret');
print "auth result=", $r->check_pwd('myname', 'mypwd'), "\n";
$r = new Authen::Radius(Host => 'myserver', Secret => 'mysecret');
Authen::Radius->load_dictionary();
$r->add_attributes (
{ Name => 'User-Name', Value => 'myname' },
{ Name => 'Password', Value => 'mypwd' },
# RFC 2865 http://www.ietf.org/rfc/rfc2865.txt calls this attribute
# User-Password. Check your local RADIUS dictionary to find
# out which name is used on your system
# { Name => 'User-Password', Value => 'mypwd' },
{ Name => 'h323-return-code', Value => '0' }, # Cisco AV pair
{ Name => 'Digest-Attributes', Value => { Method => 'REGISTER' } }
);
$r->send_packet(ACCESS_REQUEST) and $type = $r->recv_packet();
print "server response type = $type\n";
for $a ($r->get_attributes()) {
print "attr: name=$a->{'Name'} value=$a->{'Value'}\n";
}
The "Authen::Radius" module provides a simple class that allows you to send/receive Radius requests/responses to/from a Radius server.
The default "Service" is "radius", the alternative is "radius-acct". If you do not specify port in the "Host" as a "hostname:port", then port specified in your /etc/services will be used. If there is nothing there, and you did not specify port either then default is 1812 for "radius" and 1813 for "radius-acct".
Optional parameter "Debug" with a Perl "true" value turns on debugging (verbose mode).
Optional parameter "LocalAddr" may contain local IP/host bind address from which RADIUS packets are sent.
Optional parameter "Rfc3579MessageAuth" with a Perl "true" value turns on generating of Message-Authenticator for Access-Request (RFC3579, section 3.2).
Optional parameter "NodeList" may contain a Perl reference to an array, containing a list of Radius Cluster nodes. Each nodes in the list can be specified using a hostname or IP (with an optional port number), i.e. 'radius1.mytel.com' or 'radius.myhost.com:1812'. Radius Cluster contains a set of Radius servers, at any given moment of time only one server is considered to be "active" (so requests are send to this server). How the active node is determined? Initially in addition to the "NodeList" parameter you may supply the "Host" parameter and specify which server should become the first active node. If this parameter is absent, or the current active node does not reply anymore, the process of "discovery" will be performed: a request will be sent to all nodes and the consecutive communication continues with the node, which will be the first to reply.
If the RETRANSMIT parameter is provided and contains a non-zero value, then it is considered that we are re-sending the request, which was already sent previously. In this case the previous value of packet identifier is used.
If the DETECT_BAD_ID parameter is supplied and contains a non-zero value, then calculation of the packet identifier is performed before authenticator check and EBADID error returned in case when packet identifier from the response doesn't match to the request. If the DETECT_BAD_ID is not provided or contains zero value then EBADAUTH returned in such case.
Carl Declerck <carl@miskatonic.inbe.net> - original design Alexander Kapitanenko <kapitan at portaone.com> and Andrew Zhilenko <andrew at portaone.com> - later modifications.
PortaOne Development Team <perl-radius at portaone.com> is the current module's maintainer at CPAN.