Discussion:
[rancid] rancid-run won't get config login, `clogin` works, `rancid -d` does get config
Chris Wopat
2011-11-13 17:16:55 UTC
Permalink
I'm attempting to add a device to RANCID that acts a as a Cisco
device, but isn't. It's a unix server that responds to the cisco
'show', 'dir' commands and has a prompt that is cisco enough to have
RANCID log in. Yes I realize that new device types can be written and
that a wrapper sample script exists from 2005 or so. It's my personal
preference to get things working this way. Info:

All of the debugging that I have indicate that it should be working,
but it simply isn't. Here's the gist of what I'm doing

* RANCID logs in as unprivileged user. 'enable' is aliased to 'su -'
* The user prompts are basic HOSTNAME>, HOSTNAME#
* The root user has aliases for 'show', 'dir', etc to spit out info
that I want (cat a few config files, ls /etc/)

The testing I've done:

I can properly log in to the device and become root (enable) using
clogin. I can then issue commands, etc. I'm simply logged in as root.

su -l rancid -c 'clogin HOSTNAME'


If I login using 'rancid -d HOSTNAME' it shows debugginfg info. The
history file of the root user on the server shows that it has issued
the appropriate commands. Additionally I can use the debugging info
found elsewhere in the thread to get a .new and .raw file. The
commands to get these debug files:

su -l rancid -c 'env NOPIPE=y
PATH=${PATH}:/usr/local/libexec/rancid rancid -d HOSTNAME'


I can view the .new and .raw files in the rancid home users's dir.
Everything looks good.

The only thing that does NOT work is:

su -l rancid -c 'rancid-run -r HOSTNAME'

The logs it creates in /usr/local/var/rancid/logs/ show:

+ date
+ echo starting: Sun Nov 13 10:34:21 CST 2011
starting: Sun Nov 13 10:34:21 CST 2011
+ echo
+ [ -f /tmp/.group.run.lock ]
+ trap rm -fr $LOCKFILE;exit 1 1 2 3 6 10 15
+ touch /tmp/.group.run.lock
+ [ 0 -eq 0 ]
+ control_rancid -r HOSTNAME group
Trying to get all of the configs.
HOSTNAME clogin error: Error: TIMEOUT reached
HOSTNAME: missed cmd(s): dir /all slavedisk2:,show rsp
chassis-info,dir /all sec-slot2:,show diag,dir /all disk1:,show gsr
chassis,dir /all sec-nvram:,show diag chassis-info,dir /all disk2:,dir
/all sec-bootflash:,show spe version,dir /all slaveslot2:,dir /all
disk0:,show install active,show bootvar,dir /all slaveslot0:,dir /all
sec-slot1:,dir /all harddiska:,dir /all slavenvram:,show flash,dir
/all sec-disk2:,dir /all slavesup-bootflash:,dir /all sec-disk0:,dir
/all harddiskb:,show variables boot,show boot,show inventory raw,dir
/all slavedisk1:,show env all,show module,show controllers,show
diagbus,more system:running-config,dir /all slavedisk0:,show
debug,show idprom backplane,dir /all bootflash:,dir /all
sec-slot0:,dir /all sec-disk1:,write term,show vtp status,dir /all
sup-bootflash:,dir /all slot2:,dir /all harddisk:,dir /all slot0:,dir
/all sup-microcode:,show vlan,dir /all slavebootflash:,show
controllers cbus,dir /all slaveslot1:,dir /all nvram:,show
version,show vlan-switch,show redundancy secondary,show
running-config,show c7200,dir /all slot1:
HOSTNAME: End of run not found
=====================================

..repeat for 4 rounds.

Debugging on the server shows that the unprivileged user did
successfully log in but root's history file doesn't indicate that any
commands were issued, unlike when 'rancid -d' was run. What am I
missing that would make this all work fine with `rancid` and `clogin`
but not `rancid-run`?
bob watson
2011-11-14 10:10:57 UTC
Permalink
Chris,

Not sure what aliases you are on, but a cron'd environment may not have the
aliases that you think you get.

Check you environment...print @ENV.

Cheers,

Bob
Post by Chris Wopat
I'm attempting to add a device to RANCID that acts a as a Cisco
device, but isn't. It's a unix server that responds to the cisco
'show', 'dir' commands and has a prompt that is cisco enough to have
RANCID log in. Yes I realize that new device types can be written and
that a wrapper sample script exists from 2005 or so. It's my personal
All of the debugging that I have indicate that it should be working,
but it simply isn't. Here's the gist of what I'm doing
* RANCID logs in as unprivileged user. 'enable' is aliased to 'su -'
* The user prompts are basic HOSTNAME>, HOSTNAME#
* The root user has aliases for 'show', 'dir', etc to spit out info
that I want (cat a few config files, ls /etc/)
I can properly log in to the device and become root (enable) using
clogin. I can then issue commands, etc. I'm simply logged in as root.
su -l rancid -c 'clogin HOSTNAME'
If I login using 'rancid -d HOSTNAME' it shows debugginfg info. The
history file of the root user on the server shows that it has issued
the appropriate commands. Additionally I can use the debugging info
found elsewhere in the thread to get a .new and .raw file. The
su -l rancid -c 'env NOPIPE=y
PATH=${PATH}:/usr/local/libexec/rancid rancid -d HOSTNAME'
I can view the .new and .raw files in the rancid home users's dir.
Everything looks good.
su -l rancid -c 'rancid-run -r HOSTNAME'
+ date
+ echo starting: Sun Nov 13 10:34:21 CST 2011
starting: Sun Nov 13 10:34:21 CST 2011
+ echo
+ [ -f /tmp/.group.run.lock ]
+ trap rm -fr $LOCKFILE;exit 1 1 2 3 6 10 15
+ touch /tmp/.group.run.lock
+ [ 0 -eq 0 ]
+ control_rancid -r HOSTNAME group
Trying to get all of the configs.
HOSTNAME clogin error: Error: TIMEOUT reached
HOSTNAME: missed cmd(s): dir /all slavedisk2:,show rsp
chassis-info,dir /all sec-slot2:,show diag,dir /all disk1:,show gsr
chassis,dir /all sec-nvram:,show diag chassis-info,dir /all disk2:,dir
/all sec-bootflash:,show spe version,dir /all slaveslot2:,dir /all
disk0:,show install active,show bootvar,dir /all slaveslot0:,dir /all
sec-slot1:,dir /all harddiska:,dir /all slavenvram:,show flash,dir
/all sec-disk2:,dir /all slavesup-bootflash:,dir /all sec-disk0:,dir
/all harddiskb:,show variables boot,show boot,show inventory raw,dir
/all slavedisk1:,show env all,show module,show controllers,show
diagbus,more system:running-config,dir /all slavedisk0:,show
debug,show idprom backplane,dir /all bootflash:,dir /all
sec-slot0:,dir /all sec-disk1:,write term,show vtp status,dir /all
sup-bootflash:,dir /all slot2:,dir /all harddisk:,dir /all slot0:,dir
/all sup-microcode:,show vlan,dir /all slavebootflash:,show
controllers cbus,dir /all slaveslot1:,dir /all nvram:,show
version,show vlan-switch,show redundancy secondary,show
HOSTNAME: End of run not found
=====================================
..repeat for 4 rounds.
Debugging on the server shows that the unprivileged user did
successfully log in but root's history file doesn't indicate that any
commands were issued, unlike when 'rancid -d' was run. What am I
missing that would make this all work fine with `rancid` and `clogin`
but not `rancid-run`?
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Chris Wopat
2011-11-14 14:00:06 UTC
Permalink
Post by bob watson
Chris,
Not sure what aliases you are on, but a cron'd environment may not have the
aliases that you think you get.
The device that RANCID is connecting to does not have anything RANCID
related in cron. RANCID logs in to it as a standard user, that user's
environment should be obeyed just like it is when a 'real' user logs
in. The RANCID server has no modifications to it at all, just a device
added to .clogin and router.db.

So to reiterate in case my original post was too long- why does
'rancid' and 'clogin' work but 'rancid-run' doesn't?

Loading...