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. -- Chris.
Not sure how up to date it is, but a first Google hit shows: http://search.cpan.org/~ilya/Net-Radius-Client-0.02/Client.pm -----Original Message----- From: freeradius-users-bounces+adrian.p.smith=bt.com@lists.freeradius.org [mailto:freeradius-users-bounces+adrian.p.smith=bt.com@lists.freeradius.org] On Behalf Of Chris Knipe Sent: 13 May 2014 08:17 To: freeradius-users@lists.freeradius.org Subject: radclient / perl, slightly OT 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. -- Chris. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Hi, -----Original Message----- From: freeradius-users-bounces+savage=savage.za.org@lists.freeradius.org [mailto:freeradius-users-bounces+savage=savage.za.org@lists.freeradius.org] On Behalf Of adrian.p.smith@bt.com Sent: Tuesday, May 13, 2014 9:43 AM To: freeradius-users@lists.freeradius.org Subject: RE: radclient / perl, slightly OT
Not sure how up to date it is, but a first Google hit shows: http://search.cpan.org/~ilya/Net-Radius-Client-0.02/Client.pm
Yes - which is why I've specifically mentioned radclient :-) Net::Radius::Client is old, and it has amongst other things issues with loading multiple dictionaries (unless I've missed something). I came right though, got it working the way I want it... -- Chris
On 13 May 2014, at 08:16, Chris Knipe <savage@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@freeradius.org> FreeRADIUS Development Team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
On 13/05/14 08:16, Chris Knipe wrote:
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
This is a perl question, so almost completely OT ;o) See "perldoc -f close", in particular the reference to obtaining the child exit code. radclient will exit with 0 on success.
participants (4)
-
adrian.p.smith@bt.com -
Arran Cudbard-Bell -
Chris Knipe -
Phil Mayers