exec module not seeming to run something
Franks Andy (RLZ) IT Systems Engineer
Andy.Franks at sath.nhs.uk
Tue Oct 2 11:25:25 CEST 2012
Hi all,
I keep coming back with questions - hopefully I'll be able to answer
someone else's soon!
I am trying to run a simple command to fire off a network backup each
time an admin logs off a switch via accounting. I'm only testing this as
a concept for now.
I have rancid installed on another server, merrily doing backups fine. I
have a script local to the freeradius machine that fires off a backup
script job via ssh for the switch in question using the exec module in
the accounting section of the default VS:
if ((NAS-Port-Type == Virtual) && (Acct-Status-Type == Stop)) {
testssh
}
Modules/exec:
exec testssh {
wait = no
input_pairs = request
program = "/etc/freeradius/testssh.sh %{User-Name}
%{NAS-IP-Address}"
}
/etc/freeradius/testssh.sh
#!/bin/bash
echo $1 $2 > /etc/freeradius/testssh.out
echo `date +%T` >> /etc/freeradius/testssh.out
sshpass -p password ssh $1 at 10.128.176.5 /usr/local/rancid/bin/rancid-run
-r $2
echo $! >> /etc/freeradius/testssh.out
exit 0
The problem is it doesn't work. I can run the script from a shell prompt
and the backup functions fine, the variables outputting to the
testssh.out file and the ssh command running ok. Freeradius fires the
script off ok after an accounting session and the bits get written to
the testssh.out file, including the PID of the ssh process but the
command itself doesn't work.
Am I missing something obvious (again)?
Comments welcome on how clever/ridiculous this idea is! :-)
Thanks
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20121002/17499e32/attachment.html>
More information about the Freeradius-Users
mailing list