Hello, I`m trying
to use a PreHandlerHook to modify an Auth Request before it is processed by
Handlers. However it doesn't seem to be working and I wonder whether it's on me
the mistake.
------------------------------------------------
In radius.cfg I
Put:
<Client
localhost>
Secret xxx
PreHandlerHook file:"/etc/radiator/Hooks/hook2.pl"
Secret xxx
PreHandlerHook file:"/etc/radiator/Hooks/hook2.pl"
</Client>
------------------------------------------------
In hook2.pl I
put:
sub
{
${$_[0]}->change_attr("User-Name","new-test-value");
&main::log($main::LOG_DEBUG, "Customized Preprocessing: New Value for
Attribute User-Name ".$rq->get_attr("User-Name") );
return;
}
}
------------------------------------------------
On Trace 4 I
see.
Code:
Access-Request
Identifier: 105
Authentic: 1234567890123456
Attributes:
User-Name = "ogarzon"
Service-Type = Framed-User
NAS-IP-Address = 127.0.0.1
NAS-Port = 1234
Called-Station-Id = "123456789"
Calling-Station-Id = "987654321"
NAS-Port-Type = Async
User-Password = "8C<205><151><209><24><167><194><4><30><251>0<131><245><203>O"
Identifier: 105
Authentic: 1234567890123456
Attributes:
User-Name = "ogarzon"
Service-Type = Framed-User
NAS-IP-Address = 127.0.0.1
NAS-Port = 1234
Called-Station-Id = "123456789"
Calling-Station-Id = "987654321"
NAS-Port-Type = Async
User-Password = "8C<205><151><209><24><167><194><4><30><251>0<131><245><203>O"
Sun Aug 31 13:18:40
2003: DEBUG: Rewrote user name to ogarzon
Sun Aug 31 13:18:40 2003: DEBUG: Preprocessing: New Value for Attribute User-Name new-test-value
Sun Aug 31 13:18:40 2003: DEBUG: Preprocessing: New Value for Attribute User-Name new-test-value
Sun Aug 31 13:18:40
2003: DEBUG: Handling request with Handler ''
Sun Aug 31 13:18:40 2003: DEBUG: sqlsess Deleting session for ogarzon, 127.0.0.1, 1234
Sun Aug 31 13:18:40 2003: DEBUG: Handling with Radius::AuthSQL
Sun Aug 31 13:18:40 2003: DEBUG: Query is: SELECT ENCRYPTEDPASSWORD, CHECKATTR, REPLYATTR FROM USER WHERE USERNAME = 'ogarzon'
Sun Aug 31 13:18:40 2003: DEBUG: sqlsess Deleting session for ogarzon, 127.0.0.1, 1234
Sun Aug 31 13:18:40 2003: DEBUG: Handling with Radius::AuthSQL
Sun Aug 31 13:18:40 2003: DEBUG: Query is: SELECT ENCRYPTEDPASSWORD, CHECKATTR, REPLYATTR FROM USER WHERE USERNAME = 'ogarzon'
Sun Aug 31 13:18:40
2003: DEBUG: Radius::AuthSQL looks for match with
ogarzon
-------------------
Since the Log entry is written, I
guess it is getting inside the Hook, log also says the value was
effectively changed to ''new-test-value", but handler is still trying to
authenticate original User-Name...
I was expecting the request to arrive
modified to the Handler, but, It looks like its value is kept unmodified outside
the hook. Is it supposed to be like that? or.. What am I missing? does it have something to do with
per value/reference parameters?
Thanks in
advance.
Oscar L .
Garz�n.
