Net::Radius::Client - Pure-Perl, VSA-empowered RADIUS client
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"; }
The Net::Radius::Client package implements a single call, high-level RADIUS client.
The query routine tries to deliver request to RADIUS server(s) and returns its response whenever successful.
query
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.
load
Ilya Etingof, <ilya@glas.net> Alexey Michurin, <alexey@michurin.com.ru>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Net::Radius::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Radius::Client
CPAN shell
perl -MCPAN -e shell install Net::Radius::Client
For more information on module installation, please visit the detailed CPAN module installation guide.