NAME
Net::Radius::Server::Match::Simple - Simple match methods for RADIUS requests
SYNOPSIS
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;
DESCRIPTION
Net::Radius::Server::Match::Simple
implements simple but effective packet matcher method factories for use in Net::Radius::Server
rules.
See Net::Radius::Server::Match
for general usage guidelines. The relevant attributes that control the matching of RADIUS requests are:
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
.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 aNetAddr::IP
object and it is contained in the given subnet. This is very useful to perform sanity check on your RADIUS requests.
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.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
andaddr
-
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 aNetAddr::IP
object and it is contained in the given subnet.
peer_port
andport
-
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").
EXPORT
None by default.
HISTORY
$Log$
Revision 1.3 2006/12/14 15:52:25 lem
Fix CVS tags
SEE ALSO
Perl(1), NetAddr::IP(3), Net::Radius::Server(3), Net::Radius::Server::Match(3), Net::Radius::Packet(3).
AUTHOR
Luis E. Muñoz, <luismunoz@cpan.org>
COPYRIGHT AND LICENSE
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:
- Around line 364:
Non-ASCII character seen before =encoding in 'Muñoz,'. Assuming UTF-8