(RADIATOR) Putting PostAuthHook script in background.

Ziaur Rahman zia at qalacom.com
Fri Feb 13 23:57:35 CST 2004


Thanks for the idea Matthew. I will try it out. 


+---------------------------------------------------+
| Ziaur Rahman           |       PGP Key: 0x8F30F439|
| http://www.zort.org    |        http://pgp.mit.edu|
|                        |                          |
+---------------------------------------------------+
.-.-.-.-.-.-.-.-.- Quote-o-moment .-.-.-.-.-.-.-.-.-.

If I had my life to live over again, I'd be a plumber. - Albert Einstein 

.-.-.-.-.-.-.-.-.- Quote-o-moment .-.-.-.-.-.-.-.-.-. 


-----Original Message-----
From: owner-radiator at open.com.au [mailto:owner-radiator at open.com.au] On
Behalf Of Matthew Trout
Sent: Friday, February 13, 2004 4:27 AM
To: Ziaur Rahman
Cc: 'Hugh Irvine'; radiator at open.com.au
Subject: Re: (RADIATOR) Putting PostAuthHook script in background.

On Fri, Feb 13, 2004 at 03:56:06PM -0800, Ziaur Rahman wrote:
> 
> Well, actually I wrote a perl script which updates my DynamicDNS 
> server on specific users' login and logout. So, based on the Session 
> Status I update the DNS server (remote). The script does the following
things step by step:
> 
> 1. On every call from PostAuthHook, it connects to a local mysql 
> database to see if the user is being enabled for DDNS or not.
> 2. If the user is disabled, it simply quits.
> 3. If the use is enabled, it checks the Acct-Status-Type attribute 
> supplied by radiator.
> 4. If the Acct-Status-Type is Start, it adds the Framed-IP-Address in 
> the DynamicDNS against the host registered for the user.
> 5. If the Acct-Status-Type is Stop, it removes the host record for 
> that spacific user from the DNS.
> 
> So, if for any reason, the remote DNS server cannot be reached, 
> radiator stalls. The irony is, it doesn't even resume operations once 
> the DNS server is back up. If I could even mention a timeout for the 
> PostAuthHook scripts response then it would be nice.

A quick idea - you could just have your hook do something like the following

open OUT, ">/some/dir/.temp";
print OUT $status;
close OUT;
link('/some/dir/.temp', '/some/dir/'.$user); unlink('/some/dir/.temp');

then have a little shell script that sits doing

while 1
do
  sleep 1
  for i in `ls /some/dir`
  do
    perl scriptname $i `cat /some/dir/$i` &
    rm $i
  done
done

so your perl script gets user, status in its @ARGV

put a line containing "alarm 30;" at the top of your script so it dies if it
hasn't got anywhere after 30 seconds, and you're sorted

I use a similar system to schedule open relay scans of static dial and DSL
users, although mine ignores any file less than 15 seconds old to ensure
they've had time to get properly connected before I scan them

This also has the advantage that even if one copy of the script hangs,
future requests will continue to be processed for DNS as well, but that can
never affect your radiator instance.

--
Matt S Trout
Network Programmer
Business Serve plc
===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au To unsubscribe, email
'majordomo at open.com.au' with 'unsubscribe radiator' in the body of the
message.

===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list