Radius(3)

NAME
Authen::Radius - provide simple Radius client facilities

SYNOPSIS
  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' }
  );
  $r->send_packet (1) 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";
  }

DESCRIPTION
The `Authen::Radius' module provides a simple class that allows you to send/receive Radius requests/responses to/from a Radius server.

CONSTRUCTOR
Creates & returns a blessed reference to a Radius object, or undef on failure. Error status may be retrieved with `Authen::Radius::get_error' (errorcode) or `Authen::Radius::strerror' (verbose error string).

METHODS
Loads the definitions in the specified Radius dictionary file (standard Livingston radiusd format). Tries to load '`/etc/raddb/dictionary'' when no argument is specified, or dies. Checks with the Radius server if the specified `PASSWORD' is valid for user `USERNAME'. This method is actually a wrapper for subsequent calls to `clear_attributes', `add_attributes', `send_packet' and `recv_packet'. It returns 1 if the `PASSWORD' is correct, or undef otherwise. Adds any number of Radius attributes to the current Radius object. Attributes are specified as a list of anon hashes. They may be `Name'd with their dictionary name (provided a dictionary has been loaded first), or with their raw Radius attribute-type values. The `Type' pair should be specified when adding attributes that are not in the dictionary (or when no dictionary was loaded). Values for `TYPE' can be '`string'', '`integer'' or '`ipaddr''. Returns a list of references to anon hashes with the following key/value pairs : { Name => NAME, Code => RAWTYPE, Value => VALUE, RawValue => RAWVALUE }. Each hash represents an attribute in the current object. The `Name' and `Value' pairs will contain values as translated by the dictionary (if one was loaded). The `Code' and `RawValue' pairs always contain the raw attribute type & value as received from the server. Clears all attributes for the current object. Packs up a Radius packet based on the current secret & attributes and sends it to the server with a Request type of `REQUEST_TYPE'. Exported `REQUEST_TYPE' methods are '`ACCESS_REQUEST'', '`ACCESS_ACCEPT'' and '`ACCESS_REJECT''. Returns the number of bytes sent, or undef on failure. Receives a Radius reply packet. Returns the Radius Reply type (see possible values for `REQUEST_TYPE' in method `send_packet') or undef on failure. Note that failure may be due to a failed recv() or a bad Radius response authenticator. Use `get_error' to find out. Returns the last `ERRORCODE' for the current object. Errorcodes are one-word strings always beginning with an '`E''. Returns a verbose error string for the last error for the current object, or for the specified `ERRORCODE'.

AUTHOR
Carl Declerck <carl@miskatonic.inbe.net>