[rancid] Re: 'out of band' access script changes?

Ed Ravin eravin at panix.com
Wed Nov 22 06:09:13 UTC 2006

On Tue, Nov 21, 2006 at 10:59:44AM -0500, Sherrill, Justin wrote:
> Looking at the debug output, the command never enters the login
> information at the right time. [...]

OK, you convinced me to climb out of the ivory tower and get my hands
dirty. It looks like the second clogin isn't passing through the output
of the gateway router back to the first clogin in a timely manner.
Here's a fix using the "interact" command of Expect (which explicitly
enables a "pass-through" mode to the user) and clogin's handy-dandy
scripting features:

First, create a file called "far-router.exp", containing
these two lines:

   send "telnet far-router\r"

Then, add entries like these to your cloginrc:

  add method gateway-router telnet
  add user gateway-router rancid
  add password gateway-router {mumble}

  add method far-router {usercmd}
  add usercmd far-router {clogin} {-noenable} {-s} {far-router.exp} {gateway-router}
  add user far-router rancid
  add password far-router {mumble} {grumble}
  add usercmd_chat far-router {Trying.*Open} {} {User Access Verification} {}
It worked for me even without the "usercmd_chat" in cloginrc, but it won't
hurt since it'll always make sure you're logging in to the second router.

Note that clogin will not exit right away after running your commands.
It will sit on the gateway router's prompt for 30 seconds or so and then
time out.  That's normal for the usercmd stuff, since I didn't add any
mechanism for closing the "gateway" session after the far-end router
is disconnected.  This hasn't been a problem for my use of it - clogin
runs out of a batch script, and I don't really care if the script takes
an extra 30 seconds to exit.  But I suppose I could add something like
"usercmd_exit_chat" to handle it if needed.

   -- Ed

More information about the Rancid-discuss mailing list