radiusd
sees an <AuthBy XYZ>
clause while parsing a Realm or Handler, it will load the file
Radius/AuthXYZ.pm
with a Perl require.
AuthXYZ.pm
is expected to be a Perl package that
implements the class Radius::AuthXYZ. Realm.pm
will
then instantiate a new Radius::AuthXYZ
by calling the
constructor with Radius::AuthXYZ->new($file)
. The
constructor is expected to create an instance of Radius::AuthXYZ that can
handle all the requests for that type of authentication.$file
, which is
the configuration file being currently read. The constructor is expected
to configure its instance from lines read from the configuration file up
until it sees a </AuthBy> line. This is made very easy by the
Radius::Configurable
class, which your AuthBy module
should inherit from.Radius::AuthXY
Z
constructor fails, it is expected to return
undef
.Handler.pm
module will call
($result, $reason) = Radius::AuthXYZ->handle_request($p,
$rp)
, where $p
is a reference to the
Radius::Radius
packet received from the client, and
$rp
is an empty reply packet, ready for you to fill.
Client.pm
and Handler.pm
will
filter out duplicate requests, requests from unknown clients and requests
with bad authenticators, so your handle_request
will
only be called for new, good requests from known clients. The contents of
the request will have been unpacked into the
Radius::Radius
instance passed in as
$p
, so you can immediately start examining attributes
and doing things.handle_request
returns an
array. The first element is a result
code, and the
second is an optional reason
message.handle_request
will indicate whether
Handler.pm
should automatically send the reply to the
original requester:handle_request
returns
$main::ACCEPT
, Handler.pm
will send back $rp
as an accept message
appropriate to the type of request received (i.e. it will turn
$rp
into an Access-Accept if the original request
was an Access-Request). In the case of Accounting-Request, this is the
only result code that will cause a reply to be sent back.handle_request
returns
$main::REJECT
, Handler.pm
will send back $rp
as a reject message
appropriate to the type of request received (i.e. it will turn
$rp
into an Access-Reject if the original request
was an Access-Request). In this case the reason message should be
supplied.handle_request
returns
$main::CHALLENGE
, Handler.pm
will send back $rp
as a Access-Challenge
message.handle_request
returns
$main::IGNORE
, Handler.pm
will not send any reply back to the originating client. You should
only use this if the request is to be completely ignored, or if your
module undertakes to send its own reply some time in the future. If
the Handler or Realm has more than one AuthBy handler module
specified, it will continue calling handlers in the order in which
they were specified until one returns something other than
$main::IGNORE
. You can change this behaviour with
AuthByPolicy, for more information, see Section 3.31.12. AuthByPolicy.handle_request
function may want to
use utility functions in Radius::Radius
(see
Radius.pm
) to examine attributes in the incoming
request, and to construct replies. There are some convenience routines in
Client.pm
for packing and sending replies to the
original requester, such as$p->{Client}->replyTo($rp, $p);
$main::IGNORE
from
handle_request
.findUser()
method, which is expected to find and
return a User object given a user name. The
AuthGeneric::handle_request
handles all the cascading
of DEFAULT users, checking of check items, assembling replies etc. All you
have to do is find the user in your database and return it in
findUser()
.Realm.pm
does,
such as logging to the accounting log file or wtmp file), you will
probably want to override handle_request
, pass
Access-Request messages to
$self->SUPER::handle_request()
, and process
Accounting- Request messages yourself.AuthGeneric::handlerFork
, which will arrange for the
handler to fork(2)
, and also arrange for the child to
exit after handling is complete.log($p, $s)
Logs a message that originated in
that class. $p
is a message priority (see
Log.pm
). $s
is a message.
The base class behaviour is to log to the all the logging systems
configured into Radiator by calling main::log($p,
$s)
.keyword
function so it parses
the parameters that your new module needs.Radius::Realm->object
).handle_request
function. You
may wish to handle Access-Requests and Accounting-Requests
differently.<Realm xxxxxx> RealmParameter1 .... <AuthBy XYZ> AuthByParameter1 .... ..... </AuthBy> </Realm>
radpwtst
utility.make
install
.new
Create a new instance by calling
$class->SUPER::new($file);
keyword
Recognise any class specific
parameter keywords from the configuration file and remember them.findUser
Construct and return a User object
if the named user can be found in your database.