Discussion:
[rancid] Making zrancid work from cron
Tore Anderson
2010-07-30 12:45:24 UTC
Permalink
Hi list,

I've got problems making RANCID fetch the config from a Quagga box when
running from cron. It works fine when running from the command line,
but from cron I just get a "TIMEOUT reached" error in my logs. It seems
the problem is with the pseudo-terminal allocation. To demonstrate: if
I add «clogin -t 10 -c"show version;write term" rtr» to the rancid
rtr
spawn ssh -c 3des -x -l rancid rtr
Linux rtr 2.6.32-22-server x86_64
Ubuntu 10.04.1 LTS
This node is configured by puppet. Local changes may be overwritten.
Last login: Fri Jul 30 14:22:02 2010 from 2001:db8:1002:102:214:22ff:fe12:99d9
Hello, this is Quagga (version 0.99.16).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
WARNING: terminal is not fully functional
- (press RETURN)
Error: TIMEOUT reached
I tried adding «-tt» to the ssh command line in clogin, but that had no
effect. It works very well when I run it from the command line myself,
though. Any suggestions on how to solve this would be greatly appreciated!

Best regards,
--
Tore Anderson
Redpill Linpro AS - http://www.redpill-linpro.com/
Tel: +47 21 54 41 27
john heasley
2010-07-30 17:08:45 UTC
Permalink
Post by Tore Anderson
Hi list,
I've got problems making RANCID fetch the config from a Quagga box when
running from cron. It works fine when running from the command line,
but from cron I just get a "TIMEOUT reached" error in my logs. It seems
the problem is with the pseudo-terminal allocation. To demonstrate: if
I add ?clogin -t 10 -c"show version;write term" rtr? to the rancid
rtr
spawn ssh -c 3des -x -l rancid rtr
Linux rtr 2.6.32-22-server x86_64
Ubuntu 10.04.1 LTS
This node is configured by puppet. Local changes may be overwritten.
Last login: Fri Jul 30 14:22:02 2010 from 2001:db8:1002:102:214:22ff:fe12:99d9
Hello, this is Quagga (version 0.99.16).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
WARNING: terminal is not fully functional
- (press RETURN)
Error: TIMEOUT reached
I tried adding ?-tt? to the ssh command line in clogin, but that had no
effect. It works very well when I run it from the command line myself,
though. Any suggestions on how to solve this would be greatly appreciated!
is this directly to bgpd or via 'zebra' (or whatever that vtysh daemon is
called)?
Tore Anderson
2010-07-30 17:28:03 UTC
Permalink
Hi,

* john heasley
Post by john heasley
is this directly to bgpd or via 'zebra' (or whatever that vtysh
daemon is called)?
Neither, I've set up a UNIX account on the router that has
/usr/bin/vtysh as its login shell. So clogin logs in to the standard
system sshd. I believe that is the only way to get the complete
configuration, if you use telnet to bgpd/ospfd/zebra/etc you only get
the configuration for that particular routing protocol.

Best regards,
--
Tore Anderson
Redpill Linpro AS - http://www.redpill-linpro.com/
Tel: +47 21 54 41 27
john heasley
2010-07-30 20:08:31 UTC
Permalink
Post by Tore Anderson
Hi,
* john heasley
Post by john heasley
is this directly to bgpd or via 'zebra' (or whatever that vtysh
daemon is called)?
Neither, I've set up a UNIX account on the router that has
/usr/bin/vtysh as its login shell. So clogin logs in to the standard
system sshd. I believe that is the only way to get the complete
configuration, if you use telnet to bgpd/ospfd/zebra/etc you only get
the configuration for that particular routing protocol.
Best regards,
--
Tore Anderson
Redpill Linpro AS - http://www.redpill-linpro.com/
Tel: +47 21 54 41 27
Does this fix it? Does linux not have terminfo/termcap for "dumb"?

Index: zrancid.in
===================================================================
--- zrancid.in (revision 2233)
+++ zrancid.in (working copy)
@@ -65,6 +65,9 @@
my($filter_commstr); # SNMP community string filtering
my($filter_pwds); # password filtering mode

+# force a terminal type so as not to confuse the POS
+$ENV{'TERM'} = "vt100";
+
# This routine is used to print out the router configuration
sub ProcessHistory {
my($new_hist_tag,$new_command,$command_string,@string) = (@_);
Tore Anderson
2010-07-31 09:30:56 UTC
Permalink
* john heasley
Post by john heasley
Does this fix it? Does linux not have terminfo/termcap for "dumb"?
Yep, this fixes it, thanks! Should have thought of it myself...

/lib/terminfo/d/dumb does exist on the system though, but perhaps it
isn't considered sufficient for some reason? The message doesn't
originate from vtysh - I get the exact same message when doing
«TERM=dumb man ls» also, so it is a system library that complains.

Oh well, it works now, so I'm happy. Thanks again!

Best regards,
--
Tore Anderson
Redpill Linpro AS - http://www.redpill-linpro.com/
Tel: +47 21 54 41 27
Loading...