Skip to content

Commit

Permalink
Imported from rancid-2.3.2a.tar.gz.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tar Committer committed Mar 30, 2005
1 parent 654a457 commit 4d684ae
Show file tree
Hide file tree
Showing 25 changed files with 473 additions and 632 deletions.
46 changes: 46 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
2.3.2a
rancid: correct handling of SNMPv3 host configs - Patrick Adlam

rancid: filter nv_hdr file seen on sup720 - Bill Ouchark

etc/Makefile.am: support DESTDIR - from Michael Shields

rancid: add IOX/CRS support.

hrancid: show stack does not apply to all procurves - Eugene Zagrebelny

flogin: older foundry o/s has misc spaces preceeding : in username
prompt - from mike ethridge

A better nlogin & nrancid for NetScreens - help from Stephen Gill

jerancid: case fluctuates in "active/standby" - from David Gethings

jerancid: filter "please wait" from config - from David Gethings

jerancid: filter consecutive periods at top of write term - mark cooper

jerancid: fix check for slave RE sync in DirSlotN - from Mark Lovely

rancid: collect 6500's sub-module info from show modules

jrancid: collect license info & RE Model. Don't collect
the license keys as this is only supported on the jseries
and running 'show system license keys' on other junipers
produces output from *two* commands - 'show system license'
AND 'show system licensekeys'.

rancid: erroneous space in shared-secret match - from Blaz Zupan

nrancid: fix missing brace - from David King

lgform: need strftime from POSIX - from Joao Frade

rancid: filter multiple-fs file - from Yuval Ben-Ari

cssrancid: make this parse the collected output properly

rancid: filter & sort IOS AP username passwords - noted by Stafford Rau

rancid: parse more variants of 'show diag' output.

2.3.1
jerancid: fail/retry if the RP is syncing to the backup - Dave Mack

Expand Down
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## Copyright (C) 1997-2005 by Terrapin Communications, Inc.
## All rights reserved.
##
## This software may be freely copied, modified and redistributed
Expand Down
13 changes: 11 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ Quick Installation Guide (an example):
Subscribe by sending an email whose body contains "subscribe
rancid-<announce or discuss>" to majordomo@shrubbery.net.

If you are reporting problems, please include the version of rancid,
expect, and your OS in the email.


Problem with clogin/telnet hanging within rancid or scripts?

Expand All @@ -231,7 +234,13 @@ Synopsis: SunOS 5.6: /kernel/drv/ip patch
Another possibile contributor is expect/tcl. We've noticed that expect
5.24.1 (possibly 5.28.*) and whatever tcl happens to compile with it,
seems to not exhibit this problem, while 5.32.* appears to on linux and
solaris but not on netbsd 1.5. See www.shrubbery.net/rancid for additional
notes on this.
solaris but not on netbsd 1.5.

Also, for rancid 2.3 and later, changes were made to the login scripts
which use some more elaborate regexes that have failed with expect versions
prior to 5.40. While 5.40 works, it still seems to need the patch offered
on the rancid web page.

See www.shrubbery.net/rancid for additional notes on this.

-Hank
2 changes: 2 additions & 0 deletions Todo
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
- lg.conf(5) needs the query stuff documented.
- subversion support in addition to CVS
- configure OLDTIME per-group
- could the cloginrc match function do a longest-match search instead of
first match?
- look at Andreas Dahl's Brocade switch collection scripts
Expand Down
241 changes: 4 additions & 237 deletions bin/alogin.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! @EXPECT_PATH@ --
##
## $Id: alogin.in,v 1.23 2004/02/02 17:38:36 heas Exp $
#
## $Id: alogin.in,v 1.24 2004/12/24 21:00:31 tex Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
Expand All @@ -27,241 +27,8 @@
# (andrew fort)
#

# Usage line
set usage "Usage: $argv0 \[-c command\] \
\[-Evar=x\] \[-f cloginrc-file\] \
\[-s script-file\] \[-t timeout\] \[-u username\] \
\[-v vty-password\] \[-x command-file\] \
\[-y ssh_cypher_type\] router \[router...\]\n"

# env(CLOGIN) may contain:
# x == do not set xterm banner or name

# Password file
set password_file $env(HOME)/.cloginrc
# Default is to login to the router
set do_command 0
set do_script 0
# The default is to automatically enable
set avenable 1
# The default is that you login non-enabled (tacacs can have you login already
# enabled)
set avautoenable 0
# The default is to look in the password file to find the passwords. This
# tracks if we receive them on the command line.
set do_passwd 1

# Find the user in the ENV, or use the unix userid.
if {[ info exists env(CISCO_USER) ] } {
set default_user $env(CISCO_USER)
} elseif {[ info exists env(USER) ]} {
set default_user $env(USER)
} elseif {[ info exists env(LOGNAME) ]} {
set default_user $env(LOGNAME)
} else {
# This uses "id" which I think is portable. At least it has existed
# (without options) on all machines/OSes I've been on recently -
# unlike whoami or id -nu.
if [ catch {exec id} reason ] {
send_error "\nError: could not exec id: $reason\n"
exit 1
}
regexp {\(([^)]*)} "$reason" junk default_user
}

# Sometimes routers take awhile to answer (the default is 10 sec)
set timeout 45

# Process the command line
for {set i 0} {$i < $argc} {incr i} {
set arg [lindex $argv $i]

switch -glob -- $arg {
# Username
-u* -
-U* {
if {! [ regexp .\[uU\](.+) $arg ignore user]} {
incr i
set username [ lindex $argv $i ]
}
# VTY Password
} -v* -
-v* {
if {! [ regexp .\[vV\](.+) $arg ignore passwd]} {
incr i
set passwd [ lindex $argv $i ]
}
set do_passwd 0
# Enable Username
} -w* -
-W* {
# ignore -w
# Environment variable to pass to -s scripts
} -E*
{
if {[ regexp .\[E\](.+)=(.+) $arg ignore varname varvalue]} {
incr i
set E$varname $varvalue
} else {
send_user "\nError: invalid format for -E in $arg\n"
exit 1
}
# Enable Password
} -e*
{
# ignore -e
# Command to run.
} -c* -
-C* {
if {! [ regexp .\[cC\](.+) $arg ignore command]} {
incr i
set command [ lindex $argv $i ]
}
set do_command 1
# Expect script to run.
} -s* -
-S* {
if {! [ regexp .\[sS\](.+) $arg ignore sfile]} {
incr i
set sfile [ lindex $argv $i ]
}
if { ! [ file readable $sfile ] } {
send_user "\nError: Can't read $sfile\n"
exit 1
}
set do_script 1
# 'ssh -c' cypher type
} -y* -
-Y* {
if {! [ regexp .\[eE\](.+) $arg ignore cypher]} {
incr i
set cypher [ lindex $argv $i ]
}
# alternate cloginrc file
} -f* -
-F* {
if {! [ regexp .\[fF\](.+) $arg ignore password_file]} {
incr i
set password_file [ lindex $argv $i ]
}
# Timeout
} -t* -
-T* {
if {! [ regexp .\[tT\](.+) $arg ignore timeout]} {
incr i
set timeout [ lindex $argv $i ]
}
# Command file
} -x* -
-X {
if {! [ regexp .\[xX\](.+) $arg ignore cmd_file]} {
incr i
set cmd_file [ lindex $argv $i ]
}
if [ catch {set cmd_fd [open $cmd_file r]} reason ] {
send_user "\nError: $reason\n"
exit 1
}
set cmd_text [read $cmd_fd]
close $cmd_fd
set command [join [split $cmd_text \n] \;]
set do_command 1
# Do we enable?
} -noenable {
# ignore -noenable
# Does tacacs automatically enable us?
} -autoenable {
# ignore -autoenable
} -* {
send_user "\nError: Unknown argument! $arg\n"
send_user $usage
exit 1
} default {
break
}
}
}
# Process routers...no routers listed is an error.
if { $i == $argc } {
send_user "\nError: $usage"
}

# Only be quiet if we are running a script (it can log its output
# on its own)
if { $do_script } {
log_user 0
} else {
log_user 1
}

#
# Done configuration/variable setting. Now run with it...
#

# Sets Xterm title if interactive...if its an xterm and the user cares
proc label { host } {
global env
# if CLOGIN has an 'x' in it, don't set the xterm name/banner
if [info exists env(CLOGIN)] {
if {[string first "x" $env(CLOGIN)] != -1} { return }
}
# take host from ENV(TERM)
if [info exists env(TERM)] {
if [regexp \^(xterm|vs) $env(TERM) ignore ] {
send_user "\033]1;[lindex [split $host "."] 0]\a"
send_user "\033]2;$host\a"
}
}
}

# This is a helper function to make the password file easier to
# maintain. Using this the password file has the form:
# add password sl* pete cow
# add password at* steve
# add password * hanky-pie
proc add {var args} { global int_$var ; lappend int_$var $args}
proc include {args} {
global env
regsub -all "(^{|}$)" $args {} args
if { [ regexp "^/" $args ignore ] == 0 } {
set args $env(HOME)/$args
}
source_password_file $args
}

proc find {var router} {
upvar int_$var list
if { [info exists list] } {
foreach line $list {
if { [string match [lindex $line 0] $router ] } {
return [lrange $line 1 end]
}
}
}
return {}
}

# Loads the password file. Note that as this file is tcl, and that
# it is sourced, the user better know what to put in there, as it
# could install more than just password info... I will assume however,
# that a "bad guy" could just as easy put such code in the clogin
# script, so I will leave .cloginrc as just an extention of that script
proc source_password_file { password_file } {
global env
if { ! [file exists $password_file] } {
send_user "\nError: password file ($password_file) does not exist\n"
exit 1
}
file stat $password_file fileinfo
if { [expr ($fileinfo(mode) & 007)] != 0000 } {
send_user "\nError: $password_file must not be world readable/writable\n"
exit 1
}
if [ catch {source $password_file} reason ] {
send_user "\nError: $reason\n"
exit 1
}
}
# alogin: doesn't understand enable. It will just ignore the enable options.
@INCLUDE login.top@

# Log into the router.
proc login { router user userpswd passwd prompt cmethod cyphertype } {
Expand Down
8 changes: 5 additions & 3 deletions bin/cat5rancid.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! @PERLV_PATH@
##
## $Id: cat5rancid.in,v 1.36 2004/01/11 03:49:13 heas Exp $
## $Id: cat5rancid.in,v 1.37 2005/03/20 22:15:35 heas Exp $
##
## Copyright (C) 1997-2004 by Terrapin Communications, Inc.
## All rights reserved.
Expand Down Expand Up @@ -1003,7 +1003,8 @@ sub DoNothing {print STDOUT;}
'show module' => "ShowModule",
'show port ifindex' => "ShowPortIfindex",
'write term all' => "WriteTerm",
'write term' => "WriteTerm"
'write term' => "WriteTerm",
'show running-config' => "WriteTerm"
);
# keys() doesnt return things in the order entered and the order of the
# cmds is important (show version first and write term last). pita
Expand All @@ -1019,7 +1020,8 @@ sub DoNothing {print STDOUT;}
"show module",
"show port ifindex",
"write term all",
"write term"
"write term",
"show running-config"
);
$cisco_cmds=join(";",@commands);
$cmds_regexp=join("|",@commands);
Expand Down
Loading

0 comments on commit 4d684ae

Please sign in to comment.