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

Sherrill, Justin jsherrill at currentcomm.net
Mon Nov 20 20:33:22 UTC 2006


Going by your example, it doesn't work, as the spawned process doesn't
get a target router passed to it:

(192.168.248.1 is the 'gateway' router, and 192.168.249.11 is the remote
router that can only be reached through the gateway.)

$ ./bin/clogin -c 'show vers' 192.168.249.11
router: 192.168.249.11
spawn clogin -noenable -c telnet 192.168.248.1

No routers listed error : Usage: [snip...]

As I understand it, the usercmd option that's been patched in supplies a
new connection method for whatever server's being accessed, so I tried
constructing this line:

add usercmd    192.168.249.11  {cmtslogin} {-c} {telnet 192.168.249.11}
{192.168.248.1}

Am I correct in that this should say "Connect to 192.168.248.1 and issue
'telnet 192.168.249.11', in order to connect to 192.168.249.11"?

It works in that it eventually connects to the remote device, but the
two connections seem to spawn and run in parallel - i.e. I see the
username and password for the second device getting printed out while
the first device is being logged into.

Has anyone done this in practice?  I'm wondering if I'm just
syntax-impaired.

-----------------------------------------
Justin C. Sherrill - CURRENT Communications
220 Kenneth Drive
Rochester, New York 14623
P: 585.486.0549 F: 585.486.0030

-----Original Message-----
From: Ed Ravin [mailto:eravin at panix.com] 
Sent: Sunday, November 19, 2006 12:27 AM
To: Sherrill, Justin
Cc: rancid-discuss at shrubbery.net
Subject: Re: 'out of band' access script changes?

On Fri, Nov 17, 2006 at 11:55:14AM -0500, Sherrill, Justin wrote:
> I tried applying the patch that Ed Ravin posted:
> http://www.shrubbery.net/pipermail/rancid-discuss/2006-May/001490.html
>
> And trying it as mentioned here, to reach a device on a separate
> network:
> 
>
http://www.shrubbery.net/pipermail/rancid-discuss/2006-June/001551.html
> 
> (in .clogin)
> add method      192.168.19.10   {usercmd}
> add usercmd     192.168.19.10   {clogin} {-c} {telnet 172.21.121.18}
> {192.168.19.10}
> 
> (at the command line)
> $ ./bin/clogin -c 'show version' 192.168.19.10
> 192.168.19.10
> spawn clogin -c telnet 172.21.121.18 192.168.19.10
> 192.168.19.10
> 
> Error: unknown connection method: usercmd

You didn't make any mistakes with the patches.  It's your cloginrc - you
are using the same router IP (192.168.19.10) for the first and second
hop.
clogin thinks the way to get to 192.168.19.10 is to first log into
192.168.19.10 and then telnet to 172.21.121.18, which makes no sense.
Since you're calling the unpatched clogin on the second hop, it sees the
"usercmd" stuff defined for 192.168.19.10 and aborts.

You probably wanted to say that the route to 172.21.121.18 is via
logging
into 192.168.19.10 and then issuing the telnet command, like this:

  add method   172.21.121.18  {usercmd}
  add usercmd  172.21.121.18  {clogin} {-noenable} {-c} {telnet
192.168.19.10}

  add method   192.168.19.10  {telnet}
  add password 192.168.19.10  {xxx} {yyy}

The mistake would have been obvious if you had called the patched clogin
in
the "usercmd" - it would have understood "usercmd" and started a
recursive
infinite loop of clogins.

Let me know if you run into any more trouble with the patch.

	-- Ed


***CONFIDENTIALITY NOTICE***
The information in this email may be confidential and/or privileged. This email is intended to be reviewed by only the individual or organization named above. If you are not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any review, dissemination or copying of this email and its attachments, if any, or the information contained herein is prohibited. If you have received this email in error, please immediately notify the sender by return email and delete this message from your system. 




More information about the Rancid-discuss mailing list