radclient / perl, slightly OT

Arran Cudbard-Bell a.cudbardb at freeradius.org
Tue May 13 09:44:22 CEST 2014


On 13 May 2014, at 08:16, Chris Knipe <savage at savage.za.org> wrote:

> Hi All,
> 
> I execute radclient from a perl application to send POD requests:
>          open(RADIUSCLIENT, "| /usr/bin/radclient -c 1  -r 1 " .
> $RAD_REQUEST{'NAS-IP-Address'} . ":3799 disconnect secret");
>          print RADIUSCLIENT "User-Name=" . $RAD_REQUEST{'User-Name'} .
> "\n";
>          print RADIUSCLIENT "NAS-IP-Address=" .
> $RAD_REQUEST{'NAS-IP-Address'} . "\n";
>          print RADIUSCLIENT "Framed-IP-Address=" .
> $RAD_REQUEST{'Framed-IP-Address'} . "\n";
>          print RADIUSCLIENT "Acct-Session-Id=" .
> $RAD_REQUEST{'Acct-Session-Id'} . "\n";
>          close(RADIUSCLIENT);
> 
> The above works fine, but I have no idea on how to determine whether the
> request was sent successfully, or even better, accepted by the NAS.  Can
> someone that perhaps does something similar with radclient & perl perhaps
> just give me a quick hack on how to call radclient so that it reads the
> attributes from STDIN, whilst it still allows me to parse all the output in
> perl?
> 
> Ideally for future expansion in terms of functionality, I would want to read
> the full output from radclient (incl. all attributes returned) back into my
> perl application.
> 
> I do apologize for the for the OT post.

I know for a fact that the latest 3.0.3 radclient will exit with a non-zero 
return code if it received a CoA/PoD NAK.

Previous versions may have done this too. If they don't you can pass -x to get 
more debugging info. Though the format of the debugging info change slightly in
3.0.3 too, so if you want something forwards compatible i'd just use that...

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS Development Team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 881 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140513/d355cd21/attachment.pgp>


More information about the Freeradius-Users mailing list