The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Radius::Client - Pure-Perl, VSA-empowered RADIUS client

SYNOPSIS

  use Net::Radius::Client;

  load("dictionary");

  # $Net::Radius::Client::debug = 1;

  my $servers = {
      '192.168.1.1' => { 
          1812 => { 
              'secret' => 'perl4sins', 
              'timeout' => 1, 
              'retries' => 3 
              }
      },
      '192.168.1.2' => { 
          1812 => { 
              'secret' => 'perl4sins', 
              'timeout' => 1, 
              'retries' => 3 
              }
      }
  };

  my $req = { 
      0 => {
          'User-Name' => ['anus'],
          'User-Password' => ['vulgaris'] 
          },
      9 => {
          'cisco-avpair' => ['some cisco stuff']
          } 
  };
                   
  my ($code, $respref) = query($servers, "Access-Request", $req);

  if ($code) {
      print $code . "\n";
      foreach my $vendor (keys %$respref) {
          foreach my $attr (keys %{$respref->{$vendor}}) {
              foreach my $val (@{$respref->{$vendor}->{$attr}}) {
                  print $attr . ' = ' . $val . "\n";
              }
          }
      }
  } else {
      print "Probably timed out\n";
  }
             

ABSTRACT

The Net::Radius::Client package implements a single call, high-level RADIUS client.

DESCRIPTION

The query routine tries to deliver request to RADIUS server(s) and returns its response whenever successful.

RADIUS servers to query are represented as a hash carrying network-scope details. See SYNOPSIS for more information.

RADIUS attribute-value pairs for both request and response take shape of a two-dimentional hash-ref first indexed by attribute vendor ID (0 for IETF) and then by attribute name (as configured in the "dictionary"). Since RADIUS protocol allows for multiple attributes of the same type in packet, value(s) of each attribute are kept in a list. See SYNOPSIS for guidance.

The load routine loads up RADIUS dictionary file, as specified by its first parameter, and should be called once on startup.

EXPORT

load
query

SEE ALSO

Net::Radius::Packet
Net::Radius::Dictionary
http://www.freeradius.org/rfc/

AUTHOR

Ilya Etingof, <ilya@glas.net> Alexey Michurin, <alexey@michurin.com.ru>

COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.