Execution of rlm code when remote server is not responding.
Hi, I have a remote PPS server where I am proxying radius requests coming from the NAS. I have a requirement like when that remote PPS goes down(which I am simulating by setting a wrong ip in proxy.conf realm configuration) then I have to perform a certain task in rlm code.But my observation is when I am setting a dummy ip for PPS, the radius server running on my machine is marking that remote server as zombie after 3 retries,now I want in this case that my rlm code to execute and handle the scenario when remote server is down.Any help will be highly appreciated.Also I may have used some naive terminology being a newbie apologizing for that. Regards, Arka
On 27/09/12 11:22, Arka Sharma wrote:
Hi,
I have a remote PPS server where I am proxying radius requests coming from the NAS. I have a requirement like when that remote PPS goes down(which I am simulating by setting a wrong ip in proxy.conf realm configuration) then I have to perform a certain task in rlm
What task? Does it have to be in "rlm" code? Because "rlm" code only runs in response to packets, not server-down events.
code.But my observation is when I am setting a dummy ip for PPS, the radius server running on my machine is marking that remote server as zombie after 3 retries,now I want in this case that my rlm code to execute and handle the scenario when remote server is down.Any help will be highly appreciated.Also I may have used some naive terminology being a newbie apologizing for that.
You've got a couple of options to respond to a down proxy. 1. In the "master" branch, there is support for "triggers" - see raddb/trigger.conf. This can execute a script when a home server goes down or up, and can obviously do anything you want 2. In all recent versions, you can use "radmin" from cron to poll home server status, and respond based on status change e.g. radmin -n eduroam -e 'show home_server list' ...you can run this in a loop It's possible you could do something in the "post-proxy" section like so: post-proxy { Post-Proxy-Type Fail { } } ...but I think this only runs for *real* requests, not the internal server probes, so you'll need to inject frequent test requests using "radclient" or similar. You also don't know *which* home server failed, so will still need to use "radmin" in a script to find this out (maybe it would be useful for this to be a control attribute added to the failing request).
On Thu, Sep 27, 2012 at 4:29 PM, Phil Mayers <p.mayers@imperial.ac.uk>wrote:
On 27/09/12 11:22, Arka Sharma wrote:
Hi,
I have a remote PPS server where I am proxying radius requests coming from the NAS. I have a requirement like when that remote PPS goes down(which I am simulating by setting a wrong ip in proxy.conf realm configuration) then I have to perform a certain task in rlm
What task? Does it have to be in "rlm" code? Because "rlm" code only runs in response to packets, not server-down events.
Thanks a lot Phil for your reply.Now actually in my rlm code I want to set a flag to mark the vent of server went down and invoke a java code using JNI that is part of rlm.
code.But my observation is when I am setting a dummy ip for PPS, the
radius server running on my machine is marking that remote server as zombie after 3 retries,now I want in this case that my rlm code to execute and handle the scenario when remote server is down.Any help will be highly appreciated.Also I may have used some naive terminology being a newbie apologizing for that.
You've got a couple of options to respond to a down proxy.
1. In the "master" branch, there is support for "triggers" - see raddb/trigger.conf. This can execute a script when a home server goes down or up, and can obviously do anything you want
Can you please elaborate.I searched the file "trigger.conf" using "find /
-name trigger.conf" but did not get anything.Do I need to create it by my own.
2. In all recent versions, you can use "radmin" from cron to poll home server status, and respond based on status change e.g.
radmin -n eduroam -e 'show home_server list'
...you can run this in a loop
In the proxy.conf I have old style realm configuration.Ip's for authorization and accounting hosts in the realm section.
It's possible you could do something in the "post-proxy" section like so:
post-proxy { Post-Proxy-Type Fail { } }
I was looking into default.original in sites-enabled for this.Can you give me some examples for this ?
...but I think this only runs for *real* requests, not the internal server probes, so you'll need to inject frequent test requests using "radclient" or similar. You also don't know *which* home server failed, so will still need to use "radmin" in a script to find this out (maybe it would be useful for this to be a control attribute added to the failing request). - List info/subscribe/unsubscribe? See http://www.freeradius.org/** list/users.html <http://www.freeradius.org/list/users.html>
Arka Sharma wrote:
Thanks a lot Phil for your reply.Now actually in my rlm code I want to set a flag to mark the vent of server went down and invoke a java code using JNI that is part of rlm.
There is no event of "server down". There is a "server failed to respond to request". As Phil said, see post-proxy-type Fail.
Can you please elaborate.I searched the file "trigger.conf" using "find / -name trigger.conf" but did not get anything.Do I need to create it by my own.
He said "In the git master branch". 1) use git, not "find" 2) check out the "master" branch.
In the proxy.conf I have old style realm configuration.Ip's for authorization and accounting hosts in the realm section.
Fix that to use the new method of configuring home servers. Then use radmin.
I was looking into default.original in sites-enabled for this.Can you give me some examples for this ?
That file contains examples. Alan DeKok.
On 27/09/12 12:32, Arka Sharma wrote:
Thanks a lot Phil for your reply.Now actually in my rlm code I want to set a flag to mark the vent of server went down and invoke a java code using JNI that is part of rlm.
Sorry, I don't understand that. Can you elaborate? It sounds like you have a custom module, written locally? Modules process packets. So you can't run module code in response to a "home server down" event (unless you emit a packet that your module responds to, I guess).
Can you please elaborate.I searched the file "trigger.conf" using "find / -name trigger.conf" but did not get anything.Do I need to create it by my own.
As I said, triggers are only available in the "master" git branch. They are not available in the releases code (2.1.x, 2.2.0). You will need to compile and install "master" to get triggers.
In the proxy.conf I have old style realm configuration.Ip's for authorization and accounting hosts in the realm section.
Sorry, I don't understand why this is relevant.
It's possible you could do something in the "post-proxy" section like so:
post-proxy { Post-Proxy-Type Fail { } }
I was looking into default.original in sites-enabled for this.Can you give me some examples for this ?
See: https://github.com/alandekok/freeradius-server/blob/v2.1.x/raddb/sites-avail... You'll still need to find out which server is down, and this is what "radmin" does. I wouldn't bother with this post-proxy stuff - just write a cron job (although maybe you could trigger the cron job from post-proxy, for fast detection).
On Thu, Sep 27, 2012 at 8:43 PM, Phil Mayers <p.mayers@imperial.ac.uk>wrote:
On 27/09/12 12:32, Arka Sharma wrote:
Thanks a lot Phil for your reply.Now actually in my rlm code I want to
set a flag to mark the vent of server went down and invoke a java code using JNI that is part of rlm.
Sorry, I don't understand that. Can you elaborate?
It sounds like you have a custom module, written locally?
Modules process packets. So you can't run module code in response to a "home server down" event (unless you emit a packet that your module responds to, I guess).
Can you please elaborate.I searched the file "trigger.conf" using "find
/ -name trigger.conf" but did not get anything.Do I need to create it by my own.
As I said, triggers are only available in the "master" git branch. They are not available in the releases code (2.1.x, 2.2.0).
You will need to compile and install "master" to get triggers.
In the proxy.conf I have old style realm configuration.Ip's for
authorization and accounting hosts in the realm section.
Sorry, I don't understand why this is relevant.
It's possible you could do something in the "post-proxy" section like so:
post-proxy { Post-Proxy-Type Fail { } }
I was looking into default.original in sites-enabled for this.Can you give me some examples for this ?
See:
https://github.com/alandekok/**freeradius-server/blob/v2.1.x/** raddb/sites-available/robust-**proxy-accounting#L104<https://github.com/alandekok/freeradius-server/blob/v2.1.x/raddb/sites-available/robust-proxy-accounting#L104>
You'll still need to find out which server is down, and this is what "radmin" does. I wouldn't bother with this post-proxy stuff - just write a cron job (although maybe you could trigger the cron job from post-proxy, for fast detection).
- List info/subscribe/unsubscribe? See http://www.freeradius.org/** list/users.html <http://www.freeradius.org/list/users.html>
Thanks a lot both Phil and Alan for your reply. Now let me put this requirement straight. I have freeradius server running on my system which takes request from NAS and send Access Request with PPAQ vsa for quota update to PPS. PPS replies back with Access-Accept with the updated quota.Now for error scenario's that PPS failed to respond,I have to handle this scenario for example writing a log or setting a flag.Now I was trying to download the master branch for triggers as you said but git is not installed in this system, I was also tried with radmin but this involves writing a cron. Now more specifically instead of server down I want to detect the scenario when PPS failed to respond as Alan suggested and I want to detect it in my rlm code. Regards, Arka
On Mon, Oct 8, 2012 at 11:41 AM, Arka Sharma <arka.sharma1988@gmail.com>wrote:
On Thu, Sep 27, 2012 at 8:43 PM, Phil Mayers <p.mayers@imperial.ac.uk>wrote:
On 27/09/12 12:32, Arka Sharma wrote:
Thanks a lot Phil for your reply.Now actually in my rlm code I want to
set a flag to mark the vent of server went down and invoke a java code using JNI that is part of rlm.
Sorry, I don't understand that. Can you elaborate?
It sounds like you have a custom module, written locally?
Modules process packets. So you can't run module code in response to a "home server down" event (unless you emit a packet that your module responds to, I guess).
Can you please elaborate.I searched the file "trigger.conf" using "find
/ -name trigger.conf" but did not get anything.Do I need to create it by my own.
As I said, triggers are only available in the "master" git branch. They are not available in the releases code (2.1.x, 2.2.0).
You will need to compile and install "master" to get triggers.
In the proxy.conf I have old style realm configuration.Ip's for
authorization and accounting hosts in the realm section.
Sorry, I don't understand why this is relevant.
It's possible you could do something in the "post-proxy" section like so:
post-proxy { Post-Proxy-Type Fail { } }
I was looking into default.original in sites-enabled for this.Can you give me some examples for this ?
See:
https://github.com/alandekok/**freeradius-server/blob/v2.1.x/** raddb/sites-available/robust-**proxy-accounting#L104<https://github.com/alandekok/freeradius-server/blob/v2.1.x/raddb/sites-available/robust-proxy-accounting#L104>
You'll still need to find out which server is down, and this is what "radmin" does. I wouldn't bother with this post-proxy stuff - just write a cron job (although maybe you could trigger the cron job from post-proxy, for fast detection).
- List info/subscribe/unsubscribe? See http://www.freeradius.org/** list/users.html <http://www.freeradius.org/list/users.html>
Thanks a lot both Phil and Alan for your reply. Now let me put this requirement straight. I have freeradius server running on my system which takes request from NAS and send Access Request with PPAQ vsa for quota update to PPS. PPS replies back with Access-Accept with the updated quota.Now for error scenario's that PPS failed to respond,I have to handle this scenario for example writing a log or setting a flag.Now I was trying to download the master branch for triggers as you said but git is not installed in this system, I was also tried with radmin but this involves writing a cron. Now more specifically instead of server down I want to detect the scenario when PPS failed to respond as Alan suggested and I want to detect it in my rlm code.
Regards, Arka
In my code after adding PPAQ vsa "rad_send()" has been called to send request to PPS. I have check that the return value of "rad_send" is NULL then fail to send the proxy request.But I want like to check whether PPS response is received or not ? Regards, Arka
Arka Sharma wrote: Please learn to edit your responses to the list.
In my code after adding PPAQ vsa "rad_send()" has been called to send request to PPS. I have check that the return value of "rad_send" is NULL then fail to send the proxy request.But I want like to check whether PPS response is received or not ?
Read raddb/sites-available/default. Look for post-proxy-type Fail. This is documented. There is no need to modify C code. Alan DeKok.
participants (3)
-
Alan DeKok -
Arka Sharma -
Phil Mayers