<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>exec module not seeming to run something</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">Hi all,</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">  I keep coming back with questions – hopefully I’ll be able to answer someone else’s soon!</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">I am trying to run a simple command to fire off a network backup each time an admin logs off a switch</FONT></SPAN><SPAN LANG="en-gb"><FONT FACE="Calibri"> via accounting</FONT></SPAN><SPAN LANG="en-gb"><FONT FACE="Calibri">. I</FONT></SPAN><SPAN LANG="en-gb"><FONT FACE="Calibri">’m only testing this as a concept for now.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">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</FONT></SPAN><SPAN LANG="en-gb"> <FONT FACE="Calibri">in the accounting section</FONT></SPAN><SPAN LANG="en-gb"><FONT FACE="Calibri"> of the default VS</FONT></SPAN><SPAN LANG="en-gb"><FONT FACE="Calibri">:</FONT></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">        if ((NAS-Port-Type == Virtual) && (Acct-Status-Type == Stop)) {</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">                testssh</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">        }</FONT></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">Modules/exec:</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">exec testssh {</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">        wait = no</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">        input_pairs = request</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">        program = "/etc/freeradius/testssh.sh %{User-Name} %{NAS-IP-Address}"</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">        }</FONT></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">/etc/freeradius/testssh.sh</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">#!/bin/bash</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">echo $1 $2 > /etc/freeradius/testssh.out</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">echo `date +%T` >> /etc/freeradius/testssh.out</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">sshpass -p password ssh $1@10.128.176.5 /usr/local/rancid/bin/rancid-run -r $2</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">echo $! >> /etc/freeradius/testssh.out</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">exit 0</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">The problem is it doesn’t work. I can run the script from a shell prompt and the backup functions fine</FONT></SPAN><SPAN LANG="en-gb"><FONT FACE="Calibri">, 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</FONT></SPAN><SPAN LANG="en-gb"><FONT FACE="Calibri">’t work.</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">Am I missing something obvious (again)?</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">Comments welcome on how</FONT></SPAN><SPAN LANG="en-gb"> <FONT FACE="Calibri">clever/</FONT></SPAN><SPAN LANG="en-gb"><FONT FACE="Calibri">ridiculous this idea is!</FONT></SPAN><SPAN LANG="en-gb"><FONT FACE="Calibri"></FONT></SPAN><SPAN LANG="en-gb"> <FONT FACE="Wingdings" SIZE=3>J</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">Thanks</FONT></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"><FONT FACE="Calibri">Andy</FONT></SPAN><SPAN LANG="en-gb"></SPAN></P>

<P DIR=LTR><SPAN LANG="en-gb"></SPAN></P>

</BODY>
</HTML>