Net::Radius::Server::Match::Simple - Simple match methods for RADIUS requests
use Net::Radius::Server::Match::Simple; my $match = Net::Radius::Server::Match::Simple->new ({ code => 'Access-Request', attr => [ 'User-Name' => qr/(?i)\@my\.domain\.?$/, 'NAS-IP-Address' => NetAddr::IP->new('127.0.0.0/24'), 'Framed-Protocol' => 'PPP', ], }); my $match_sub = $match->mk;
Net::Radius::Server::Match::Simple implements simple but effective packet matcher method factories for use in Net::Radius::Server rules.
Net::Radius::Server::Match::Simple
Net::Radius::Server
See Net::Radius::Server::Match for general usage guidelines. The relevant attributes that control the matching of RADIUS requests are:
Net::Radius::Server::Match
attr
Controls matching of a given attribute in the request packet. Must be called with a listref where even elements represent the name of a RADIUS attribute to match. The odd elements can be any of the following:
A scalar, in which case an exact match with the attribute contents must occur for this method to return NRS_MATCH_OK.
NRS_MATCH_OK
A regexp, in which case the attribute's content must match the regexp for this method to return NRS_MATCH_OK.
A NetAddr::IP subnet, in which case the attribute matches if its value can be converted to a NetAddr::IP object and it is contained in the given subnet. This is very useful to perform sanity check on your RADIUS requests.
NetAddr::IP
All the conditions specified in this way must match in order for the method to return NRS_MATCH_OK. Otherwise, NRS_MATCH_FAIL will be returned.
NRS_MATCH_FAIL
This would match if the User-Name attribute in the RADIUS request contains a (case insensitive) "@foo.domain" realm AND the NAS-IP-Address attribute contains '127.0.0.1'.
code
Matches the RADIUS packet code. The following types of attributes can be specified:
A scalar, in which case an exact match with the code must occur for this method to return NRS_MATCH_OK.
A regexp, in which case the code's name must match the regexp for this method to return NRS_MATCH_OK.
See Net::Radius::Packet(3) for more information on atribute and type representation.
peer_addr
addr
Match the address of either the peer or the local socket used to receive the request. The following specifications can be used for the match:
A scalar, in which case an exact match with the address must occur for this method to return NRS_MATCH_OK.
A regexp, in which case the address must match the regexp for this method to return NRS_MATCH_OK.
A NetAddr::IP subnet, in which case the address matches if its value can be converted to a NetAddr::IP object and it is contained in the given subnet.
peer_port
port
Match the port of either the peer or the local socket used to receive the request. The following specifications can be used for the match:
A scalar, in which case an exact match with the port must occur for this method to return NRS_MATCH_OK.
A regexp, in which case the port must match the regexp for this method to return NRS_MATCH_OK.
Note that ports are usually numeric (ie, 1812 instead of "radacct").
None by default.
$Log$ Revision 1.3 2006/12/14 15:52:25 lem Fix CVS tags
Perl(1), NetAddr::IP(3), Net::Radius::Server(3), Net::Radius::Server::Match(3), Net::Radius::Packet(3).
Luis E. Muñoz, <luismunoz@cpan.org>
Copyright (C) 2006 by Luis E. Muñoz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl 5.8.6 itself.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Muñoz,'. Assuming UTF-8
To install Net::Radius::Server, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Radius::Server
CPAN shell
perl -MCPAN -e shell install Net::Radius::Server
For more information on module installation, please visit the detailed CPAN module installation guide.