From b88919bea4b222a616adbdd2b82fc262a14afc8d Mon Sep 17 00:00:00 2001 From: Tar Committer Date: Mon, 5 Feb 2001 17:47:18 +0000 Subject: Imported from rancid-2.1.tar.gz. --- CHANGES | 50 +++++ Makefile.am | 4 +- Makefile.in | 21 +- README | 112 ++++++---- Todo | 25 +-- bin/Makefile.in | 6 +- bin/cat5rancid.in | 24 ++- bin/clogin.in | 53 +++-- bin/configure | 12 ++ bin/configure.in | 9 + bin/control_rancid.in | 64 +++--- bin/do-diffs.in | 21 +- bin/elogin.in | 50 +++-- bin/env.in | 2 +- bin/erancid.in | 6 +- bin/flogin.in | 66 +++--- bin/francid.in | 30 ++- bin/jlogin.in | 32 +-- bin/jrancid.in | 6 +- bin/rancid.in | 54 ++++- bin/rrancid.in | 15 +- cloginrc.sample | 11 +- configure | 581 +++++++++++++++++++++++--------------------------- configure.in | 85 ++++++-- man/Makefile.am | 18 ++ man/Makefile.in | 295 +++++++++++++++++++++++++ man/cat5rancid.1 | 1 + man/clogin.1 | 193 +++++++++++++++++ man/cloginrc.5 | 231 ++++++++++++++++++++ man/control_rancid.1 | 26 +++ man/create_cvs.1 | 53 +++++ man/do-diffs.1 | 95 +++++++++ man/elogin.1 | 1 + man/env.5.in | 154 +++++++++++++ man/erancid.1 | 1 + man/flogin.1 | 1 + man/francid.1 | 1 + man/jlogin.1 | 1 + man/jrancid.1 | 1 + man/lg.conf.5.in | 129 +++++++++++ man/lg_intro.1.in | 64 ++++++ man/rancid.1 | 55 +++++ man/rancid_intro.1 | 113 ++++++++++ man/router.db.5 | 106 +++++++++ util/Makefile.in | 6 +- util/lg/README | 12 +- util/lg/lg.cgi.in | 2 +- util/lg/lgnotes.html | 12 +- 48 files changed, 2353 insertions(+), 557 deletions(-) create mode 100644 man/Makefile.am create mode 100644 man/Makefile.in create mode 100644 man/cat5rancid.1 create mode 100644 man/clogin.1 create mode 100644 man/cloginrc.5 create mode 100644 man/control_rancid.1 create mode 100644 man/create_cvs.1 create mode 100644 man/do-diffs.1 create mode 100644 man/elogin.1 create mode 100644 man/env.5.in create mode 100644 man/erancid.1 create mode 100644 man/flogin.1 create mode 100644 man/francid.1 create mode 100644 man/jlogin.1 create mode 100644 man/jrancid.1 create mode 100644 man/lg.conf.5.in create mode 100644 man/lg_intro.1.in create mode 100644 man/rancid.1 create mode 100644 man/rancid_intro.1 create mode 100644 man/router.db.5 diff --git a/CHANGES b/CHANGES index f3838f5..172891d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,51 @@ +2.1 + Change default umask to 027 (it was 007) mainly as an + attempt to stop people from changing stuff in rancid's CVS + store. Only rancid should be updating its CVS store. + + control_rancid cvs updates router.db before starting a + group's collection. + + configure now has a --enable-mail-plus option to have rancid + send mail to rancid+$GROUP instead of to rancd-$GROUP. + Patch from davidw@certaintysolutions.com. + + configure should figure out diff options on it's own. + + try to get default user from env() and catch exec on id in *login + + make clean/distclean was missing some files + + make sure do-diffs cleans up after itself if it exits prematurely + + ignore case when cvs delete'g removed routers + + francid/rrancid (foundry/redback) now strip snmp communities like + the others, via NOCOMMSTR var in bin/env. + + add man pages + + collect 'sh vlan' on cat 6000 - afort@staff.webcentral.com.au + + Add 'show vtp status' for the 3500XLs as well. + + Escape regex meta-chars found in device prompts in *rancid + + Add "include" directive to include other pwd files via .cloginrc + + Add "show port ifindex" for the cat5s. + + Try to detect flash being busy on a cat5. + + Tag each config file with its 'type'. E.g.: + !RANCID-CONTENT-TYPE: cisco + + fix from afort@staff.webcentral.com.au to lg.cgi to allow prefix-list + with numerals. + + fix lg form's formatting (on some browsers/conditions). Thanks to + rrashid@verio.net for the html help. + 2.1b add looking glass utility based on Ed Kern's original source. Thanks to Ed for permission to include it with rancid. this is only partially @@ -5,6 +53,8 @@ fixed expect foo in *login when .cloginrc is unreadable. + Don't sort 'ip name-server' - order matters. + 2.0 Better formatting for cisco catalyst [non-ios] switches. diff --git a/Makefile.am b/Makefile.am index d75decf..4fa1628 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,12 +10,12 @@ EXTRA_DIST = CHANGES README Todo cloginrc.sample configure install-sh \ # '.' is here (and at the beginnging of the macro) so that distclean-recursive # will run make distclean in . after the other dirs (preserving Makefile.inc) -SUBDIRS = . bin util +SUBDIRS = . bin man util all: install-exec-local: - $(mkinstalldirs) $(prefix) $(prefix)/bin $(prefix)/util $(prefix)/util/lg + $(mkinstalldirs) $(prefix) $(prefix)/bin $(prefix)/man $(prefix)/util $(prefix)/util/lg install: for file in CHANGES README cloginrc.sample ; do \ diff --git a/Makefile.in b/Makefile.in index c79ec4f..0030e35 100644 --- a/Makefile.in +++ b/Makefile.in @@ -61,25 +61,34 @@ AUTOMAKE = @AUTOMAKE@ COMM = @COMM@ CVS = @CVS@ DIFF = @DIFF@ +DIFF_CMD = @DIFF_CMD@ DIRNAME = @DIRNAME@ ENV_PATH = @ENV_PATH@ EXPECT_PATH = @EXPECT_PATH@ +FIND = @FIND@ +GREP = @GREP@ +ID = @ID@ INST_PROGS = @INST_PROGS@ LG_PING_CMD = @LG_PING_CMD@ +MAILPLUS = @MAILPLUS@ MAINT = @MAINT@ MAKE = @MAKE@ MAKEINFO = @MAKEINFO@ MKDIR = @MKDIR@ PACKAGE = @PACKAGE@ +PERLV = @PERLV@ PERLV_PATH = @PERLV_PATH@ PING_PATH = @PING_PATH@ RD_BIN_DATAS = @RD_BIN_DATAS@ RD_BIN_PROGS = @RD_BIN_PROGS@ RD_UTIL_LG_PROGS = @RD_UTIL_LG_PROGS@ RD_UTIL_PROGS = @RD_UTIL_PROGS@ +RSH = @RSH@ SENDMAIL = @SENDMAIL@ SORT = @SORT@ +SSH = @SSH@ TAR = @TAR@ +TELNET = @TELNET@ TOUCH = @TOUCH@ UCBMAIL = @UCBMAIL@ VERSION = @VERSION@ @@ -92,7 +101,7 @@ EXTRA_DIST = CHANGES README Todo cloginrc.sample configure install-sh mkinstall # '.' is here (and at the beginnging of the macro) so that distclean-recursive # will run make distclean in . after the other dirs (preserving Makefile.inc) -SUBDIRS = . bin util +SUBDIRS = . bin man util ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = @@ -177,14 +186,6 @@ tags-recursive: tags: TAGS -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ @@ -344,7 +345,7 @@ mostlyclean distclean maintainer-clean all: install-exec-local: - $(mkinstalldirs) $(prefix) $(prefix)/bin $(prefix)/util $(prefix)/util/lg + $(mkinstalldirs) $(prefix) $(prefix)/bin $(prefix)/man $(prefix)/util $(prefix)/util/lg install: for file in CHANGES README cloginrc.sample ; do \ diff --git a/README b/README index fd1ac82..9a663e2 100644 --- a/README +++ b/README @@ -4,51 +4,56 @@ maintain CVS controlled copies of router configs. The following is the packing list for Rancid. .in is stripped from the files below by configure with substitutions completed: -README - This file. -CHANGES - List of changes to Rancid. -Todo - partial Todo list of what needs to be done. -env.in - Enviromental settings needed. -do-diffs.in - Script designed to be run from cron calling control_rancid. -control_rancid.in - Builds router list, calls rancid on each router and - handles cvs routines. -rancid-fe.in - chooses between rancid/[efjr]rancid/cat5rancid. -rancid.in - Runs commands on cisco routers and processes the output - the meat. -erancid.in - Runs commands on ADC EZ-T3 muxes and processes the output. -francid.in - Runs commands on foundry switches and processes the output. -jrancid.in - Runs commands on juniper routers and processes the output. -rrancid.in - Runs commands on redback routers and processes the output. -cat5rancid.in -Runs commands on cisco cat5 switches and processes the output. -clogin.in - Expect script that logs into routers either interactively, - runs a set of commands, or runs another expect script. -elogin.in - Expect script that logs into ADC EZ-T3 muxes either interactively, - runs a set of commands, or runs another expect script. -flogin.in - Expect script that logs into foundry switches. Once foundry - cleans up their bloody UI, clogin should do the job. -jlogin.in - Expect script that logs into juniper routers similarly to - clogin. It is not terribly robust, but mainly used for it's - -c and -s options. -.cloginrc - TCL commands to set passwords, usernames etc. used by clogin and - jlogin. -par.in - Parallel processing of commands - any commands. -rename.in - Perl script to rename files. -create_cvs.in - Creates all of the CVS and config directories. -util/ - utilities / contribs +README This file. +CHANGES List of changes to Rancid. +Todo partial Todo list of what needs to be done. +env.in Environment settings needed. +do-diffs.in Script designed to be run from cron calling control_rancid. +control_rancid.in + Builds router list, calls rancid on each router and + handles cvs routines. +rancid-fe.in chooses between rancid/[efjr]rancid/cat5rancid. +rancid.in Runs commands on cisco routers and processes the output. +erancid.in Runs commands on ADC EZ-T3 muxes and processes the output. +francid.in Runs commands on foundry switches and processes the output. +jrancid.in Runs commands on juniper routers and processes the output. +rrancid.in Runs commands on redback routers and processes the output. +cat5rancid.in Runs commands on cisco cat5 switches and processes the output. +clogin.in Expect script that logs into routers either interactively, + runs a set of commands, or runs another expect script. +elogin.in Expect script that logs into ADC EZ-T3 muxes either + interactively, runs a set of commands, or runs another expect + script. +flogin.in Expect script that logs into foundry switches. Once foundry + cleans up their bloody UI, clogin should do the job. +jlogin.in Expect script that logs into juniper routers similarly to + clogin. It is not terribly robust, but mainly used for it's + -c and -s options. +.cloginrc TCL commands to set passwords, usernames etc. used by clogin + and jlogin. +par.in Parallel processing of commands - any commands. +rename.in Perl script to rename files. +create_cvs.in Creates all of the CVS and config directories. +man/ man pages +util/ utilities / contribs +util/lg looking glass The following are included as part of the installation tools: -Makefile.in - processed by configure to produce Makefiles -configure - gnu autoconf script -install-sh - shell script to simulate BSD style install -mkinstalldirs - shell script to make installation directories +Makefile.in processed by configure to produce Makefiles +configure GNU autoconf script +install-sh shell script to simulate BSD style install +mkinstalldirs shell script to make installation directories rancid will also need to have the following packages: -cvs - code revision system available from prep.ai.mit.edu:/pub/gnu -gnudiff - gnudiff provides the -u option. if you do not have gnudiff, - you will have to modify control_rancid to use 'diff -c' or some - such. see examples. -perl5 - perl version 5 or greater available from www.cpan.org -expect - http://expect.nist.gov/ -tcl - required by expect. +cvs code revision system available from prep.ai.mit.edu:/pub/gnu +gnudiff gnudiff provides the uni-diff (-u) option. if you do not have + gnudiff, configure will use 'diff -c' or 'diff -C'. +perl5 perl version 5 or greater available from www.cpan.org +expect http://expect.nist.gov/ we highly suggest that you stick to + expect 5.24.1 (or so). this seems to work best. note that + you have to have the accompanying tcl &/ tk. +tcl required by expect. Bill Fenner has a cgi script for interacting with CVS repositories via a web interface. This provides a great way to view rancid diffs and @@ -57,12 +62,17 @@ not included, but can be found here: http://www.freebsd.org/~fenner/cvsweb/cvsweb-1.0.tar.gz + Quick Installation Guide (an example): 1) ./configure [--prefix=] By default, All rancid crud will be installed under /usr/local/rancid. This can be overridden with the --prefix option. E.g.: + ./configure --prefix=/home/rancid + + see ./configure --help for other configure options. + The user who will run rancid must have write permission in this directory. @@ -82,10 +92,10 @@ Quick Installation Guide (an example): is the default on a juniper). 6) Modify /etc/aliases - Rancid sends the diffs and other controlling emails to rancid- + Rancid sends the diffs and other administrative emails to rancid- and problems to rancid-admin-, where is the "GROUP" of - routers. This way you can seperate your backbone routers from your - access routers or seperate based upon network etc... Different router + routers. This way you can separate your backbone routers from your + access routers or separate based upon network etc... Different router uses forced different people being interested in router "groups" - thus this setup. Make sure email to rancid- works. /etc/aliases can be maintainable by Majordomo stuff. @@ -98,6 +108,10 @@ Quick Installation Guide (an example): The Precedence header set to bulk or junk *hopefully* avoids replies from auto-responders and vacation type mail filters. + The --enable-mail-plus option to configure will set each of the "rancid-" + addresses mentioned above to "rancid+". See sendmail's operation manual + for more information on handling of '+'. + 7) Run create_cvs. This creates all of the CVS necessary directories and all of the config directories. @@ -126,7 +140,17 @@ Quick Installation Guide (an example): # clean out config differ logs 50 23 * * * /usr/bin/find /logs -mtime +2 -exec rm {} \; -10) Send any bugs, suggestions or updates to rancid@shrubbery.net. +10) Note: If you are using any of these programs (other than + do-diffs) out of cron, make sure that you set your $PATH + correctly so that they work. E.g.: if you are using clogin, + it can call id, telnet, ssh, and/or rsh. + + configure already makes sure that $PATH is set correctly in + bin/env for do-diffs, so you could use the $PATH from there. eg: + + 50 23 * * * . /usr/local/rancid/bin/env; clogin -c 'sh vers' router + +11) Send any bugs, suggestions or updates to rancid@shrubbery.net. See the web page at http://www.shrubbery.net/rancid. We have created the standard mailing lists for those interested; rancid-announce@shrubbery.net and rancid-discuss@shrubbery.net. diff --git a/Todo b/Todo index 5f194d8..c608d37 100644 --- a/Todo +++ b/Todo @@ -1,27 +1,16 @@ +- a format such as {} as the pwd in .cloginrc to indicate *login should + prompt the user for the password - better error loggin in the looking glass -- why do 'make distclean' & 'make dist' fail on fbsd 3.3? - handle foundry and reback in the looking glass - implement the bits marked unimplemented in lg.conf -- need to strip community strings from foundry, redback - detect 'same' vty configs - ignoring length/width/passwd is a start, but need more - merge clogin and jlogin into one. possible? - rancid needs to treat the 3600s like the 7Ks and 12Ks... -- Also, need to allow 12012s, and force 700s to not be treated like 7Ks. + Also, need to allow 12012s, and force 700s to not be treated like 7Ks. - flogin (for foundry) needs more testing and should be integrated with clogin when foundry fixes their UI. -- check clogin. does it handle multiple addrs for 1 fqdn correctly? - > guelah [444] clogin gw6.partan.com - > gw6.partan.com - > spawn telnet gw6.partan.com - > Trying 198.6.255.57... - > telnet: connect to address 198.6.255.57: Host is unreachable - > telnet: connect to address 198.6.255.61: Host is unreachable - > telnet: connect to address 198.6.255.65: Host is unreachable - > Connected to gw6.partan.com (198.6.255.194). - > Escape character is '^]'. - > - > - > User Access Verification - > - > Username: ^Cguelah [445] +- include a few -s and -x type example *login scripts. +- add -E to *login to pass through variables to scripts + clogin -Evariable=something router... + clogin -Evariable=a,b,c [ie: an array/list which user splits] diff --git a/bin/Makefile.in b/bin/Makefile.in index 8a97def..04b2545 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -13,10 +13,12 @@ install: all $(INSTALL) $$prog $(PREFIX)/bin; \ done; \ if test -f $(PREFIX)/bin/env ; then \ - echo "WARNING: *** $(PREFIX)/bin/env exists: not installing."; \ + echo "WARNING: *** $(PREFIX)/bin/env exists: installing as env.new."; \ + echo " *** review env.new for new/deprecated switches"; \ + $(INSTALL_DATA) env $(PREFIX)/bin/env.new; \ else \ $(INSTALL_DATA) env $(PREFIX)/bin; \ - fi + fi # BIN_DATAS are empty at the moment. # for prog in $(BIN_DATAS) ; do \ # $(INSTALL_DATA) $$prog $(PREFIX)/bin; \ diff --git a/bin/cat5rancid.in b/bin/cat5rancid.in index 8eb529b..cf0583d 100755 --- a/bin/cat5rancid.in +++ b/bin/cat5rancid.in @@ -354,6 +354,7 @@ sub ShowFlash { return(1) if ($type =~ /^(120|7)/); return(1) if /^\s*\^\s*$/; return(1) if /Invalid input detected/; + return(-1) if /session in progress. Try again later/; # Flash is busy ProcessHistory("FLASH","","","!Flash: $_"); } ProcessHistory("","","","!\n"); @@ -798,6 +799,23 @@ sub ShowC7200 { return(0); } +# This routine processes a "show port ifindex" +sub ShowPortIfindex { + print STDERR " In ShowPortIfindex: $_" if ($debug); + + ProcessHistory("","","","!\n"); + while () { + tr/\015//d; + last if(/^$prompt/); + next if (/^(\s*|\s*$cmd\s*)$/); + return(1) if /^\s*\^\s*$/; + return(1) if /Invalid input detected/; + return(1) if /Unknown command/; + return(1) if /Usage: /; + ProcessHistory("","","","! $_"); + } +} + # This routine processes a "write term" sub WriteTerm { print STDERR " In WriteTerm: $_" if ($debug); @@ -908,9 +926,6 @@ sub WriteTerm { # order logging statements /^set logging server (\d+\.\d+\.\d+\.\d+)/ && ProcessHistory("LOGGING","ipsort","$1","$_") && next; - # order name-server statements - /^set ip dns server (\d+\.\d+\.\d+\.\d+)/ && - ProcessHistory("NAMESERVER","ipsort","$1","$_") && next; # order/prune snmp-server host statements # we only prune lines of the form # snmp-server host a.b.c.d @@ -983,6 +998,7 @@ sub DoNothing {print STDOUT;} 'dir slot0:' => "DirSlotN", 'dir slot1:' => "DirSlotN", 'show module' => "ShowModule", + 'show port ifindex' => "ShowPortIfindex", 'write term' => "WriteTerm" ); # keys() doesnt return things in the order entered and the order of the @@ -995,6 +1011,7 @@ sub DoNothing {print STDOUT;} "dir slot0:", "dir slot1:", "show module", + "show port ifindex", "write term" ); $cisco_cmds=join(";",@commands); @@ -1020,6 +1037,7 @@ if ($file) { } } +ProcessHistory("","","","!RANCID-CONTENT-TYPE: cat5\n!\n"); ProcessHistory("COMMENTS","keysort","B0","!\n"); ProcessHistory("COMMENTS","keysort","F0","!\n"); ProcessHistory("COMMENTS","keysort","G0","!\n"); diff --git a/bin/clogin.in b/bin/clogin.in index e239d50..40d0d57 100755 --- a/bin/clogin.in +++ b/bin/clogin.in @@ -53,11 +53,17 @@ set do_enapasswd 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) } 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. - regexp {\(([^)]*)} [exec id] junk default_user + if [ catch {exec id} reason ] { + send_error "Error: could not exec id: $reason\n" + exit 1 + } + regexp {\(([^)]*)} "$reason" junk default_user } # Sometimes routers take awhile to answer (the default is 10 sec) @@ -213,36 +219,39 @@ proc label { host } { # add password sl* pete cow # add password at* steve # add password * hanky-pie -proc add {var args} { global $var ;lappend $var $args} +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} { - source_password_file - upvar $var list - if { [info exists list] } { - foreach line $list { - if { [string match [lindex $line 0] $router ] } { - return [lrange $line 1 end] - } - } - } - return {} -} + 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 { } { - global env password_file read_password_file - if { [info exists read_password_file] } { return } - if { [info exists password_file] == 0 } { - set password_file $env(HOME)/.cloginrc - } +proc source_password_file { password_file } { + global env if { ! [file exists $password_file] } { send_user "Error: password file ($password_file) does not exist\n" exit 1 } - set read_password_file 1 file stat $password_file fileinfo if { [expr ($fileinfo(mode) & 007)] != 0000 } { send_user "Error: $password_file must not be world readable/writable\n" @@ -458,6 +467,7 @@ proc run_commands { prompt command } { # # For each router... (this is main loop) # +source_password_file $password_file set in_proc 0 foreach router [lrange $argv $i end] { set router [string tolower $router] @@ -530,7 +540,7 @@ foreach router [lrange $argv $i end] { # Figure out prompts set u_prompt [find userprompt $router] - if { "$u_prompt" == "" } { set u_prompt "(Username|login):" } + if { "$u_prompt" == "" } { set u_prompt "(Username|login|user name):" } set p_prompt [find passprompt $router] if { "$p_prompt" == "" } { set p_prompt "(\[Pp]assword|passwd):" } set e_prompt [find enableprompt $router] @@ -573,6 +583,7 @@ foreach router [lrange $argv $i end] { send "term length 0\r" } else { send "set length 0\r" + send "set logging session disable\r" } expect $prompt {} source $sfile diff --git a/bin/configure b/bin/configure index b0770e7..69078a7 100755 --- a/bin/configure +++ b/bin/configure @@ -616,12 +616,21 @@ RD_BIN_PROGS=$rd_cv_rd_bin_progs PERLV_PATH=$ac_cv_path_PERLV_PATH +PERLV=$ac_cv_PERLV + + EXPECT_PATH=$ac_cv_path_EXPECT_PATH ENV_PATH=$ac_cv_env_path +MAILPLUS=$rd_cv_MAILPLUS + + +DIFF_CMD=$rd_cv_DIFF_CMD + + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -773,8 +782,11 @@ s%@INSTALL_DATA@%$INSTALL_DATA%g s%@RD_BIN_DATAS@%$RD_BIN_DATAS%g s%@RD_BIN_PROGS@%$RD_BIN_PROGS%g s%@PERLV_PATH@%$PERLV_PATH%g +s%@PERLV@%$PERLV%g s%@EXPECT_PATH@%$EXPECT_PATH%g s%@ENV_PATH@%$ENV_PATH%g +s%@MAILPLUS@%$MAILPLUS%g +s%@DIFF_CMD@%$DIFF_CMD%g CEOF EOF diff --git a/bin/configure.in b/bin/configure.in index 02b7d71..d78d758 100644 --- a/bin/configure.in +++ b/bin/configure.in @@ -14,12 +14,21 @@ AC_SUBST(RD_BIN_PROGS) PERLV_PATH=$ac_cv_path_PERLV_PATH AC_SUBST(PERLV_PATH) +PERLV=$ac_cv_PERLV +AC_SUBST(PERLV) + EXPECT_PATH=$ac_cv_path_EXPECT_PATH AC_SUBST(EXPECT_PATH) ENV_PATH=$ac_cv_env_path AC_SUBST(ENV_PATH) +MAILPLUS=$rd_cv_MAILPLUS +AC_SUBST(MAILPLUS) + +DIFF_CMD=$rd_cv_DIFF_CMD +AC_SUBST(DIFF_CMD) + AC_OUTPUT(Makefile env $RD_BIN_DATAS $RD_BIN_PROGS) # fix permissions on scripts. diff --git a/bin/control_rancid.in b/bin/control_rancid.in index 2acecc7..58f6211 100755 --- a/bin/control_rancid.in +++ b/bin/control_rancid.in @@ -28,38 +28,61 @@ if [ $# -lt 1 ]; then else GROUP=$1 fi -TMP=/var/tmp/rancid.$GROUP.$$ DIR=$BASEDIR/$GROUP +TMP=${TMPDIR:=/tmp}/rancid.$GROUP.$$ +trap 'rm -fr $TMP;' 1 2 15 # Bail if we do not have the necessary info to run if [ ! -d $DIR ] then + echo "$DIR does not exist." + echo "Run bin/create_cvs $GROUP to make all of the needed directories." ( echo "$DIR does not exist." - ) | Mail -s "no $GROUP directory" rancid-admin-$GROUP + echo "Run bin/create_cvs $GROUP to make all of the needed directories." + ) | Mail -s "no $GROUP directory" @MAILPLUS@admin-$GROUP exit 1 fi + +# do cvs update of router.db in case anyone has fiddled. +cd $DIR +cvs update router.db > $TMP 2>&1 +grep "^C" $TMP > /dev/null +if [ $? -eq 0 ] ; then + echo "There were CVS conflicts during update." + echo "" + cat $TMP + rm -f $TMP + exit 1 +fi +rm -f $TMP + if [ ! -f $DIR/router.db ] then ( echo "$DIR/router.db does not exist." - ) | Mail -s "no $GROUP/router.db file" rancid-admin-$GROUP + ) | Mail -s "no $GROUP/router.db file" @MAILPLUS@admin-$GROUP exit 1; elif [ ! -s $DIR/router.db ] then exit fi -# generate the list of routers we should try to fetch +# generate the list of all, up, & down routers cd $DIR +trap 'rm -fr routers.db routers.all.new routers.down.new routers.up.new \ + $TMP;' 1 2 15 grep -v '^#' router.db > routers.db cut -d: -f1,2 routers.db | sort -u > routers.all.new +if [ ! -f routers.all ] ; then touch routers.all; fi diff routers.all routers.all.new > /dev/null 2>&1; RALL=$? -@PERLV_PATH@ -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print "$F[0]:$F[1]\n") +@PERLV@ -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print "$F[0]:$F[1]\n") if ($F[2] =~ /^down$/i);}' routers.db | sort -u > routers.down.new +if [ ! -f routers.down ] ; then touch routers.down; fi diff routers.down routers.down.new > /dev/null 2>&1; RDOWN=$? -@PERLV_PATH@ -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print "$F[0]:$F[1]\n") +@PERLV@ -F: -ane '{($F[0] =~ tr@A-Z@a-z@,print "$F[0]:$F[1]\n") if ($F[2] =~ /^up$/i);}' routers.db | sort -u > routers.up.new +if [ ! -f routers.up ] ; then touch routers.up; fi diff routers.up routers.up.new > /dev/null 2>&1; RUP=$? if [ $RALL -ne 0 -o $RDOWN -ne 0 -o $RUP -ne 0 ] @@ -96,7 +119,7 @@ then ) > routers.mail if [ -s routers.mail ] ; then - Mail -s "changes in $GROUP routers" rancid-admin-$GROUP < routers.mail + Mail -s "changes in $GROUP routers" @MAILPLUS@admin-$GROUP < routers.mail fi rm -f routers.mail @@ -124,11 +147,12 @@ mv routers.all.new routers.all mv routers.down.new routers.down mv routers.up.new routers.up rm -f routers.db +trap 'rm -fr $TMP;' 1 2 15 # cvs delete configs for routers not listed in routers.up. cd $DIR/configs for router in `find . \( -name \*.new -prune -o -name CVS -prune \) -o -type f -print | sed -e 's/^.\///'` ; do - grep "^$router:" ../router.db > /dev/null 2>&1 + grep -i "^$router:" ../router.db > /dev/null 2>&1 if [ $? -eq 1 ]; then rm -f $router cvs delete $router @@ -207,26 +231,17 @@ rename 's/.new$//' *.new # This has been different for different machines... # Diff the directory and then checkin. +trap 'rm -fr $TMP $TMP.diff;' 1 2 15 cd $DIR -#cvs diff -c3 >$TMP.diff -#cvs diff -C 3 >$TMP.diff -# Change the output of a unified diff to make it a bit more readable. -cat > $TMP.sedf << EOF -/^RCS file: /d -#/^retrieving revision /d -/^--- /d -/^+++ /d -s/^\([-+ ]\)/\1 / -EOF -cvs -f diff -u -4 | sed -f $TMP.sedf >$TMP.diff -rm -f $TMP.sedf +cvs -f @DIFF_CMD@ | sed -e '/^RCS file: /d' -e '/^--- /d' \ + -e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff cvs commit -m updates # Mail out the diffs (if there are any). if [ -s $TMP.diff ]; then sendmail -t <= $OLDTIME*60*60);}" $DIR/routers.up | sort -u > $DIR/routers.failed if [ -s $DIR/routers.failed ] then @@ -252,8 +267,9 @@ than $OLDTIME hours. END cat $DIR/routers.failed - ) | Mail -s "config fetcher problems - $GROUP" rancid-admin-$GROUP + ) | Mail -s "config fetcher problems - $GROUP" @MAILPLUS@admin-$GROUP fi # Cleanup -rm -f $TMP.diff $TMP.lst +rm -f $TMP.diff +trap '' 1 2 15 diff --git a/bin/do-diffs.in b/bin/do-diffs.in index 4a310ef..1304a7e 100755 --- a/bin/do-diffs.in +++ b/bin/do-diffs.in @@ -7,6 +7,8 @@ ENVFILE="`dirname $0`/env" . $ENVFILE +TMPDIR=${TMPDIR:=/tmp}; export TMPDIR + if [ $# -ge 1 ] ; then LIST_OF_GROUPS="$*"; export LIST_OF_GROUPS elif [ "$LIST_OF_GROUPS" = "" ] ; then @@ -18,6 +20,7 @@ if [ ! -d $BASEDIR/logs ] ; then mkdir $BASEDIR/logs fi + for GROUP in $LIST_OF_GROUPS do @@ -30,28 +33,32 @@ do if [ -f $LOCKFILE ] then echo hourly config diffs failed: $LOCKFILE exists - /bin/ls -l $LOCKFILE + ls -l $LOCKFILE # Send email if the lock file is old. if [ "X$LOCKTIME" = "X" ] ; then LOCKTIME=4 fi - @PERLV_PATH@ -e "\$t = (stat(\"$LOCKFILE\"))[9]; print \"OLD\\n\" if (time() - \$t >= $LOCKTIME*60*60);" > $TMPDIR/.$GROUP.old + @PERLV@ -e "\$t = (stat(\"$LOCKFILE\"))[9]; print \"OLD\\n\" if (time() - \$t >= $LOCKTIME*60*60);" > $TMPDIR/.$GROUP.old if [ -s $TMPDIR/.$GROUP.old ] then ( cat <) { } while (/Active\) >\s*($cmds_regexp)\s*$/) { $cmd = $1; - if (!defined($prompt)) {$prompt = ($_ =~ /^([^#]+#)/)[0]; } + if (!defined($prompt)) { + $prompt = ($_ =~ /^([^#]+#)/)[0]; + $prompt =~ s/([}{)(\\])/\\$1/g; + } print STDERR ("HIT COMMAND:$_") if ($debug); if (! defined($commands{$cmd})) { print STDERR "found unexpected command - \"$cmd\"\n"; diff --git a/bin/flogin.in b/bin/flogin.in index a43ddda..6c82594 100755 --- a/bin/flogin.in +++ b/bin/flogin.in @@ -55,12 +55,18 @@ set do_enapasswd 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) } 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 - + # 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. - regexp {\(([^)]*)} [exec id] junk default_user -} + if [ catch {exec id} reason ] { + send_error "Error: 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 @@ -211,18 +217,26 @@ proc label { host } { # add password sl* pete cow # add password at* steve # add password * hanky-pie -proc add {var args} { global $var ;lappend $var $args} +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} { - source_password_file - upvar $var list - if { [info exists list] } { - foreach line $list { - if { [string match [lindex $line 0] $router ] } { - return [lrange $line 1 end] - } + upvar int_$var list + if { [info exists list] } { + foreach line $list { + if { [string match [lindex $line 0] $router ] } { + return [lrange $line 1 end] + } + } } - } - return {} + return {} } # Loads the password file. Note that as this file is tcl, and that @@ -230,18 +244,17 @@ proc find {var router} { # 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 { } { - global env password_file read_password_file - if { [info exists read_password_file] } { return } - if { [info exists password_file] == 0 } { - set password_file $env(HOME)/.cloginrc - } - set read_password_file 1 - file stat $password_file fileinfo - if { [expr ($fileinfo(mode) & 007)] != 0000 } { - send_user "Error: $password_file must not be world readable/writable\n" - exit 1 - } +proc source_password_file { password_file } { + global env + if { ! [file exists $password_file] } { + send_user "Error: password file ($password_file) does not exist\n" + exit 1 + } + file stat $password_file fileinfo + if { [expr ($fileinfo(mode) & 007)] != 0000 } { + send_user "Error: $password_file must not be world readable/writable\n" + exit 1 + } if [ catch {source $password_file} reason ] { send_user "Error: $reason\n" exit 1 @@ -423,6 +436,7 @@ proc run_commands { prompt command } { # # For each router... (this is main loop) # +source_password_file $password_file set in_proc 0 foreach router [lrange $argv $i end] { set router [string tolower $router] diff --git a/bin/francid.in b/bin/francid.in index 6f0c2b7..560d959 100755 --- a/bin/francid.in +++ b/bin/francid.in @@ -244,15 +244,21 @@ sub WriteTerm { # order logging statements /^logging (\d+\.\d+\.\d+\.\d+)/ && ProcessHistory("LOGGING","ipsort","$1","$_") && next; - # order name-server statements - /^ip name-server (\d+\.\d+\.\d+\.\d+)/ && - ProcessHistory("NAMESERVER","ipsort","$1","$_") && next; - # order snmp-server host statements - /^snmp-server host (\d+\.\d+\.\d+\.\d+)/ && - ProcessHistory("SNMPSERVERHOST","ipsort","$1","$_") && next; - /^snmp-server community / && - ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") && next; - + # order/prune snmp-server host/community statements + if (/^(snmp-server host )(\d+\.\d+\.\d+\.\d+)/) { + if (defined($ENV{'NOCOMMSTR'})) { + ProcessHistory("SNMPSERVERHOST","ipsort","$2","!$1 $2 \n") && next; + } else { + ProcessHistory("SNMPSERVERHOST","ipsort","$2","$_") && next; + } + } + if (/^(snmp-server community )(\S+)/) { + if (defined($ENV{'NOCOMMSTR'})) { + ProcessHistory("SNMPSERVERCOMM","keysort","$_","!$1$'") && next; + } else { + ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") && next; + } + } # order tacacs server statements /^(tacacs-server key )/ && ProcessHistory("","","","! $1\n") && next; @@ -328,6 +334,7 @@ if ($file) { } } +ProcessHistory("","","","!RANCID-CONTENT-TYPE: foundry\n!\n"); TOP: while() { tr/\015//d; if (/\#exit$/) { @@ -343,7 +350,10 @@ TOP: while() { } while (/#\s*($cmds_regexp)\s*$/) { $cmd = $1; - if (!defined($prompt)) {$prompt = ($_ =~ /^([^#]+#)/)[0]; } + if (!defined($prompt)) { + $prompt = ($_ =~ /^([^#]+#)/)[0]; + $prompt =~ s/([}{)(\\])/\\$1/g; + } print STDERR ("HIT COMMAND:$_") if ($debug); if (! defined($commands{$cmd})) { print STDERR "found unexpected command - \"$cmd\"\n"; diff --git a/bin/jlogin.in b/bin/jlogin.in index 28e773b..e0ac844 100755 --- a/bin/jlogin.in +++ b/bin/jlogin.in @@ -47,11 +47,17 @@ set passphrase "" # 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) } 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. - regexp {\(([^)]*)} [exec id] junk default_user + if [ catch {exec id} reason ] { + send_error "Error: could not exec id: $reason\n" + exit 1 + } + regexp {\(([^)]*)} "$reason" junk default_user } # Sometimes routers take awhile to answer (the default is 10 sec) @@ -184,11 +190,18 @@ proc label { host } { # add password sl* pete cow # add password at* steve # add password * hanky-pie -proc add {var args} { global $var ;lappend $var $args } +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} { - source_password_file - upvar $var list + upvar int_$var list if { [info exists list] } { foreach line $list { if { [string match [lindex $line 0] $router ] } { @@ -204,18 +217,12 @@ proc find {var router} { # 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 { } { - global env password_file read_password_file - if { [info exists read_password_file] } { return } - if { [info exists password_file] == 0 } { - set password_file $env(HOME)/.cloginrc - } +proc source_password_file { password_file } { + global env if { ! [file exists $password_file] } { send_user "Error: password file ($password_file) does not exist\n" exit 1 } - - set read_password_file 1 file stat $password_file fileinfo if { [expr ($fileinfo(mode) & 007)] != 0000 } { send_user "Error: $password_file must not be world readable/writable\n" @@ -400,6 +407,7 @@ proc run_commands { prompt command } { # # For each router... (this is main loop) # +source_password_file $password_file set in_proc 0 foreach router [lrange $argv $i end] { set router [string tolower $router] diff --git a/bin/jrancid.in b/bin/jrancid.in index 633d844..6e2311f 100755 --- a/bin/jrancid.in +++ b/bin/jrancid.in @@ -443,6 +443,7 @@ if ($file) { } +ProcessHistory("","","","# RANCID-CONTENT-TYPE: juniper\n#\n"); TOP: while() { tr/\015//d; if (/^Error:/) { @@ -460,7 +461,10 @@ TOP: while() { } while (/>\s*($cmds_regexp)\s*$/) { $cmd = $1; - if (!defined($prompt)) {$prompt = ($_ =~ /^([^>]+>)/)[0]; } + if (!defined($prompt)) { + $prompt = ($_ =~ /^([^>]+>)/)[0]; + $prompt =~ s/([}{)(\\])/\\$1/g; + } print STDERR ("HIT COMMAND:$_") if ($debug); if (! defined($commands{$cmd})) { print STDERR "found unexpected command - \"$cmd\"\n"; diff --git a/bin/rancid.in b/bin/rancid.in index 24b9d14..065697a 100755 --- a/bin/rancid.in +++ b/bin/rancid.in @@ -138,6 +138,7 @@ sub ShowVersion { tr/\015//d; last if(/^$prompt/); next if(/^(\s*|\s*$cmd\s*)$/); + return(-1) if (/command authorization failed/i); if (/^Slave in slot (\d+) is running/) { $slave = " Slave:"; next; @@ -213,6 +214,9 @@ sub ShowVersion { } elsif ( $1 =~ /WS-C35/) { $type = "3500XL"; $device = "switch"; + } elsif ( $1 =~ /6000/) { + $type = "6000"; + $device = "switch"; } else { $type = $1; } @@ -281,6 +285,7 @@ sub ShowInstallActive { next if (/^(\s*|\s*$cmd\s*)$/); return(1) if /^\s*\^\s*$/; return(1) if /(Invalid input detected|Type help or )/; + return(-1) if (/command authorization failed/i); ProcessHistory("COMMENTS","keysort","F5","!Image: $_") && next; } return(0); @@ -296,6 +301,7 @@ sub ShowEnv { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(1) if ($type !~ /^7/); + return(-1) if (/command authorization failed/i); if (!defined($E0)) { $E0=1; ProcessHistory("COMMENTS","keysort","E0","!\n"); @@ -329,6 +335,7 @@ sub ShowGSR { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); + return(-1) if (/command authorization failed/i); return(1) if ($type !~ /^120/); /^$/ && next; /^\s+Chassis: type (\S+) Fab Ver: (\S+)/ && @@ -364,6 +371,7 @@ sub ShowBoot { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(1) if /^\s*\^\s*$/; + return(-1) if (/command authorization failed/i); return(1) if /Ambiguous command/i; return(1) if /(Invalid input detected|Type help or )/; return(1) if /(Open device \S+ failed|Error opening \S+:)/; @@ -395,6 +403,7 @@ sub ShowFlash { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(1) if ($type =~ /^(120|7)/); + return(-1) if (/command authorization failed/i); return(1) if /^\s*\^\s*$/; return(1) if /(Invalid input detected|Type help or )/; ProcessHistory("FLASH","","","!Flash: $_"); @@ -421,6 +430,7 @@ sub DirSlotN { return(1) if /No space information available/; return(-1) if /\%Error calling/; return(-1) if /: device being squeezed/; # Flash is busy + return(-1) if (/command authorization failed/i); return(1) if /(Open device \S+ failed|Error opening \S+:)/; ProcessHistory("FLASH","","","!Flash: $dev: $_"); } @@ -438,6 +448,7 @@ sub ShowContAll { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(1) if ($type =~ /^(120|7[05])/); + return(-1) if (/command authorization failed/i); if (/^Interface ([^ \n(]*)/) { $INT = "$1, "; next; } /^(BRI unit \d)/ && ProcessHistory("INT","","","!Interface: $1\n") && next; @@ -495,6 +506,7 @@ sub ShowContCbus { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(1) if ($type !~ /^7[05]0/); + return(-1) if (/command authorization failed/i); if (/^\s*slot(\d+): ([^,]+), hw (\S+), sw (\S+), ccb/) { $slot = $1; $board{$slot} = $2; @@ -539,6 +551,7 @@ sub ShowDiagbus { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(1) if ($type !~ /^7[05]/); + return(-1) if (/command authorization failed/i); if (/^\s*Slot (\d+):/i) { $slot = $1; next; @@ -624,6 +637,7 @@ sub ShowDiag { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(1) if ($type !~ /^(120|720|36|26)/); + return(-1) if (/command authorization failed/i); /^$/ && next; if (!defined($showdiags)) {$showdiags=1; ProcessHistory("SLOT","","","!\n");} s/Port Packet Over SONET/POS/; @@ -632,6 +646,7 @@ sub ShowDiag { ProcessHistory("SLOT","","","!Slot $slot: $3\n"); # Here we look for boards that don't have DRAM. $board = "Other"; + $board = "PS" if (/Power Supply/); $board = "RP" if (/Route Processor/); $board = "CLK" if (/Clock Scheduler Card/); $board = "SFC" if (/Switch Fabric Card/); @@ -640,6 +655,9 @@ sub ShowDiag { if (/^\s+MAIN:\s+ type \d+,\s+(.*)/) { ProcessHistory("SLOT","","","!Slot $slot/MAIN: part $1\n") && next; } + if (/ Engine:\s+(.*)/) { + ProcessHistory("SLOT","","","!Slot $slot/Engine: $1\n"); + } if (/^\s+PCA:\s+(.*)/) { local($part) = $1; $_ = ; @@ -720,6 +738,7 @@ sub ShowModule { return if (/^\s*\^$/); last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); + return(-1) if (/command authorization failed/i); # match slot info line, slot info then the rev info (the two are split) if (/^ ?(\d+)\s+(\d+)\s+(.*)\s+(\S+)\s+(\S+)\s*$/) { @@ -750,6 +769,7 @@ sub ShowC7200 { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(1) if ($type !~ /^72/); + return(-1) if (/command authorization failed/i); /^$/ && next; if (/C7200 Midplane EEPROM:/) { $_ = ; @@ -783,14 +803,37 @@ sub ShowVTP { next if (/^(\s*|\s*$cmd\s*)$/); return(1) if /^\s*\^\s*$/; return(1) if /(Invalid input detected|Type help or )/; - return(1) if ($type !~ /^2900XL$/); + return(1) if ($type !~ /^(2900XL|3500XL|6000)$/); + return(-1) if (/command authorization failed/i); next if (/^Configuration last modified by/); + if (/^VTP Operating Mode\s+:\s+(Transparent|Server)/) { + $DO_SHOW_VLAN = 1; + } ProcessHistory("COMMENTS","keysort","I0","!VTP: $_"); } ProcessHistory("COMMENTS","keysort","I0","!\n"); return(0); } +# This routine parses "show vlan" +sub ShowVLAN { + print STDERR " In ShowVLAN: $_" if ($debug); + + ($_=,return(1)) if (!$DO_SHOW_VLAN); + + while () { + tr/\015//d; + last if (/^$prompt/); + next if (/^(\s*|\s*$cmd\s*)$/); + return(1) if /(Invalid input detected|Type help or )/; + return(1) if ($type !~ /^(2900XL|3500XL|6000)$/); + return(-1) if (/command authorization failed/i); + ProcessHistory("COMMENTS","keysort","IO","!VLAN: $_"); + } + ProcessHistory("COMMENTS","keysort","IO","!\n"); + return(0); +} + # This routine processes a "write term" sub WriteTerm { print STDERR " In WriteTerm: $_" if ($debug); @@ -798,6 +841,7 @@ sub WriteTerm { while () { tr/\015//d; last if(/^$prompt/); + return(-1) if (/command authorization failed/i); # the pager can not be disabled per-session on the PIX s/^<-+ More -+>\s*//; /Non-Volatile memory is in use/ && return(-1); # NvRAM is locked @@ -898,9 +942,6 @@ sub WriteTerm { # order logging statements /^logging (\d+\.\d+\.\d+\.\d+)/ && ProcessHistory("LOGGING","ipsort","$1","$_") && next; - # order name-server statements - /^ip name-server (\d+\.\d+\.\d+\.\d+)/ && - ProcessHistory("NAMESERVER","ipsort","$1","$_") && next; # order/prune snmp-server host statements # we only prune lines of the form # snmp-server host a.b.c.d @@ -993,6 +1034,7 @@ sub DoNothing {print STDOUT;} 'show gsr chassis' => "ShowGSR", 'show boot' => "ShowBoot", 'show bootvar' => "ShowBoot", + 'show variables boot' => "ShowBoot", 'show flash' => "ShowFlash", 'dir /all nvram:' => "DirSlotN", 'dir /all bootflash:' => "DirSlotN", @@ -1007,6 +1049,7 @@ sub DoNothing {print STDOUT;} 'show module' => "ShowModule", # cat 6500-ios 'show c7200' => "ShowC7200", 'show vtp status' => "ShowVTP", + 'show vlan' => "ShowVLAN", 'write term' => "WriteTerm" ); # keys() doesnt return things in the order entered and the order of the @@ -1018,6 +1061,7 @@ sub DoNothing {print STDOUT;} "show gsr chassis", "show boot", "show bootvar", + "show variables boot", "show flash", "dir /all nvram:", "dir /all bootflash:", @@ -1032,6 +1076,7 @@ sub DoNothing {print STDOUT;} "show module", "show c7200", "show vtp status", + "show vlan", "write term" ); $cisco_cmds=join(";",@commands); @@ -1057,6 +1102,7 @@ if ($file) { } } +ProcessHistory("","","","!RANCID-CONTENT-TYPE: cisco\n!\n"); ProcessHistory("COMMENTS","keysort","B0","!\n"); ProcessHistory("COMMENTS","keysort","F0","!\n"); ProcessHistory("COMMENTS","keysort","G0","!\n"); diff --git a/bin/rrancid.in b/bin/rrancid.in index 9d9b84f..9d40591 100755 --- a/bin/rrancid.in +++ b/bin/rrancid.in @@ -212,11 +212,19 @@ sub WriteTerm { # order access-lists /^access-list\s+(\d\d?)\s+(\S+)\s+(\S+)/ && ProcessHistory("ACL $1 $2","ipsort","$3","$_") && next; + # prune snmp community statements + if (/^snmp (group|community) (\S+)/) { + if (defined($ENV{'NOCOMMSTR'})) { + ProcessHistory("SNMPSERVERCOMM","keysort","$_","!snmp $1 $'") && next; + } else { + ProcessHistory("SNMPSERVERCOMM","keysort","$_","$_") && next; + } + } ProcessHistory("","","","$_"); # end of config - if (/^end$/) { - $found_end = 1; - last; + if (/^end$/) { + $found_end = 1; + last; } } return; @@ -286,6 +294,7 @@ if ($file) { } } +ProcessHistory("","","","!RANCID-CONTENT-TYPE: redback\n!\n"); ProcessHistory("COMMENTS","keysort","B0","!\n"); ProcessHistory("COMMENTS","keysort","C0","!\n"); ProcessHistory("COMMENTS","keysort","E0","!\n"); diff --git a/cloginrc.sample b/cloginrc.sample index 2e17025..dc040b4 100644 --- a/cloginrc.sample +++ b/cloginrc.sample @@ -22,7 +22,7 @@ # # add userprompt # What the router prints to prompt for the username. -# Default: "(Username|login):" +# Default: {"(Username|login|user name):"} # # add userpassword # The password for user if different than the password set @@ -30,7 +30,7 @@ # # add passprompt # What the router prints to prompt for the password. -# Default: "\[Pp]assword:" +# Default: {"(\[Pp]assword|passwd):"} # # add method {ssh} [...] # Defines, in order, which connection method(s) to use for a device @@ -45,7 +45,7 @@ # # add enableprompt # What the router prints to prompt for the enable password. -# Default: "\[Pp]assword:" +# Default: {"\[Pp]assword:"} # # add enauser # This is only needed if enable asks for a username and this @@ -60,6 +60,9 @@ # add identity # Default is your default ssh identity. # +# include +# include a secondary .cloginrc file +# # # Note: The first match for a hostname takes precedence. @@ -105,7 +108,7 @@ add password * {clearance} {clarence} add cyphertype * {3des} # set the username prompt to "router login:" -#add userprompt * router login: +#add userprompt * {"router login:"} # ssh identity for a juniper; used with jlogin add identity my.juniper $env(HOME)/.ssh/juniper diff --git a/configure b/configure index bcb66c1..1662bc5 100755 --- a/configure +++ b/configure @@ -15,6 +15,8 @@ ac_default_prefix=/usr/local/rancid ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --enable-mail-plus enable mail to rancid+ addresses, instead of rancid-" ac_help="$ac_help --with-ucbmail=[FQPN] path to UCB mail" @@ -559,7 +561,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:563: checking for a BSD compatible install" >&5 +echo "configure:565: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -612,7 +614,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:616: checking whether build environment is sane" >&5 +echo "configure:618: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -669,7 +671,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:673: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:675: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -715,7 +717,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:719: checking for working aclocal" >&5 +echo "configure:721: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -728,7 +730,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:732: checking for working autoconf" >&5 +echo "configure:734: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -741,7 +743,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:745: checking for working automake" >&5 +echo "configure:747: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -754,7 +756,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:758: checking for working autoheader" >&5 +echo "configure:760: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -767,7 +769,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:771: checking for working makeinfo" >&5 +echo "configure:773: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -792,10 +794,10 @@ PACKAGE=rancid # VERSION needs to be updated such that 'make dist' uses the correct # filename for the directory name and tarball. -VERSION=2.1b +VERSION=2.1 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:799: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:801: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -818,118 +820,35 @@ fi -# Extract the first word of "cvs", so it can be a program name with args. -set dummy cvs; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:825: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_CVS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +# Check for a preference for using mail addresses like rancid+admin-group +# instead of the standard rancid-admin-group +echo $ac_n "checking whether mail addresses should be in the rancid+ form""... $ac_c" 1>&6 +echo "configure:827: checking whether mail addresses should be in the rancid+ form" >&5 +# Check whether --enable-mail-plus or --disable-mail-plus was given. +if test "${enable_mail_plus+set}" = set; then + enableval="$enable_mail_plus" + if test "$enable_mail_plus" = yes; then + echo "$ac_t""yes" 1>&6 + MAILPLUS="rancid+" + else - case "$CVS" in - /*) - ac_cv_path_CVS="$CVS" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_CVS="$CVS" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_CVS="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_CVS" && ac_cv_path_CVS="no" - ;; -esac + echo "$ac_t""no" 1>&6 + MAILPLUS="rancid-" + fi -CVS="$ac_cv_path_CVS" -if test -n "$CVS"; then - echo "$ac_t""$CVS" 1>&6 else echo "$ac_t""no" 1>&6 -fi + MAILPLUS="rancid-" + -# Extract the first word of "comm", so it can be a program name with args. -set dummy comm; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:861: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_COMM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$COMM" in - /*) - ac_cv_path_COMM="$COMM" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_COMM="$COMM" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_COMM="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_COMM" && ac_cv_path_COMM="no" - ;; -esac -fi -COMM="$ac_cv_path_COMM" -if test -n "$COMM"; then - echo "$ac_t""$COMM" 1>&6 -else - echo "$ac_t""no" 1>&6 fi -# Extract the first word of "mkdir", so it can be a program name with args. -set dummy mkdir; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:897: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$MKDIR" in - /*) - ac_cv_path_MKDIR="$MKDIR" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_MKDIR="$MKDIR" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_MKDIR="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MKDIR" && ac_cv_path_MKDIR="no" - ;; -esac -fi -MKDIR="$ac_cv_path_MKDIR" -if test -n "$MKDIR"; then - echo "$ac_t""$MKDIR" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi +rd_cv_MAILPLUS=$MAILPLUS # Extract the first word of "dirname", so it can be a program name with args. set dummy dirname; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:933: checking for $ac_word" >&5 +echo "configure:852: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_DIRNAME'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -966,7 +885,7 @@ fi # Extract the first word of "diff", so it can be a program name with args. set dummy diff; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:970: checking for $ac_word" >&5 +echo "configure:889: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_DIFF'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1001,54 +920,33 @@ fi if test $DIFF = no; then unset ac_cv_path_DIFF - { echo "configure: error: can't locate a GNU diff." 1>&2; exit 1; } + { echo "configure: error: can't locate diff." 1>&2; exit 1; } else $DIFF -u /dev/null /dev/null > /dev/null 2>&1 if test $? -ne 0; then - { echo "configure: error: can't locate a GNU diff (one which accepts the -u option)." 1>&2; exit 1; } - exit 1 - fi -fi -# Extract the first word of "touch", so it can be a program name with args. -set dummy touch; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1016: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_TOUCH'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$TOUCH" in - /*) - ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_TOUCH="$ac_dir/$ac_word" - break + $DIFF -C 2 /dev/null /dev/null > /dev/null 2>&1 + if test $? -ne 0; then + $DIFF -c2 /dev/null /dev/null > /dev/null 2>&1 + if test $? -ne 0; then + { echo "configure: error: can't locate a diff which accepts the -u option." 1>&2; exit 1; } + exit 1 + else + DIFF_CMD="diff -c4" + fi + else + DIFF_CMD="diff -C 4" + fi + else + DIFF_CMD="diff -u -4" fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_TOUCH" && ac_cv_path_TOUCH="no" - ;; -esac -fi -TOUCH="$ac_cv_path_TOUCH" -if test -n "$TOUCH"; then - echo "$ac_t""$TOUCH" 1>&6 -else - echo "$ac_t""no" 1>&6 fi +rd_cv_DIFF_CMD=$DIFF_CMD + # Extract the first word of "sendmail", so it can be a program name with args. set dummy sendmail; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1052: checking for $ac_word" >&5 +echo "configure:950: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SENDMAIL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1091,7 +989,7 @@ fi # Extract the first word of "Mail", so it can be a program name with args. set dummy Mail; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1095: checking for $ac_word" >&5 +echo "configure:993: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_UCBMAIL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1129,7 +1027,7 @@ if test $UCBMAIL = no; then # Extract the first word of "mailx", so it can be a program name with args. set dummy mailx; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1133: checking for $ac_word" >&5 +echo "configure:1031: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_UCBMAIL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1168,47 +1066,11 @@ fi exit 1 fi fi -# Extract the first word of "sort", so it can be a program name with args. -set dummy sort; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1175: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_SORT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$SORT" in - /*) - ac_cv_path_SORT="$SORT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_SORT="$SORT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_SORT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_SORT" && ac_cv_path_SORT="no" - ;; -esac -fi -SORT="$ac_cv_path_SORT" -if test -n "$SORT"; then - echo "$ac_t""$SORT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - # Extract the first word of "gmake", so it can be a program name with args. set dummy gmake; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1212: checking for $ac_word" >&5 +echo "configure:1074: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1246,7 +1108,7 @@ if test $MAKE = no; then # Extract the first word of "make", so it can be a program name with args. set dummy make; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1250: checking for $ac_word" >&5 +echo "configure:1112: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1285,7 +1147,7 @@ fi fi fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1289: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1151: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1319,7 +1181,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1323: checking for $ac_word" >&5 +echo "configure:1185: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_TAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1354,7 +1216,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1358: checking for $ac_word" >&5 +echo "configure:1220: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AUTOMAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1396,7 +1258,7 @@ done # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1400: checking for a BSD compatible install" >&5 +echo "configure:1262: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1451,7 +1313,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "perl5", so it can be a program name with args. set dummy perl5; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1455: checking for $ac_word" >&5 +echo "configure:1317: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERLV_PATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1489,7 +1351,7 @@ if test $PERLV_PATH = no; then # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1493: checking for $ac_word" >&5 +echo "configure:1355: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERLV_PATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1534,11 +1396,13 @@ fi fi fi +ac_cv_PERLV=`basename $PERLV_PATH` + # Extract the first word of "expect", so it can be a program name with args. set dummy expect; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1542: checking for $ac_word" >&5 +echo "configure:1406: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_EXPECT_PATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1580,7 +1444,7 @@ fi # Extract the first word of "ping", so it can be a program name with args. set dummy ping; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1584: checking for $ac_word" >&5 +echo "configure:1448: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PING_PATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1666,20 +1530,22 @@ INST_PROGS=$progs # locate tools to build $PATH for env. order is significant. want to be # sure that we pick up the the proper diff and ucbmail in bin/env. -unset ENV_PATH -# Extract the first word of "diff", so it can be a program name with args. -set dummy diff; ac_word=$2 +ENV_PATH="`dirname $PERLV_PATH`:`dirname $EXPECT_PATH`:`dirname $SENDMAIL`" +ENV_PATH="$ENV_PATH:`dirname $DIRNAME`:`dirname $DIFF`:`dirname $UCBMAIL`" + +# Extract the first word of "cvs", so it can be a program name with args. +set dummy cvs; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1674: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_DIFF'+set}'`\" = set"; then +echo "configure:1540: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_CVS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - case "$DIFF" in + case "$CVS" in /*) - ac_cv_path_DIFF="$DIFF" # Let the user override the test with a path. + ac_cv_path_CVS="$CVS" # Let the user override the test with a path. ;; ?:/*) - ac_cv_path_DIFF="$DIFF" # Let the user override the test with a dos path. + ac_cv_path_CVS="$CVS" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" @@ -1687,36 +1553,36 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_DIFF="$ac_dir/$ac_word" + ac_cv_path_CVS="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_DIFF" && ac_cv_path_DIFF="no" + test -z "$ac_cv_path_CVS" && ac_cv_path_CVS="no" ;; esac fi -DIFF="$ac_cv_path_DIFF" -if test -n "$DIFF"; then - echo "$ac_t""$DIFF" 1>&6 +CVS="$ac_cv_path_CVS" +if test -n "$CVS"; then + echo "$ac_t""$CVS" 1>&6 else echo "$ac_t""no" 1>&6 fi -ENV_PATH=`dirname $ac_cv_path_DIFF` -# Extract the first word of "Mail", so it can be a program name with args. -set dummy Mail; ac_word=$2 +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_CVS`" +# Extract the first word of "comm", so it can be a program name with args. +set dummy comm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1711: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_UCBMAIL'+set}'`\" = set"; then +echo "configure:1577: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_COMM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - case "$UCBMAIL" in + case "$COMM" in /*) - ac_cv_path_UCBMAIL="$UCBMAIL" # Let the user override the test with a path. + ac_cv_path_COMM="$COMM" # Let the user override the test with a path. ;; ?:/*) - ac_cv_path_UCBMAIL="$UCBMAIL" # Let the user override the test with a dos path. + ac_cv_path_COMM="$COMM" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" @@ -1724,36 +1590,36 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_UCBMAIL="$ac_dir/$ac_word" + ac_cv_path_COMM="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_UCBMAIL" && ac_cv_path_UCBMAIL="no" + test -z "$ac_cv_path_COMM" && ac_cv_path_COMM="no" ;; esac fi -UCBMAIL="$ac_cv_path_UCBMAIL" -if test -n "$UCBMAIL"; then - echo "$ac_t""$UCBMAIL" 1>&6 +COMM="$ac_cv_path_COMM" +if test -n "$COMM"; then + echo "$ac_t""$COMM" 1>&6 else echo "$ac_t""no" 1>&6 fi -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_UCBMAIL`" -# Extract the first word of "cvs", so it can be a program name with args. -set dummy cvs; ac_word=$2 +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_COMM`" +# Extract the first word of "find", so it can be a program name with args. +set dummy find; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1748: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_CVS'+set}'`\" = set"; then +echo "configure:1614: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_FIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - case "$CVS" in + case "$FIND" in /*) - ac_cv_path_CVS="$CVS" # Let the user override the test with a path. + ac_cv_path_FIND="$FIND" # Let the user override the test with a path. ;; ?:/*) - ac_cv_path_CVS="$CVS" # Let the user override the test with a dos path. + ac_cv_path_FIND="$FIND" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" @@ -1761,36 +1627,36 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_CVS="$ac_dir/$ac_word" + ac_cv_path_FIND="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_CVS" && ac_cv_path_CVS="no" + test -z "$ac_cv_path_FIND" && ac_cv_path_FIND="no" ;; esac fi -CVS="$ac_cv_path_CVS" -if test -n "$CVS"; then - echo "$ac_t""$CVS" 1>&6 +FIND="$ac_cv_path_FIND" +if test -n "$FIND"; then + echo "$ac_t""$FIND" 1>&6 else echo "$ac_t""no" 1>&6 fi -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_CVS`" -# Extract the first word of "comm", so it can be a program name with args. -set dummy comm; ac_word=$2 +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_FIND`" +# Extract the first word of "grep", so it can be a program name with args. +set dummy grep; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1785: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_COMM'+set}'`\" = set"; then +echo "configure:1651: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GREP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - case "$COMM" in + case "$GREP" in /*) - ac_cv_path_COMM="$COMM" # Let the user override the test with a path. + ac_cv_path_GREP="$GREP" # Let the user override the test with a path. ;; ?:/*) - ac_cv_path_COMM="$COMM" # Let the user override the test with a dos path. + ac_cv_path_GREP="$GREP" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" @@ -1798,27 +1664,64 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_COMM="$ac_dir/$ac_word" + ac_cv_path_GREP="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_COMM" && ac_cv_path_COMM="no" + test -z "$ac_cv_path_GREP" && ac_cv_path_GREP="no" ;; esac fi -COMM="$ac_cv_path_COMM" -if test -n "$COMM"; then - echo "$ac_t""$COMM" 1>&6 +GREP="$ac_cv_path_GREP" +if test -n "$GREP"; then + echo "$ac_t""$GREP" 1>&6 else echo "$ac_t""no" 1>&6 fi -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_COMM`" +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_GREP`" +# Extract the first word of "id", so it can be a program name with args. +set dummy id; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1688: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_ID'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$ID" in + /*) + ac_cv_path_ID="$ID" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_ID="$ID" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_ID="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_ID" && ac_cv_path_ID="no" + ;; +esac +fi +ID="$ac_cv_path_ID" +if test -n "$ID"; then + echo "$ac_t""$ID" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_ID`" # Extract the first word of "mkdir", so it can be a program name with args. set dummy mkdir; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1822: checking for $ac_word" >&5 +echo "configure:1725: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1852,19 +1755,19 @@ else fi ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_MKDIR`" -# Extract the first word of "dirname", so it can be a program name with args. -set dummy dirname; ac_word=$2 +# Extract the first word of "rsh", so it can be a program name with args. +set dummy rsh; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1859: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_DIRNAME'+set}'`\" = set"; then +echo "configure:1762: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_RSH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - case "$DIRNAME" in + case "$RSH" in /*) - ac_cv_path_DIRNAME="$DIRNAME" # Let the user override the test with a path. + ac_cv_path_RSH="$RSH" # Let the user override the test with a path. ;; ?:/*) - ac_cv_path_DIRNAME="$DIRNAME" # Let the user override the test with a dos path. + ac_cv_path_RSH="$RSH" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" @@ -1872,36 +1775,36 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_DIRNAME="$ac_dir/$ac_word" + ac_cv_path_RSH="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_DIRNAME" && ac_cv_path_DIRNAME="no" + test -z "$ac_cv_path_RSH" && ac_cv_path_RSH="no" ;; esac fi -DIRNAME="$ac_cv_path_DIRNAME" -if test -n "$DIRNAME"; then - echo "$ac_t""$DIRNAME" 1>&6 +RSH="$ac_cv_path_RSH" +if test -n "$RSH"; then + echo "$ac_t""$RSH" 1>&6 else echo "$ac_t""no" 1>&6 fi -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_DIRNAME`" -# Extract the first word of "touch", so it can be a program name with args. -set dummy touch; ac_word=$2 +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_RSH`" +# Extract the first word of "sort", so it can be a program name with args. +set dummy sort; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1896: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_TOUCH'+set}'`\" = set"; then +echo "configure:1799: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_SORT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - case "$TOUCH" in + case "$SORT" in /*) - ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a path. + ac_cv_path_SORT="$SORT" # Let the user override the test with a path. ;; ?:/*) - ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a dos path. + ac_cv_path_SORT="$SORT" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" @@ -1909,36 +1812,36 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_TOUCH="$ac_dir/$ac_word" + ac_cv_path_SORT="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_TOUCH" && ac_cv_path_TOUCH="no" + test -z "$ac_cv_path_SORT" && ac_cv_path_SORT="no" ;; esac fi -TOUCH="$ac_cv_path_TOUCH" -if test -n "$TOUCH"; then - echo "$ac_t""$TOUCH" 1>&6 +SORT="$ac_cv_path_SORT" +if test -n "$SORT"; then + echo "$ac_t""$SORT" 1>&6 else echo "$ac_t""no" 1>&6 fi -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_TOUCH`" -# Extract the first word of "sendmail", so it can be a program name with args. -set dummy sendmail; ac_word=$2 +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SORT`" +# Extract the first word of "ssh", so it can be a program name with args. +set dummy ssh; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1933: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_SENDMAIL'+set}'`\" = set"; then +echo "configure:1836: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_SSH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - case "$SENDMAIL" in + case "$SSH" in /*) - ac_cv_path_SENDMAIL="$SENDMAIL" # Let the user override the test with a path. + ac_cv_path_SSH="$SSH" # Let the user override the test with a path. ;; ?:/*) - ac_cv_path_SENDMAIL="$SENDMAIL" # Let the user override the test with a dos path. + ac_cv_path_SSH="$SSH" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" @@ -1946,36 +1849,39 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_SENDMAIL="$ac_dir/$ac_word" + ac_cv_path_SSH="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_SENDMAIL" && ac_cv_path_SENDMAIL="no" + test -z "$ac_cv_path_SSH" && ac_cv_path_SSH="no" ;; esac fi -SENDMAIL="$ac_cv_path_SENDMAIL" -if test -n "$SENDMAIL"; then - echo "$ac_t""$SENDMAIL" 1>&6 +SSH="$ac_cv_path_SSH" +if test -n "$SSH"; then + echo "$ac_t""$SSH" 1>&6 else echo "$ac_t""no" 1>&6 fi -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SENDMAIL`" -# Extract the first word of "sort", so it can be a program name with args. -set dummy sort; ac_word=$2 +if test $DIFF = no; then + ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SSH`" +fi +unset ac_cv_path_SSH +# Extract the first word of "telnet", so it can be a program name with args. +set dummy telnet; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1970: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_SORT'+set}'`\" = set"; then +echo "configure:1876: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_TELNET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - case "$SORT" in + case "$TELNET" in /*) - ac_cv_path_SORT="$SORT" # Let the user override the test with a path. + ac_cv_path_TELNET="$TELNET" # Let the user override the test with a path. ;; ?:/*) - ac_cv_path_SORT="$SORT" # Let the user override the test with a dos path. + ac_cv_path_TELNET="$TELNET" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" @@ -1983,25 +1889,63 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_SORT="$ac_dir/$ac_word" + ac_cv_path_TELNET="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_SORT" && ac_cv_path_SORT="no" + test -z "$ac_cv_path_TELNET" && ac_cv_path_TELNET="no" ;; esac fi -SORT="$ac_cv_path_SORT" -if test -n "$SORT"; then - echo "$ac_t""$SORT" 1>&6 +TELNET="$ac_cv_path_TELNET" +if test -n "$TELNET"; then + echo "$ac_t""$TELNET" 1>&6 else echo "$ac_t""no" 1>&6 fi - -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SORT`" + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_TELNET`" +# Extract the first word of "touch", so it can be a program name with args. +set dummy touch; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1913: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_TOUCH'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$TOUCH" in + /*) + ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_TOUCH="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_TOUCH" && ac_cv_path_TOUCH="no" + ;; +esac +fi +TOUCH="$ac_cv_path_TOUCH" +if test -n "$TOUCH"; then + echo "$ac_t""$TOUCH" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_TOUCH`" ENV_PATH="$ENV_PATH:/usr/local/bin:/usr/bin" + ENV_PATH=`echo $ENV_PATH | $PERLV_PATH -e 'foreach $x(split(":",<>)){next unless (length($x));push(@F, $x),$seen{$x}=1 unless (defined $seen{$x});}print join(":",@F);'` ac_cv_env_path=$ENV_PATH @@ -2119,7 +2063,8 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile \ + man/Makefile man/env.5 man/lg.conf.5 man/lg_intro.1" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/configure.in b/configure.in index 039662f..b69b5a1 100644 --- a/configure.in +++ b/configure.in @@ -14,27 +14,58 @@ PACKAGE=rancid # VERSION needs to be updated such that 'make dist' uses the correct # filename for the directory name and tarball. AC_SUBST(VERSION) -VERSION=2.1b +VERSION=2.1 AM_MAINTAINER_MODE() -AC_PATH_PROG(CVS,cvs,no) -AC_PATH_PROG(COMM,comm,no) -AC_PATH_PROG(MKDIR,mkdir,no) +# Check for a preference for using mail addresses like rancid+admin-group +# instead of the standard rancid-admin-group +AC_MSG_CHECKING([whether mail addresses should be in the rancid+ form]) +AC_ARG_ENABLE(mail-plus, +[ --enable-mail-plus enable mail to rancid+ addresses, instead of rancid-], +[if test "$enable_mail_plus" = yes; then + AC_MSG_RESULT(yes) + MAILPLUS="rancid+" + AC_SUBST(MAILPLUS) +else + AC_MSG_RESULT(no) + MAILPLUS="rancid-" + AC_SUBST(MAILPLUS) +fi], +[AC_MSG_RESULT(no) + MAILPLUS="rancid-" + AC_SUBST(MAILPLUS) +]) +rd_cv_MAILPLUS=$MAILPLUS + AC_PATH_PROG(DIRNAME,dirname,no) # locate GNU diff (-u option) AC_PATH_PROG(DIFF,diff,no, /usr/local/bin:/usr/gnu/bin:/usr/bin:/usr/contrib/bin) if test $DIFF = no; then unset ac_cv_path_DIFF - AC_MSG_ERROR([can't locate a GNU diff.]) + AC_MSG_ERROR([can't locate diff.]) else $DIFF -u /dev/null /dev/null > /dev/null 2>&1 if test $? -ne 0; then - AC_MSG_ERROR([can't locate a GNU diff (one which accepts the -u option).]) - exit 1 + $DIFF -C 2 /dev/null /dev/null > /dev/null 2>&1 + if test $? -ne 0; then + $DIFF -c2 /dev/null /dev/null > /dev/null 2>&1 + if test $? -ne 0; then + AC_MSG_ERROR([can't locate a diff which accepts the -u option.]) + exit 1 + else + DIFF_CMD="diff -c4" + fi + else + DIFF_CMD="diff -C 4" + fi + else + DIFF_CMD="diff -u -4" fi fi -AC_PATH_PROG(TOUCH,touch,no) +rd_cv_DIFF_CMD=$DIFF_CMD +AC_SUBST(DIFF_CMD) + AC_PATH_PROG(SENDMAIL,sendmail,no, /usr/sbin:/usr/bin:/usr/lib) # find UCB mail. AC_ARG_WITH(ucbmail, [ --with-ucbmail=[FQPN] path to UCB mail], UCBMAIL=$withval; unset ac_cv_path_UCBMAIL) @@ -48,7 +79,6 @@ if test $UCBMAIL = no; then exit 1 fi fi -AC_PATH_PROG(SORT,sort,no) AC_PATH_PROG(MAKE,gmake,no) if test $MAKE = no; then @@ -85,6 +115,8 @@ if test $PERLV_PATH = no; then fi fi AC_SUBST(PERLV_PATH) +ac_cv_PERLV=`basename $PERLV_PATH` +AC_SUBST(PERLV) AC_PATH_PROG(EXPECT_PATH,expect,no) if test $EXPECT_PATH = no; then @@ -147,32 +179,43 @@ INST_PROGS=$progs # locate tools to build $PATH for env. order is significant. want to be # sure that we pick up the the proper diff and ucbmail in bin/env. -unset ENV_PATH -AC_PATH_PROG(DIFF,diff,no) -ENV_PATH=`dirname $ac_cv_path_DIFF` -AC_PATH_PROG(UCBMAIL,Mail,no) -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_UCBMAIL`" +ENV_PATH="`dirname $PERLV_PATH`:`dirname $EXPECT_PATH`:`dirname $SENDMAIL`" +ENV_PATH="$ENV_PATH:`dirname $DIRNAME`:`dirname $DIFF`:`dirname $UCBMAIL`" + AC_PATH_PROG(CVS,cvs,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_CVS`" AC_PATH_PROG(COMM,comm,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_COMM`" +AC_PATH_PROG(FIND,find,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_FIND`" +AC_PATH_PROG(GREP,grep,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_GREP`" +AC_PATH_PROG(ID,id,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_ID`" AC_PATH_PROG(MKDIR,mkdir,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_MKDIR`" -AC_PATH_PROG(DIRNAME,dirname,no) -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_DIRNAME`" +AC_PATH_PROG(RSH,rsh,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_RSH`" +AC_PATH_PROG(SORT,sort,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SORT`" +AC_PATH_PROG(SSH,ssh,no) +if test $DIFF = no; then + ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SSH`" +fi +unset ac_cv_path_SSH +AC_PATH_PROG(TELNET,telnet,no) +ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_TELNET`" AC_PATH_PROG(TOUCH,touch,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_TOUCH`" -AC_PATH_PROG(SENDMAIL,sendmail,no) -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SENDMAIL`" -AC_PATH_PROG(SORT,sort,no) -ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SORT`" ENV_PATH="$ENV_PATH:/usr/local/bin:/usr/bin" +AC_SUBST(ENV_PATH) ENV_PATH=`echo $ENV_PATH | $PERLV_PATH -e 'foreach $x(split(":",<>)){next unless (length($x));push(@F, $x),$seen{$x}=1 unless (defined $seen{$x});}print join(":",@F);'` ac_cv_env_path=$ENV_PATH AC_SUBST(ENV_PATH) -AC_OUTPUT(Makefile) +AC_OUTPUT(Makefile \ + man/Makefile man/env.5 man/lg.conf.5 man/lg_intro.1) # fix permissions on scripts. for file in $progs; do chmod a+x $file; done diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 0000000..828fa06 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,18 @@ +## Process this file with automake to produce Makefile.in +## A Makefile.in is supplied, in case you do not have automake. + +AUTOMAKE_OPTIONS=foreign no-dependencies + +@SET_MAKE@ + +man_gen_MANS = env.5 lg.conf.5 lg_intro.1 +man_nogen_MANS = do-diffs.1 clogin.1 control_rancid.1 create_cvs.1 rancid.1 \ + rancid_intro.1 cloginrc.5 router.db.5 \ + elogin.1 flogin.1 jlogin.1 \ + jrancid.1 francid.1 cat5rancid.1 erancid.1 + +man_MANS = $(man_gen_MANS) $(man_nogen_MANS) + +EXTRA_DIST = $(man_nogen_MANS) + +CLEANFILES = Makefile env.5 lg.conf.5 lg_intro.1 diff --git a/man/Makefile.in b/man/Makefile.in new file mode 100644 index 0000000..36aff3e --- /dev/null +++ b/man/Makefile.in @@ -0,0 +1,295 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +AUTOMAKE = @AUTOMAKE@ +COMM = @COMM@ +CVS = @CVS@ +DIFF = @DIFF@ +DIFF_CMD = @DIFF_CMD@ +DIRNAME = @DIRNAME@ +ENV_PATH = @ENV_PATH@ +EXPECT_PATH = @EXPECT_PATH@ +FIND = @FIND@ +GREP = @GREP@ +ID = @ID@ +INST_PROGS = @INST_PROGS@ +LG_PING_CMD = @LG_PING_CMD@ +MAILPLUS = @MAILPLUS@ +MAINT = @MAINT@ +MAKE = @MAKE@ +MAKEINFO = @MAKEINFO@ +MKDIR = @MKDIR@ +PACKAGE = @PACKAGE@ +PERLV = @PERLV@ +PERLV_PATH = @PERLV_PATH@ +PING_PATH = @PING_PATH@ +RD_BIN_DATAS = @RD_BIN_DATAS@ +RD_BIN_PROGS = @RD_BIN_PROGS@ +RD_UTIL_LG_PROGS = @RD_UTIL_LG_PROGS@ +RD_UTIL_PROGS = @RD_UTIL_PROGS@ +RSH = @RSH@ +SENDMAIL = @SENDMAIL@ +SORT = @SORT@ +SSH = @SSH@ +TAR = @TAR@ +TELNET = @TELNET@ +TOUCH = @TOUCH@ +UCBMAIL = @UCBMAIL@ +VERSION = @VERSION@ + +AUTOMAKE_OPTIONS = foreign no-dependencies + +man_gen_MANS = env.5 lg.conf.5 lg_intro.1 +man_nogen_MANS = do-diffs.1 clogin.1 control_rancid.1 create_cvs.1 rancid.1 rancid_intro.1 cloginrc.5 router.db.5 elogin.1 flogin.1 jlogin.1 jrancid.1 francid.1 cat5rancid.1 erancid.1 + + +man_MANS = $(man_gen_MANS) $(man_nogen_MANS) + +EXTRA_DIST = $(man_nogen_MANS) + +CLEANFILES = Makefile env.5 lg.conf.5 lg_intro.1 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = env.5 lg.conf.5 lg_intro.1 +man1dir = $(mandir)/man1 +man5dir = $(mandir)/man5 +MANS = $(man_MANS) + +NROFF = nroff +DIST_COMMON = Makefile.am Makefile.in env.5.in lg.conf.5.in \ +lg_intro.1.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +env.5: $(top_builddir)/config.status env.5.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +lg.conf.5: $(top_builddir)/config.status lg.conf.5.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +lg_intro.1: $(top_builddir)/config.status lg_intro.1.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +install-man1: + $(mkinstalldirs) $(DESTDIR)$(man1dir) + @list='$(man1_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ + done + +uninstall-man1: + @list='$(man1_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ + rm -f $(DESTDIR)$(man1dir)/$$inst; \ + done + +install-man5: + $(mkinstalldirs) $(DESTDIR)$(man5dir) + @list='$(man5_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.5*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \ + done + +uninstall-man5: + @list='$(man5_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.5*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \ + rm -f $(DESTDIR)$(man5dir)/$$inst; \ + done +install-man: $(MANS) + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-man1 install-man5 +uninstall-man: + @$(NORMAL_UNINSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 uninstall-man5 +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = man + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: install-man +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-man +uninstall: uninstall-am +all-am: Makefile $(MANS) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5 + + +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: install-man1 uninstall-man1 install-man5 uninstall-man5 \ +install-man uninstall-man tags distdir info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +@SET_MAKE@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/man/cat5rancid.1 b/man/cat5rancid.1 new file mode 100644 index 0000000..b4633ee --- /dev/null +++ b/man/cat5rancid.1 @@ -0,0 +1 @@ +.so man1/rancid.1 diff --git a/man/clogin.1 b/man/clogin.1 new file mode 100644 index 0000000..e40224b --- /dev/null +++ b/man/clogin.1 @@ -0,0 +1,193 @@ +.\" +.hys 50 +.TH "clogin" "1" "13 Jan 2001" +.SH NAME +clogin \- Cisco/Foundry login script +.SH SYNOPSIS +.B clogin +[\fB\-autoenable\fP] +[\fB\-noenable\fP] +[\c +.BI \-c\ +command] +[\c +.BI \-e\ +enable-password] +[\c +.BI \-f\ +cloginrc-file] +[\c +.BI \-p\ +user-password] +[\c +.BI \-s\ +script-file] +[\c +.BI \-t\ +timeout] +[\c +.BI \-u\ +username] +[\c +.BI \-v\ +vty-password] +[\c +.BI \-w\ +enable-username] +[\c +.BI \-x\ +command-file] +[\c +.BI \-y\ +ssh_cypher_type] +router +[router...] +.SH DESCRIPTION +.B clogin +is an +.BR expect (1) +script to automate the process of logging into a Cisco router, catalyst +switch, or Redback router. There are complementary scripts for Juniper, +Foundry, and ADC-kentrox EZ-T3 mux named +.B jlogin, +.B flogin, +and +.B elogin, +respectively. +.PP +.B clogin +reads the +.IR .cloginrc +file for its configuration, then connects and logins into each of the +routers specified on the command line in the order listed. Some command-line +options exist to override directives found in the +.IR .cloginrc +configuration file. +.PP +The command-line options are as follows: +.PP +.TP +.B \-c +Command to be run on each router list on the command-line. Multiple +commands maybe listed by separating them with semi-colons (;). The argument +should be quoted to avoid shell expansion. +.\" +.TP +.B \-e +Specify a password to be supplied when gaining enable privileges on the +router(s). Also see the password directive of the +.IR .cloginrc +file. +.\" +.TP +.B \-f +Specifies an alternate configuration file. The default is +.IR "$HOME/.cloginrc" . +.\" +.TP +.B \-p +Specifies a password associated with the user specified by the +.B \-u +option, user directive of the +.IR .cloginrc +file, or the Unix username of the user. +.\" +.TP +.B \-s +The filename of an +.BR expect (1) +script which will be sourced after the login is successful and is expected +to return control to +.B clogin, +with the connection to the router intact, when it is done. +.\" +.TP +.B \-t +Alters the timeout interval; the period that +.B clogin +waits for an individual command to return a prompt or the login process to +produce a prompt or failure. The argument is in seconds. +.\" +.TP +.B \-u +Specifies the username used when prompted. The command-line option overrides +any user directive found in +.IR .cloginrc . +The default is the current Unix username. +.\" +.TP +.B \-v +Specifies a vty password, that which is prompted for upon connection +to the router. This overrides the vty password of the +.IR .cloginrc +file's password directive. +.\" +.TP +.B \-w +Specifies the username used if prompted when gaining enable privileges. The +command-line option overrides any user or enauser directives found in +.IR .cloginrc . +The default is the current Unix username. +.\" +.TP +.B \-x +Similar to the +.B \-c +option; +.B \-x +specifies a file with commands to run on each of the routers. The commands +must not expect additional input, such as 'copy rcp startup-config' does. +For example: +.PP +.in +1i +.nf +show version +show logging +.fi +.in -1i +.\" +.TP +.B \-y +Specifies the encryption algorithm for use with the +.BR ssh (1) +\-c option. The default encryption type is often not supported. See the +.BR ssh (1) +man page for details. The default is 3des. +.El +.SH ENVIRONMENT +.B clogin +recognizes the following environment variables. +.PP +.TP +.B CISCO_USER +Overrides the user directive found in the +.IR .cloginrc +file, but may be overridden by the +.B \-u +option. +.\" +.TP +.B CLOGIN +.B clogin +will not change the banner on your xterm window if this includes the +character 'x'. +.\" +.TP +.B HOME +Normally set by +.BR login (1) +to the user's home directory, +HOME is used by +.B clogin +to locate the +.IR .cloginrc +configuration file. +.El +.SH FILES +.ta \w'xHOME/xcloginrc 'u +\fI$HOME/.cloginrc\fR Configuration file. +.SH "SEE ALSO" +.BR cloginrc (5), +.BR expect (1) +.SH BUGS +All these login scripts for separate devices should be rolled into one. diff --git a/man/cloginrc.5 b/man/cloginrc.5 new file mode 100644 index 0000000..9933a50 --- /dev/null +++ b/man/cloginrc.5 @@ -0,0 +1,231 @@ +.\" +.hys 50 +.TH "cloginrc" "5" "22 Jan 2001" +.SH NAME + \.cloginrc \- clogin configuration file +.SH DESCRIPTION +.B .cloginrc +contains configuration information for +.BR clogin (1), +.BR elogin (1), +.BR flogin (1), +and +.BR jlogin (1), +such as usernames, passwords, ssh encryption type, etc., and is read at +run-time. +.PP +Each line contains either white-space (blank line), a comment which begins +with the comment character '#' and may be preceded by white-space, or one +of the directives listed below. +.PP +Each line containing a directive is of the form: +.PP +.in +1i +.nf +add {} [{} ...] +.sp +or +.sp +include {} +.fi +.in -1i +.PP +As +.B .cloginrc +is searched for a directive for a hostname, it is always the first instance +of a directive, whose hostname regular expression matches the hostname, that +is used. For example; looking up the password for hostname foo in a +.B .cloginrc +file containing +.sp +.in +1i +.nf +add password * {bar} {table} +add password foo {bar} {table} +.fi +.in -1i +.sp +would return the first line, even though the second is an exact match. +.PP +.B .cloginrc +is expected to exist in the user's home directory and +must not be readable, writable, or executable by "others". +.B .cloginrc +should be +mode 0600, or 0640 if it is to be shared with other users who are members +of the same unix group. See +.BR chgrp (1) +and +.BR chmod (1) +for more information on ownership and file modes. +.PP +A sample +.B .cloginrc +file can be found in the top-level directory of the rancid distribution by the +name +.IR "cloginrc.sample" . +.SH DIRECTIVES +The accepted directives are (alphabetically): +.PP +.\" +.TP +.B add autoenable {[01]} +When using locally defined usernames or AAA, it is possible to have a login +which is automatically enabled. This is, that user has enable privileges +without the need to execute the enable command. The router's prompt is +different for enabled mode, ending with a # rather than a >. +.sp +Example: add autoenable * 1 +.sp +Default: 0 +.sp +zero, meaning that +the user is not automatically enabled and +.IR clogin +should execute the enable command to gain enable privileges, unless +negated by the noenable directive or \-noenable command\-line option. +.\" +.TP +.B add cyphertype {} +cyphertype defines which encryption algorithm is used with ssh. A device +may not support the type ssh uses by default. See +.BR ssh (1)'s\c + \-c option for details. +.sp +Default: {3des} +.\" +.TP +.B add enableprompt {""} +When using AAA with a Cisco router or switch, it is possible to redefine the +prompt the device presents to the user for the enable password. enableprompt +may be used to adjust the prompt that +.IR clogin +should look for when trying to login. Note that enableprompt can be a Tcl +style regular expression. +.sp +Example: add enableprompt rc*.example.net {"\\[Ee]nter the enable password:"} +.sp +Default: "\\[Pp]assword:" +.\" +.TP +.B add enauser {} +This is only needed if a device prompts for a username when gaining +enable privileges and where this username is different from that defined +by or the default of the user directive. +.\" +.TP +.B add identity {} +May be used to specify an alternate identity file for use with ssh(1). +See ssh's \-i option for details. +.sp +Default: your default identity file. see ssh(1). +.\" +.TP +.B add method {ssh} [{...}] +Defines, in order, the connection methods to use for a device from the +set {ssh, telnet, rsh}. +.sp +Example: add method * {ssh} {telnet} {rsh} +.sp +Which would cause +.IR clogin +to first attempt an ssh connection to the device and if that were to +fail with connection refused, a telnet connection would be tried, and +then rsh. +.sp +Default: {telnet} {ssh} +.\" +.TP +.B add noenable +.IR clogin +will not try to gain enable privileges when noenable is matched for a +device. This is equivalent to +.IR "clogin" 's +-noenable command-line option. This does not apply to +.BR jlogin (1). +.\" +.TP +.B add passprompt {""} +When using AAA with a Cisco router or switch, it is possible to redefine the +prompt the device presents to the user for the password. passprompt may be +used to adjust the prompt that +.IR clogin +should look for when trying to login. Note that passprompt can be a Tcl +style regular expression. +.sp +Example: add passprompt rc*.example.net {"\\[Ee]nter the password:"} +.sp +Default: "(\\[Pp]assword|passwd):" +.\" +.TP +.B add password {} [{}] +Specifies a vty password, that which is prompted for upon the connection +to the router. The last argument is the enable password and need not be +specified if the device also has a matching noenable or autoenable +directive or the corresponding command-line options are used. +.\" +.\" .TP +.\" .B add rc {} +.\" rc is used to specifies a command that will be run by +.\" .IR clogin +.\" immediately after logging into the device. Multiple commands may be +.\" specified by separating them with semi-colons (;). The command must +.\" not be one which expects additional input from the user, such as 'copy +.\" rcp startup-config' on a Cisco. +.\" .sp +.\" Example: add rc *.domain.net {terminal monitor;show version} +.\" +.TP +.B add user {} +Specifies a username +.IR clogin +should use if or when prompted for one. +.sp +Default: $USER, ie: your Unix username. +.\" +.TP +.B add userpassword {} +Specifies a password to be associated with a user, if different from that +defined with the password directive. +.\" +.TP +.B add userprompt {""} +When using AAA with a Cisco router or switch, it is possible to redefine the +prompt the device presents to the user for the username. userprompt may be +used to adjust the prompt that +.IR clogin +should look for when trying to login. Note that userprompt can be a Tcl +style regular expression. +.sp +Example: add userprompt rc*.example.net {"\\[Ee]nter your username:"} +.sp +Default: "(Username|login|user name):" +.\" +.TP +.B include {} + is the pathname of an additional +.B .cloginrc +file to include at that point. It is evaluated immediately. That is +important with regard to the order of matching hostnames for a given +directive, as mentioned above. This is useful if you have your own +.B .cloginrc +plus an additional +.B .cloginrc +file that is shared among a group of folks. +.sp +If is not a full pathname, $HOME/ will be prepended. +.sp +Example: include {.cloginrc.group} +.El +.SH FILES +.br +.nf +.\" set tabstop to longest possible filename, plus a wee bit +.ta \w'xHOME/xcloginrc 'u +\fI$HOME/.cloginrc\fR Configuration file described here. +.SH ERRORS +.B .cloginrc +is interpreted directly by Tcl, so its syntax follows that of Tcl. Errors +may produce quite unexpected results. +.SH "SEE ALSO" +.BR clogin (1) diff --git a/man/control_rancid.1 b/man/control_rancid.1 new file mode 100644 index 0000000..b5b31c4 --- /dev/null +++ b/man/control_rancid.1 @@ -0,0 +1,26 @@ +.\" +.hys 50 +.TH "control_rancid" "1" "22 Jan 2001" +.SH NAME +control_rancid \- run rancid for devices of a group +.SH SYNOPSIS +.B create_cvs +group +.SH DESCRIPTION +.B control_rancid +is a +.IR sh (1) +script to parse a group's +.BR router.db (5), +run rancid for each of the devices, possibly re-run rancid for missed devices, +e-mail diffs, and e-mail error reports. +.\" +.PP +.B control_rancid +is normally (and best) run via +.BR do-diffs (1). +.\" +.SH SEE ALSO +.BR do-diffs (1), +.BR env (5), +.BR router.db (5) diff --git a/man/create_cvs.1 b/man/create_cvs.1 new file mode 100644 index 0000000..353e92b --- /dev/null +++ b/man/create_cvs.1 @@ -0,0 +1,53 @@ +.\" +.hys 50 +.TH "create_cvs" "1" "13 Jan 2001" +.SH NAME +create_cvs \- initialize CVS and rancid group files and directories +.SH SYNOPSIS +.B create_cvs +[group [group ...]] +.SH DESCRIPTION +.B create_cvs +is a +.IR sh (1) +script to create the directories, +.BR router.db (5), +and +.BR cvs (1) +directories necessary for a rancid group. +.\" +.PP +.B create_cvs +reads +.BR env (5) +to configure itself. Then proceeds with the initialization first of the +.BR cvs (1) +repository, if necessary, and then for each of the rancid groups listed on +the command-line or those in the variable +.I LIST_OF_GROUPS +from +.BR env (5), +if the argument is omitted. +.\" +.PP +Running +.B create_cvs +for groups which already exist will not cause problems. If the group's +directory already exists, the +.BR cvs (1) +import will be skipped, and if it's +.BR router.db (5) +already exists, it will be left as-is. +.\" +.PP +The best method for adding groups is add the group name to +.I LIST_OF_GROUPS +in +.BR env (5), +then run +.B create_cvs. +.\" +.SH SEE ALSO +.BR cvs (1), +.BR env (5), +.BR router.db (5) diff --git a/man/do-diffs.1 b/man/do-diffs.1 new file mode 100644 index 0000000..cb42bb5 --- /dev/null +++ b/man/do-diffs.1 @@ -0,0 +1,95 @@ +.\" +.hys 50 +.TH "do-diffs" "1" "13 Jan 2001" +.SH NAME +do-diffs \- run rancid for each of the groups +.SH SYNOPSIS +.B do-diffs +[group [group ...]] +.SH DESCRIPTION +.B do-diffs +is a +.IR sh (1) +script to run +.IR rancid (1) +for a set of rancid group(s). +.PP +.B do-diffs +reads +.BR env (5) +to configure itself, then uses +.IR control_rancid (1) +to run +.IR rancid (1) +for each rancid group. The set of rancid groups can either be provided +as command-line arguments or via the +.I LIST_OF_GROUPS +variable in +.BR env (5), +if the group argument is omitted. +.PP +A lock file is maintained per-group to prevent simultaneous runs for a given +group by +.IR do-diffs (1). +The lock file will be named +.IR ..run.lock +and will be located in +.IR $TMPDIR +(see below). +.PP +A log file is produced under +.IR $BASEDIR/logs +for each rancid group processed. The file name will be .YYYYMMDD.HHMMSS +(year month day . hour minute second). +.PP +.B do-diffs +is normally used to run rancid from +.BR cron (8). +For example: +.PP +.in +1i +.nf +0 * * * * /usr/local/rancid/bin/do-diffs +.fi +.in -1i +.\" +.SH ENVIRONMENT +.B do-diffs +utilizes the following environment variables from +.BR env (5). +.\" +.TP +.B BASEDIR +Location of group directories, etc. +.\" +.TP +.B LIST_OF_GROUPS +List of rancid groups to collect. +.\" +.TP +.B PATH +Search path for utilities. +.\" +.TP +.B TMPDIR +Directory to hold temporary and lock files. +.SH ERRORS +If rancid fails to run or collect a device's configuration, the particular +group's log file (mentioned above) should be consulted. Any errors produced +by +.BR cvs (1) +or any of the rancid scripts should be included, whether they be a botched +cvs tree, login authentication failure, rancid configuration error, etc. If +the log file produces no clues, the next debugging step should be run the +commands manually. For example, can the user who runs rancid login to the +device with 'clogin hostname', and so on. +.BR +.SH FILES +.TP +.B $BASEDIR/bin/env +.B do-diffs +configuration file. +.El +.SH SEE ALSO +.BR control_rancid (1), +.BR env (5) diff --git a/man/elogin.1 b/man/elogin.1 new file mode 100644 index 0000000..4c83247 --- /dev/null +++ b/man/elogin.1 @@ -0,0 +1 @@ +.so man1/clogin.1 diff --git a/man/env.5.in b/man/env.5.in new file mode 100644 index 0000000..f12acdc --- /dev/null +++ b/man/env.5.in @@ -0,0 +1,154 @@ +.\" +.hys 50 +.TH "env" "5" "22 Jan 2001" +.SH NAME +env \- rancid environment configuration file +.SH DESCRIPTION +.B env +contains environment configuration information for +.BR do-diffs (1) +and +.BR rancid (1) +including shell PATH, list of rancid groups, etc. and is read by +.BR do-diffs (1) +at run-time. +.PP +The syntax of +.B env +is that of +.IR sh (1). +.B env +is used to set environment variables used by other rancid scripts to +effect their run-time behavior or to enable them to find their resources. +.PP +.SH VARIABLES +The following variables are used (alphabetically): +.PP +.Bl -tag -width flag +.\" +.TP +.B BASEDIR +BASEDIR is the top-level directory where rancid is installed. Its value +is set by configure and should be modified if rancid is moved to a new +location in the file system without re-installing from the distribution. +.sp +Default: @prefix@ +.\" +.TP +.B CVSROOT +.IR cvs (1) +and +.IR create_cvs (1) +use this environment variable to locate the CVS repository. It should +not be necessary to alter CVSROOT. +.sp +Default: $BASEDIR/CVS +.\" +.TP +.B LIST_OF_GROUPS +Defines a list of group names of routers separated by white-space. These +names become the directory names in $BASEDIR which contain the data +for that set of devices. +.BR do-diffs (1) +also uses this variable to determine which device groups it should collect. +Choose these names to be descriptive of the set of devices and do not use +spaces, unprintable characters, etc. +.sp +Example: LIST_OF_GROUPS="UofO USFS" +.sp +Two groups are defined; UofO (University of Oregon) and USFS (US Forest +Service). Each will have a directory created (see +.IR create_cvs (1)) +$BASEDIR/UofO and $BASEDIR/USFS respectively, which will contain their data. +.sp +Each group must also have aliases for the administrative and diff recipients +set-up in +.IR /etc/aliases . +For example: +.sp +.in +1i +.nf +@MAILPLUS@uofo: frank +@MAILPLUS@admin-uofo: joe,bob +@MAILPLUS@usfs: frank +@MAILPLUS@admin-usfs: joe,bob +.fi +.sp +.in -1i +.\" +.TP +.B NOCOMMSTR +If set, +.IR rancid (1) +will filter SNMP community strings from configs. Otherwise, they will +be retained and may appear in clear-text in e-mail diffs. By default, +this is not set. +.\" +.TP +.B NOPIPE +If set, +.IR rancid (1) +will use temporary files to save the output from the router and then read +these to build the file which will be saved in CVS. Otherwise, an IPC +pipe will be used. We have found that the buffering mechanisms used in +perl and expect are heinous. Using temporary files may result in a noticeable +improvement in speed. By default, this is not set. +.\" +.TP +.B OLDTIME +Specified as a number of hours, OLDTIME defines how many hours should pass +since a successful collection of a device's configuration and when +.IR control_rancid (1) +should start complaining about failures. +.sp +Default: 4 +.\" +.TP +.B PATH +Is a colon separate list of directory pathnames in the the file system +where rancid's +.IR sh (1) +and +.IR perl (1) +scripts should look for the programs that it needs, such as +.IR telnet (1). +Its value is set by configure. Should it be necessary to modify PATH, +note that it must include $BASEDIR/bin (see above). +.\" +.TP +.B TERM +Some Unix utilities require TERM, the terminal type, to be set to a sane +value. The default should suffice. +.sp +Default: network +.\" +.TP +.B TMPDIR +Some Unix utilities recognize TMPDIR as a directory where temporary files +can be stored. In some cases, rancid utilizes this directory for lock +files and other temporary files. +.sp +Default: /tmp +.\" +.PP +Each of these are simply environment variables. In order for them to be +present in the environment of child processes, each must be exported. See +.IR sh (1) +for more information on the built-in command export. +.SH ERRORS +.B env +is interpreted directly by +.IR sh (1), +so its syntax follows that of the bourne shell. Errors +may produce quite unexpected results. +.SH FILES +.Bl -tag -width .BASEDIR/bin/ENV -compact +.TP +.B $BASEDIR/bin/env +Configuration file described here. +.El +.SH SEE ALSO +.BR control_rancid (1), +.BR create_cvs (1), +.BR do-diffs (1), +.BR rancid (1) diff --git a/man/erancid.1 b/man/erancid.1 new file mode 100644 index 0000000..b4633ee --- /dev/null +++ b/man/erancid.1 @@ -0,0 +1 @@ +.so man1/rancid.1 diff --git a/man/flogin.1 b/man/flogin.1 new file mode 100644 index 0000000..4c83247 --- /dev/null +++ b/man/flogin.1 @@ -0,0 +1 @@ +.so man1/clogin.1 diff --git a/man/francid.1 b/man/francid.1 new file mode 100644 index 0000000..b4633ee --- /dev/null +++ b/man/francid.1 @@ -0,0 +1 @@ +.so man1/rancid.1 diff --git a/man/jlogin.1 b/man/jlogin.1 new file mode 100644 index 0000000..4c83247 --- /dev/null +++ b/man/jlogin.1 @@ -0,0 +1 @@ +.so man1/clogin.1 diff --git a/man/jrancid.1 b/man/jrancid.1 new file mode 100644 index 0000000..b4633ee --- /dev/null +++ b/man/jrancid.1 @@ -0,0 +1 @@ +.so man1/rancid.1 diff --git a/man/lg.conf.5.in b/man/lg.conf.5.in new file mode 100644 index 0000000..fe7bdc7 --- /dev/null +++ b/man/lg.conf.5.in @@ -0,0 +1,129 @@ +.\" +.hys 50 +.TH "lg.conf" "5" "22 Jan 2001" +.SH NAME +lg.conf \- looking glass configuration file +.SH DESCRIPTION +.B lg.conf +contains configuration for the looking glass scripts. +.PP +The syntax is that of +.IR perl (1). +It is used to set variables to affect run-time behavior or to locate resources. +.\" +.SH VARIABLES +The following variables are used (alphabetically): +.Bl -tag -width flag +.\" +.TP +.B LG_AS_REG +*** not implemented. +.\" +.TP +.B LG_CACHE_DIR +Sets the location of the cache directory. The looking glass uses this +to hold lock files, log files, and output from cached commands. +.sp +Default: ./tmp +.sp +Note that the default is relative to the directory where +.IR lg.cgi +runs in the server's document root (eg: /usr/local/www/data/lg/tmp). +.\" +.TP +.B LG_CACHE_TIME +Sets the number of seconds that the looking glass should cache output from +commands that tend to produce a lot of output, such as 'show ip bgp +dampened-paths'. +.sp +Default: 600 +.\" +.TP +.B LG_CLOGINRC +Defines the +.BR cloginrc (5) +that the looking glass should use. The path may be relative to the directory +where the CGI scripts run in the server's document root. +.sp +Default: @prefix@/.cloginrc +.sp +Note that the .cloginrc must be readable by the user or group that will be +running the CGI and that +.BR clogin (1) +will not allow a world readable +.IR .cloginrc . +The user is normally that of the http server (httpd). +.\" +.TP +.B LG_IMAGE +Defines a html image tag () which, if defined, will be included at +the top of the looking glass pages. It may contain any html as it is +simply handed off to print(). +.sp +Example: $LG_IMAGE="\n FOO"; +.\" +.TP +.B LG_LOG +Defines the fully qualified path name for the log file or the +.BR syslog (3) +facility to use for logging. For syslog, the argument is the lowercase name +of a syslog facility (see syslog.h) without the 'LOG_' prefix. +.sp +Example: local0 +.sp +Default: $LG_CACHE_DIR/lg.log +.\" +.TP +.B LG_ROUTERDB +Sets the location for the +.IR router.db +file in rancid's +.BR router.db (5) +format. It lists the devices that should be available to the looking glass +users. Only those devices of supported types and with status 'up' are made +available. If not defined and the default file does not exist, the looking +glass will compile a list from the router.db files of all the groups present +in rancid, that is a concatenation of $BASEDIR/*/router.db. +.sp +Default: @prefix@/util/lg/router.db +.sp +Note that if the concatenation method is used, it may be necessary to alter +the mode of the router.db files in the rancid group directories, since the +default umask is 027 (see +.BR env (5)). +.\" +.TP +.B LG_SINGLE +*** not implemented. +.\" +.TP +.B PATH +Is a colon separate list of directory pathnames in the the file system +where rancid's login scripts, +.IR clogin (1) +etc. ) +and programs needed within these, such as +.IR telnet (1), +are located. +Its value is set by configure. Should it be necessary to modify PATH, +note that it must include $BASEDIR/bin (see above). +.\" +.El +.\" +.SH ERRORS +.B lg.conf +is interpreted directly by +.IR perl (1), +so its syntax follows that of perl. Errors may produce quite unexpected +results. +.SH FILES +.Bl -tag -width .BASEDIR/bin/ENV -compact +.TP +.B $BASEDIR/util/lg/lg.conf +Configuration file described here, where $BASEDIR is set at the time that +the rancid package was configured. In this case, $BASEDIR is +.IR @prefix@ . +.El +.SH SEE ALSO +.BR cloginrc (5), +.BR lg_intro (1) diff --git a/man/lg_intro.1.in b/man/lg_intro.1.in new file mode 100644 index 0000000..1af8942 --- /dev/null +++ b/man/lg_intro.1.in @@ -0,0 +1,64 @@ +.\" +.hys 50 +.TH "lg_intro" "1" "24 Jan 2001" +.SH NAME +lg_intro \- introduction to the looking glass +.\" +.SH INTRODUCTION +The +.B looking glass +offers a web based interface to routers to users without their needing +permission to login to the router. This may be a perfect interface for customer +support or less savvy folks, and many ISPs have given public access to such +an interface as a "route server." +.\" +.SH DESCRIPTION +The looking glass consists of two CGI +.BR perl (1) +scripts, +.IR lg.cgi +and +.IR lg.form.cgi , +and the +.BR lg.conf (5) +configuration file. +.PP +Both of these scripts begin with reading the configuration file. If +there is an error in the file's syntax or if the file can not be found, error +messages will be displayed on standard-error. The Apache http server +redirects standard-error to its error log file by default. +.PP +lg.form.cgi displays a html form consisting of a list of possible +router commands that can be run and a scrolling list of routers that +these commands may be run on. When the form is submitted, lg.cgi is +run. +.PP +When lg.cgi is run, it begins by performing some basic checks on the +arguments passed to it. If these checks pass, lg.cgi either displays +cached data from a previous invocation if that data exists and is +within the cache interval or uses +.BR clogin (1) +to login to the device and execute the command. The +results of the command are cached if applicable and displayed for the +user. +.\" +.SH "GETTING STARTED" +Besides +.BR lg.conf (5), +additional instructions for setting up the looking glass can be found +in the README file under +.IR @prefix@/util/lg . +.PP +Note that the looking glass scripts require a few perl modules not +included with rancid. Rancid's configure process does not check for +these. See the README file. +.\" +.SH "SEE ALSO" +.BR cloginrc (5), +.BR clogin (1), +.BR lg.conf (5) +.SH HISTORY +Rancid's looking glass is based on Ed Kern's (included by permission, +thanks Ed!), which can be found on http://nitrous.digex.net/. Support +for Junipers, rancid's device login scripts, and additional commands have +been added to the original. diff --git a/man/rancid.1 b/man/rancid.1 new file mode 100644 index 0000000..dd860df --- /dev/null +++ b/man/rancid.1 @@ -0,0 +1,55 @@ +.\" +.hys 50 +.TH "rancid" "1" "13 Jan 2001" +.SH NAME +rancid \- Cisco configuration filter +.SH SYNOPSIS +.B rancid +[\fB\-dl\fP] +([\c +.BI \-f\ \c +filename]\ \c +| hostname) +.SH DESCRIPTION +.B rancid +is a +.BR perl (1) +script which uses +.BR clogin (1) +to login to a Cisco router, execute commands to display +the configuration, etc, then filters the output for formatting, security, +and so on. +.B rancid's +product is a file with the name of it's last argument plus the suffix .new. +For example, hostname.new. +.PP +There are complementary scripts for Cisco catalyst switch, Juniper, Foundry, +and ADC-kentrox EZ-T3 mux named +.B cat5rancid, +.B jrancid, +.B francid, +and +.B erancid, +respectively. +.PP +The command-line options are as follows: +.TP +.B \-d +Display debugging information. +.\" +.TP +.B \-l +Display somewhat less debugging information. +.\" +.TP +.B \-f +.B rancid +should interpret the next argument as a filename which contains the +output it would normally collect from the device ( +.I hostname\c +) with +.IR clogin (1). +.SH "SEE ALSO" +.BR control_rancid (1), +.BR clogin (1), +.BR env (5) diff --git a/man/rancid_intro.1 b/man/rancid_intro.1 new file mode 100644 index 0000000..3d866c1 --- /dev/null +++ b/man/rancid_intro.1 @@ -0,0 +1,113 @@ +.\" +.hys 50 +.TH "rancid_intro" "1" "22 Jan 2001" +.SH NAME +rancid_intro \- introduction to the Really Awesome New Cisco confIg Differ +.SH INTRODUCTION +.B rancid +is really more than just a Cisco configuration differ. It handles several +different device's configurations; currently including Cisco, Foundry, +Juniper, Redback, and the ADC-Kentrox EZ-T3 mux. +.PP +.B rancid +uses an expect script to login to a list of devices and run a set of +commands for that device-type and collects the output. The output +is run through some filtering to summarize, reformat, and/or snip +unwanted or security related data such as temperature and easily reverse-able +passwords. +.PP +Named after the device's name in the group's configuration file, the +resulting files are saved in the directory /configs. Except for the +data filtered from the configuration file for security reasons, such as +reversable passwords, these files are suitable for loading directly to restore +a lost configuration. See +.BR env (5) +for more information on 's. +.PP +After filtering, a uni-diff (see diff(1)) of the result is produced +for each of the devices in a group against that of the previous run of +.B rancid +and is e-mailed to that group's mail list, "rancid-". This e-mail +will also include any differences of the device list in the group's +configuration file, +.IR "router.db". +.PP +Lastly, all the updated files are checked into the CVS repository. +.PP +Additional utilities, including a looking glass, can be found under +the util sub-directory. +.SH "EXAMPLE E-MAIL" +Below is a sample of a uni-diff produced from the group "shrubbery" +for the device named dfw.shrubbery.net, which happens to be a Cisco GSR. +.PP +.nf +From: rancid +To: rancid-shrubbery@shrubbery.net +Subject: shrubbery router config diffs +Precedence: bulk + +Index: configs/dfw.shrubbery.net +=================================================================== +retrieving revision 1.144 +diff -u -4 -r1.144 dfw.shrubbery.net +@@ -57,14 +57,8 @@ + !Slot 2/MBUS: hvers 1.1 + !Slot 2/MBUS: software 01.36 (RAM) (ROM version is 01.33) + !Slot 2/MBUS: 128 Mbytes DRAM, 16384 Kbytes SDRAM + ! +- !Slot 6: 1 Port Gigabit Ethernet +- !Slot 6/PCA: part 73-3302-03 rev C0 ver 3, serial CAB031216OL +- !Slot 6/PCA: hvers 1.1 +- !Slot 6/MBUS: part 73-2146-07 rev B0 dev 0, serial CAB031112SB +- !Slot 6/MBUS: hvers 1.2 +- !Slot 6/MBUS: software 01.36 (RAM) (ROM version is 01.33) + !Slot 7: Route Processor + !Slot 7/PCA: part 73-2170-03 rev B0 ver 3, serial CAB024901SI + !Slot 7/PCA: hvers 1.4 + !Slot 7/MBUS: part 73-2146-06 rev A0 dev 0, serial CAB02060044 +.fi +.PP +In this example, we see that a Gigabit Ethernet linecard was removed +from slot 6. Since this data is collected from "show" commands on the +router, it could just as easily be that the card crashed so the RP +can not communicate with it to collect information. +.SH "GETTING STARTED" +Installation instructions are included in the distribution's top-level +directory in the README file. Once the installation is complete, start +by reading the man pages listed below or follow the basic instructions +included in the README file. +.PP +See http://www.shrubbery.net/rancid for information on new versions, +mail lists, etc. +.B rancid +can be retrieved from ftp://ftp.shrubbery.net/pub/rancid. +.SH "ADDING NEW GROUPS" +Follow this procdure for adding new groups: +.TP +o +Update the +.IR LIST_OF_GROUPS +variable in +.IR bin/env +(see +.BR env (5)). +.TP +o +Run +.BR create_cvs (1). +.TP +o +Update the system's mail aliases file +.IR /etc/aliases ( +see +.BR env (5)). +.\" +.SH "SEE ALSO" +.BR cloginrc (5), +.BR clogin (1), +.BR control_rancid (1), +.BR env (5), +.BR do-diffs (1), +.BR lg_intro (1), +.BR router.db (5) , +.BR rancid (1) diff --git a/man/router.db.5 b/man/router.db.5 new file mode 100644 index 0000000..b51153b --- /dev/null +++ b/man/router.db.5 @@ -0,0 +1,106 @@ +.\" +.hys 50 +.TH "router.db" "5" "22 Jan 2001" +.SH NAME +router.db \- rancid group configuration file +.SH DESCRIPTION +.B router.db +contains information for devices which are members of a rancid group. +.IR control_rancid (1) +reads this file to compile a list of devices which it should collect. +.\" +.SH SYNTAX +One device is listed per-line, where the syntax is: +.PP +.in +1i +.nf +::[:] +.fi +.in -1i +.PP +For example: +.in +1i +.nf +scooby.shrubbery.net:cisco:up +.fi +.in -1i +.PP +.\" +The fields are as follows: +.TP +.B +The name of the device, which must resolve via +.I gethostbyname\c +, used as the argument to +.IR telnet (1), +.IR rsh (1), +or +.IR ssh (1), +to connect to the device. Once converted to lower-case, this +also becomes the name of the file used to store the configuration under +\fI$BASEDIR//configs\fR. +.sp +Experience has shown that using the device's FQDN (Fully Qualified +Domain Name) works best, as in the example above. +.\" +.TP +.B +The type of device from the set: +.RS 8n +.TP +.B cat5 +A cisco catalyst switch (ie: running the catalyst OS, not IOS). +.TP +.B cisco +A cisco router or switch such as the 3500XL or 6000 running IOS (or IOS-like) +OS. +.TP +.B ezt3 +An ADC-Kentrox EZ-T3 mux. +.TP +.B foundry +A Foundry router, switch, or router-switch. +.TP +.B juniper +A Juniper router. +.TP +.ID 15n +.B redback +A Redback router, NAS, etc. +.RE +.\" +.TP +.B +The state is either "up" or "down". If the device is marked "down", the +device's +configuration will not be collected. +.PP +A ``#'' at the begining of a line is a comment; the entire line is +ignored. +.PP +If you delete a device from the +.B router.db +file, then +.B rancid +will clean up by removing the device's config file from +\fI$BASEDIR//configs\fR. +The +.IR cvs (1) +information for the device will be moved to +.IR cvs (1)'s +Attic directory (using +.IR "cvs delete"). +.PP +.SH FILES +.ta \w'xBASEDIR//router.db 'u +.TP +.B $BASEDIR//router.db +Configuration file described here, where is a device group name +defined in the variable +.I LIST_OF_GROUPS +within \fI$BASEDIR/bin/env\fR. +.El +.SH SEE ALSO +.BR control_rancid (1), +.BR env (5), +.BR rancid (1) diff --git a/util/Makefile.in b/util/Makefile.in index 2432c26..511cb7f 100644 --- a/util/Makefile.in +++ b/util/Makefile.in @@ -17,11 +17,13 @@ install: all cd lg; $(MAKE) -e install clean: - cd lg; $(MAKE) -e clean; \ + @if [ -f util/Makefile ] ; then \ + cd lg; $(MAKE) -e clean; \ + fi rm -f Makefile $(UTIL_PROGS) distclean: clean - cd lg; $(MAKE) -e distclean; \ + cd lg; $(MAKE) -e distclean; rm -f config.log config.status distdir: diff --git a/util/lg/README b/util/lg/README index f574278..b4186b9 100644 --- a/util/lg/README +++ b/util/lg/README @@ -12,7 +12,7 @@ index.html often the default document the server will load, contains lg.conf looking glass configuration file lg.cgi work horse of the looking glass lgform.cgi front-end form for the looking glass engine -lgnotes.html manual for the looking glass +lgnotes.html user info for the looking glass the looking glass requires the CGI and LockFile-Simple perl modules. these can be retrieved from CPAN, http://www.cpan.org/. CGI's home is @@ -43,6 +43,16 @@ and install bits in /usr/local/rancid/util/lg (or /util/lg). % cat /usr/local/www/data/lg/.htaccess Options FollowSymLinks ExecCGI + note on index.html: index.html is typically the default file loaded + when a url ends with a '/'. index.html can be used to redirect this + to lgform.cgi using a netscape meta refresh. Though this is supported + by many browsers, it is supposedly netscape specific and non-standard. + In apache, the same thing can be acheived by altering the default + directory index like this: + + % cat /usr/local/www/data/lg/.htaccess + DirectoryIndex lgform.cgi + 2) the LG needs to be able to find and read lg.conf. by default this is installed as /util/lg/lg.conf and the LG will look there. however, LG_CONF environment variable can be used to move it elsewhere. diff --git a/util/lg/lg.cgi.in b/util/lg/lg.cgi.in index 0320b7d..0900060 100755 --- a/util/lg/lg.cgi.in +++ b/util/lg/lg.cgi.in @@ -378,7 +378,7 @@ if ($type eq "prefix" || $type eq "mbgp" || $type eq "route" ) { # don't show the jewels &print_results if ($arg == 98 || $arg == 99); } elsif ($type eq "prefixlist" || $type eq "routemap") { - if ($arg[0] !~ /^[A-Za-z][^\s\"]*$/) { + if ($arg[0] !~ /^[0-9A-Za-z][^\s\"]*$/) { $results[0] = "That argument ($arg[0]) is not valid.\n"; &print_results; } diff --git a/util/lg/lgnotes.html b/util/lg/lgnotes.html index 5fa2336..44fb4e0 100644 --- a/util/lg/lgnotes.html +++ b/util/lg/lgnotes.html @@ -20,16 +20,14 @@ Ed Kern's looking glass. See the "real thing" at

    -
  • Items in the queries column which do not have radio buttons - are not yet implemented but are on the list of things to do.
  • Some items are not implemented for the junipers yet (so, as i get - to it) or no equivalent exists. + to it) or no equivalent command exists.
  • If there is something which you feel is missing, feel free to ask - and/or send comments to the maintainer - to implement it. No guarantees.
  • + and/or send comments to + rancid@shrubbery.net. No guarantees.
  • Only one query per router allowed at any given time. This is to avoid - resource deprivation. The looking glass will attempt to serialize - queries.
  • + resource deprivation on the looking glass host or the router. The + looking glass will attempt to serialize queries.
  • The looking glass will ping a router prior to querying it to avoid trying to query routers which are down or otherwise inaccessible.
  • Login failures can be intermittent or permanent, either due to the -- cgit