├── .gitignore
├── BUGS
├── CHANGES
├── COPYING
├── FAQ
├── HOLD
├── Makefile.am
├── Makefile.in
├── README
├── README.lg
├── README.md
├── Todo
├── UPGRADING
├── acinclude.m4
├── aclocal.m4
├── bin
├── Makefile.am
├── Makefile.in
├── a10login.in
├── agmrancid.in
├── alogin.in
├── anlogin.in
├── arancid.in
├── avologin.in
├── blogin.in
├── brancid.in
├── brlogin.in
├── cat5rancid.in
├── clogin.in
├── control_rancid.in
├── csblogin.in
├── cssrancid.in
├── dllogin.in
├── elogin.in
├── erancid.in
├── f5rancid.in
├── flogin.in
├── fnlogin.in
├── fxlogin.in
├── hlogin.in
├── hpuifilter.c
├── hrancid.in
├── htlogin.in
├── htrancid.in
├── jerancid.in
├── jlogin.in
├── lg.cgi.in
├── lgform.cgi.in
├── login_top.in
├── mrancid.in
├── mrvlogin.in
├── mtlogin.in
├── nlogin.in
├── noklogin.in
├── nrancid.in
├── nslogin.in
├── nsrancid.in
├── oglogin.in
├── ograncid.in
├── panlogin.in
├── par.c
├── plogin.in
├── rancid-cvs.in
├── rancid-fe.in
├── rancid-run.in
├── rancid.in
├── rblogin.in
├── rivlogin.in
├── rivrancid.in
├── rrancid.in
├── rtftpcopy.in
├── tlogin.in
├── trancid.in
├── ulogin.in
├── wlogin.in
├── xilogin.in
├── xirancid.in
└── xlogin.in
├── cloginrc.sample
├── compile
├── configure
├── configure.ac
├── configure.regen
├── configure.vers
├── depcomp
├── etc
├── Makefile.am
├── Makefile.in
├── lg.conf.sample.in
├── rancid.conf.sample.in
├── rancid.types.base
├── rancid.types.base.powerconnect
└── rancid.types.conf
├── include
├── Makefile.am
├── Makefile.in
├── config.h.in
├── stamp-h.in
└── version.h.in
├── install-sh
├── lib
├── Makefile.am
├── Makefile.in
├── acos.pm.in
├── adtran.pm.in
├── aeos.pm.in
├── arbor.pm.in
├── arcos.pm.in
├── avocent.pm.in
├── bigip.pm.in
├── ciscowlc.pm.in
├── dell.pm.in
├── dnos10.pm.in
├── dnos9.pm.in
├── edgemax.pm.in
├── edgerouter.pm.in
├── exos.pm.in
├── fortigate.pm.in
├── foundry.pm.in
├── frr.pm.in
├── fss2.pm.in
├── fxos.pm.in
├── ios.pm.in
├── iossb.pm.in
├── iosshtech.pm.in
├── iosxr.pm.in
├── junos.pm.in
├── mrv.pm.in
├── nxos.pm.in
├── panos.pm.in
├── rancid.pm.in
├── rancid.py.in
├── rancidcontrib.pm.in
├── rbt.pm.in
├── routeros.pm.in
├── smc.pm.in
├── sros.pm.in
├── vrp.pm.in
└── wavesvros.pm.in
├── man
├── Makefile.am
├── Makefile.in
├── a10login.1
├── agmrancid.1
├── alogin.1
├── anlogin.1
├── arancid.1
├── avologin.1
├── blogin.1
├── brancid.1
├── brlogin.1
├── cat5rancid.1
├── clogin.1
├── cloginrc.5.in
├── control_rancid.1
├── csblogin.1
├── cssrancid.1
├── dllogin.1
├── elogin.1
├── erancid.1
├── f10rancid.1
├── f5rancid.1
├── flogin.1
├── fnlogin.1
├── fxlogin.1
├── hlogin.1
├── hrancid.1
├── htlogin.1
├── htrancid.1
├── jerancid.1
├── jlogin.1
├── lg.conf.5.in
├── lg_intro.7.in
├── mrancid.1
├── mrvlogin.1
├── mtlogin.1
├── mtrancid.1
├── nlogin.1
├── noklogin.1
├── nrancid.1
├── nslogin.1
├── nsrancid.1
├── panlogin.1
├── par.1
├── plogin.1
├── rancid-cvs.1
├── rancid-run.1
├── rancid.1
├── rancid.3.in
├── rancid.conf.5.in
├── rancid.types.base.5
├── rancid.types.conf.5.in
├── rancid_intro.7
├── rancidcontrib.3
├── rblogin.1
├── rivlogin.1
├── rivrancid.1
├── router.db.5
├── rrancid.1
├── srancid.1
├── tlogin.1
├── trancid.1
├── ulogin.1
├── wlogin.1
├── xilogin.1
├── xirancid.1
└── xlogin.1
├── missing
├── mkinstalldirs
├── presentations
├── nanog29.mgp
└── networkcomputing.pdf
├── share
├── Makefile.am
├── Makefile.in
├── README.misc
├── cisco-load.exp
├── cisco-reload.exp
├── contrib
│ ├── alcatel
│ │ ├── README
│ │ ├── ologin.in
│ │ └── orancid.in
│ ├── dell
│ │ └── drancid.patch
│ ├── pfsense
│ │ ├── m0n0login
│ │ ├── m0n0rancid
│ │ └── rancid-fe
│ └── rancid
│ │ └── cisco_l2tp_class
│ │ └── README
├── downreport.in
├── getipacctg
├── index.html
├── lgnotes.html
├── rancid-cvspurge.in
├── rancid.spec
└── rtrfilter.in
└── tests
├── par.a.in
├── par.a.out
├── par.ab.out
├── par.b.in
├── par.b.out
├── par.c.in
├── par.c.out
└── partest
/.gitignore:
--------------------------------------------------------------------------------
1 | # Mac OS X Finder cache files
2 | .DS_Store
3 |
4 | # Vim/Emacs metadata and backup files
5 | .*.swp
6 | *~
7 | \#*#
8 | .#*
9 |
10 | # Dev/test tools, linters, etc.
11 | .eslintrc
12 |
13 | /uiop
14 |
15 | # make / compiler / autoconf droppings
16 | *.o
17 | *.la
18 | *.lo
19 | .deps/
20 | .libs/
21 | config.cache
22 | config.log
23 | config.status
24 | autom4te.cache
25 | configure.lineno
26 | /libtool
27 | /stamp-h
28 | /stamp-h1
29 | /include/stamp-h1
30 |
31 | # files generated from template input
32 | Makefile
33 | autom4te.cache
34 | config.*
35 | configure.lineno
36 |
37 | a10login
38 | agmrancid
39 | alogin
40 | anlogin
41 | arancid
42 | avologin
43 | avorancid
44 | blogin
45 | brancid
46 | brlogin
47 | cat5rancid
48 | clogin
49 | control_rancid
50 | csblogin
51 | cssrancid
52 | dllogin
53 | elogin
54 | erancid
55 | f5rancid
56 | flogin
57 | fnlogin
58 | fxlogin
59 | hlogin
60 | hpuifilter
61 | hrancid
62 | htlogin
63 | htrancid
64 | jerancid
65 | jlogin
66 | jrancid
67 | lg.cgi
68 | lgform.cgi
69 | login_top
70 | mrancid
71 | mrvlogin
72 | mtlogin
73 | nlogin
74 | noklogin
75 | nrancid
76 | nslogin
77 | nsrancid
78 | panlogin
79 | par
80 | plogin
81 | rancid
82 | rancid-cvs
83 | rancid-fe
84 | rancid-run
85 | rblogin
86 | rivlogin
87 | rivrancid
88 | rrancid
89 | rtftpcopy
90 | tlogin
91 | tntlogin
92 | tntrancid
93 | trancid
94 | ulogin
95 | wlogin
96 | xilogin
97 | xirancid
98 | xlogin
99 | xrrancid
100 |
101 | lg.conf.sample
102 | rancid.conf.sample
103 |
104 | config.h
105 | stamp-h
106 | stamp-h1
107 | version.h
108 |
109 | acos.pm
110 | aeos.pm
111 | adtran.pm
112 | arbor.pm
113 | arcos.pm
114 | avocent.pm
115 | bigip.pm
116 | ciscowlc.pm
117 | dell.pm
118 | dnos9.pm
119 | dnos10.pm
120 | edgemax.pm
121 | edgerouter.pm
122 | exos.pm
123 | fortigate.pm
124 | foundry.pm
125 | frr.pm
126 | fss2.pm
127 | fxos.pm
128 | ios.pm
129 | iossb.pm
130 | iosshtech.pm
131 | iosxr.pm
132 | junos.pm
133 | mrv.pm
134 | nxos.pm
135 | panos.pm
136 | rancid.pm
137 | rancidcontrib.pm
138 | rancid.py
139 | routeros.pm
140 | rbt.pm
141 | smc.pm
142 | sros.pm
143 | vrp.pm
144 | wavesvros.pm
145 |
146 | cloginrc.5
147 | lg.conf.5
148 | lg_intro.7
149 | rancid.3
150 | rancid.conf.5
151 | rancid.types.conf.5
152 |
153 | downreport
154 | rtrfilter
155 | rancid-cvspurge
156 |
--------------------------------------------------------------------------------
/BUGS:
--------------------------------------------------------------------------------
1 | See the the file Todo for known bugs.
2 |
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 | ## Copyright (c) 1997-2022 by Henry Kilmer and John Heasley
2 | ## All rights reserved.
3 | ##
4 | ## This code is derived from software contributed to and maintained by
5 | ## Henry Kilmer, John Heasley, Andrew Partan,
6 | ## Pete Whiting, Austin Schutz, and Andrew Fort.
7 | ##
8 | ## Redistribution and use in source and binary forms, with or without
9 | ## modification, are permitted provided that the following conditions
10 | ## are met:
11 | ## 1. Redistributions of source code must retain the above copyright
12 | ## notice, this list of conditions and the following disclaimer.
13 | ## 2. Redistributions in binary form must reproduce the above copyright
14 | ## notice, this list of conditions and the following disclaimer in the
15 | ## documentation and/or other materials provided with the distribution.
16 | ## 3. Neither the name of RANCID nor the names of its
17 | ## contributors may be used to endorse or promote products derived from
18 | ## this software without specific prior written permission.
19 | ##
20 | ## THIS SOFTWARE IS PROVIDED BY Henry Kilmer, John Heasley AND CONTRIBUTORS
21 | ## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 | ## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | ## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
24 | ## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 | ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 | ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 | ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 | ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 | ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | ## POSSIBILITY OF SUCH DAMAGE.
31 | ##
32 | ## It is the request of the authors, but not a condition of license, that
33 | ## parties packaging or redistributing RANCID NOT distribute altered versions
34 | ## of the etc/rancid.types.base file nor alter how this file is processed nor
35 | ## when in relation to etc/rancid.types.conf. The goal of this is to help
36 | ## suppress our support costs. If it becomes a problem, this could become a
37 | ## condition of license.
38 | #
39 | # The expect login scripts were based on Erik Sherk's gwtn, by permission.
40 | #
41 | # The original looking glass software was written by Ed Kern, provided by
42 | # permission and modified beyond recognition.
43 |
--------------------------------------------------------------------------------
/HOLD:
--------------------------------------------------------------------------------
1 | Short list of things the next release is holding on....so I do not loose
2 | track.
3 |
4 | - finding a diff(1) in configure
5 | - need to filter vlan.dat from show flash output. cats in/ VTP server mode
6 | repeatedly re-write this file causing erroneous rancid o/p
7 | - review todo list for done items
8 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 | ## A Makefile.in is supplied, in case you do not have automake.
3 |
4 | ## Copyright (C) 1997-2019 by Henry Kilmer and John Heasley
5 | ## All rights reserved.
6 | ##
7 | ## Please see the file COPYING for the text of the license.
8 | ##
9 |
10 | AUTOMAKE_OPTIONS=foreign no-dependencies
11 |
12 | @SET_MAKE@
13 |
14 | pkgdata_DATA = COPYING CHANGES FAQ README README.lg UPGRADING cloginrc.sample
15 | EXTRA_DIST = BUGS Todo configure configure.vers install-sh \
16 | mkinstalldirs Makefile.in Todo $(pkgdata_DATA)
17 | #DIST_COMMON =
18 |
19 | # '.' is here (and at the beginnging of the macro) so that distclean-recursive
20 | # will run make distclean in . after the other dirs (preserving Makefile) and
21 | # mkinstalldirs will create the install destination before descending into
22 | # the subdirs.
23 | SUBDIRS = . include etc lib bin man share
24 |
25 | # sysconfdir is here because etc/Makefile uses a script to be careful about
26 | # installing rancid.conf, not over-writing an existing one.
27 | DIRS2_CREATE=$(DESTDIR)$(prefix) $(DESTDIR)$(sysconfdir)
28 | if MK_LCLSTATEDIR
29 | DIRS2_CREATE+=$(DESTDIR)$(localstatedir)
30 | endif
31 | install-data-hook:
32 | $(mkinstalldirs) $(DIRS2_CREATE);
33 |
34 | distclean-local:
35 | -rm -rf $(top_srcdir)/autom4te.cache
36 |
--------------------------------------------------------------------------------
/README.lg:
--------------------------------------------------------------------------------
1 | This is a looking glass based on Ed Kern's which used to be available on
2 | http://nitrous.digex.net/. This version supports cisco, juniper, and
3 | foundry, using rancid's [cfj]login to login (so rcmd is not necessary,
4 | it can use telnet, ssh, or rsh), and has some additional commands
5 | implemented. There are a few cisco commands where either no juniper or
6 | foundry equivalent exists or we have not had time to implement yet.
7 |
8 | packing list:
9 | README This file.
10 | index.html often the default document the server will load, contains
11 | an html redirect to load lgform.cgi
12 | lg.conf looking glass configuration file
13 | lg.cgi work horse of the looking glass
14 | lgform.cgi front-end form for the looking glass engine
15 | lgnotes.html user info for the looking glass
16 |
17 | The looking glass requires the CGI and LockFile-Simple perl modules.
18 | these can be retrieved from CPAN, http://www.cpan.org/. CGI's home is
19 | ftp://ftp-genome.wi.mit.edu/pub/software/WWW/. It also requires
20 | the POSIX module (for strftime) and Sys::Syslog, which I believe comes
21 | with perl5 and/or are converted with h2ph(1).
22 |
23 | basic installation instructions:
24 |
25 | The configure and make install process will make variable substitutions
26 | and install the looking glass bits. Assuming configure was run without
27 | directory options, such as --prefix, the default install prefix is
28 | /usr/local/rancid. So, the bits will be installed in
29 | /usr/local/rancid/etc/lg.conf, /usr/local/rancid/bin, and
30 | /usr/local/rancid/share/rancid (i.e.: /etc/lg.conf, etc.).
31 |
32 | 1) Make the scripts and html files available to your server (httpd) by
33 | creating a directory in your server's document root directory
34 | (apache's httpd.conf "DocumentRoot" variable). For example:
35 |
36 | mkdir /usr/local/htdocs/lg
37 |
38 | Then either:
39 | - copy the files /share/rancid/{index.html,lgnotes.html} and
40 | /bin/{lg.cgi,lgform.cgi} to /usr/local/htdocs/lg
41 | OR
42 | - create symlinks from /usr/local/htdocs/lg to each of these files.
43 |
44 | Note on links: if you use symlinks, you have to configure apache to
45 | allow following symlinks. e.g.:
46 | % cat /usr/local/htdocs/lg/.htaccess
47 | Options FollowSymLinks ExecCGI
48 |
49 | Note on index.html: index.html is typically the default file loaded
50 | when a url ends with a '/'. index.html can be used to redirect this
51 | to lgform.cgi using a netscape meta refresh. Though this is supported
52 | by many browsers, it is supposedly netscape specific and non-standard.
53 | In apache, the same thing can be acheived by altering the default
54 | directory index like this:
55 |
56 | % cat /usr/local/htdocs/lg/.htaccess
57 | Options ExecCGI
58 | DirectoryIndex lgform.cgi
59 |
60 | 2) The looking glass scripts need to be able to find and read lg.conf. By
61 | default it is installed as /lg.conf (/etc/lg.conf)
62 | and the scripts will first look in their CWD (Current Working Directory)
63 | and then /lg.conf, if it does not exist in the CWD. However,
64 | the LG_CONF environment variable can be used to move it elsewhere.
65 |
66 | To get LG_CONF into the CGI enviroment, you can use SetEnvIf in apache's
67 | httpd.conf. For example:
68 | SetEnvIf Request_URI "\/lg/.*.cgi" LG_CONF=/usr/local/htdocs/lg/lg.conf
69 |
70 | Note: if you have chosen to locate your router.db (or other possibly
71 | sensitive files in the http docs heirarchy, you may wish to restrict
72 | download permission for these files. Something like:
73 |
74 | % cat /usr/local/htdocs/lg/.htaccess
75 |
76 | Order allow,deny
77 | Deny from all
78 | Satisfy All
79 |
80 |
81 | 3) Edit /lg.conf (usually /etc/lg.conf). See lg.conf(5)
82 | for additional information.
83 |
84 | 4) Set-up cron jobs to rotate the log file and clean out old cache files.
85 | See LG_CACHE_DIR & LG_LOG in lg.conf. Something like (YMMV):
86 |
87 | # rotate lookingglass log
88 | #0 0 * * * cd /usr/local/htdocs/lg/tmp; /usr/local/etc/savelog -m 666 -c14 lg.log
89 | 0 0 * * * cd /usr/local/htdocs/lg/tmp; /bin/mv lg.log lg.log.0
90 | # clean out the lookingglass cache
91 | 0 0 * * * cd /usr/local/htdocs/lg/tmp; /usr/local/bin/find . -type f -maxdepth 1 \( \! -name lg.log\* \) -mtime +1 -exec rm -f {} \;
92 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | RANCiD (https://shrubbery.net/rancid) is a "Really Awesome New Cisco confIg
2 | Differ" developed to maintain CVS (or Subversion or git) controlled copies of
3 | router configs.
4 |
5 | Please report bugs to rancid-discuss at shrubbery.net.
6 |
--------------------------------------------------------------------------------
/acinclude.m4:
--------------------------------------------------------------------------------
1 | AUTOMAKE_OPTIONS=no-dependencies foreign
2 |
--------------------------------------------------------------------------------
/bin/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 | ## A Makefile.in is supplied, in case you do not have automake.
3 |
4 | ## Copyright (c) 1997-2019 by Henry Kilmer and John Heasley
5 | ## All rights reserved.
6 | ##
7 | ## Please see the file COPYING for the text of the license.
8 |
9 | #AUTOMAKE_OPTIONS=foreign no-dependencies
10 | AUTOMAKE_OPTIONS=foreign
11 |
12 | bin_PROGRAMS = hpuifilter par
13 | bin_SCRIPTS = a10login alogin agmrancid anlogin arancid \
14 | avologin blogin brancid brlogin cat5rancid clogin \
15 | control_rancid csblogin cssrancid \
16 | dllogin elogin erancid f5rancid \
17 | flogin fnlogin fxlogin hlogin hrancid htlogin \
18 | htrancid jerancid jlogin mrancid mrvlogin mtlogin \
19 | nlogin noklogin nrancid nslogin nsrancid panlogin plogin \
20 | rancid rblogin rivlogin \
21 | rivrancid rrancid rtftpcopy tlogin trancid ulogin wlogin \
22 | xilogin xirancid xlogin
23 | # XXX hack for the rancid to get pkglibdir, see corresponding XXX below
24 | bin_in = control_rancid.in hrancid.in plogin.in rancid.in
25 |
26 | bin_SCRIPTS += lg.cgi lgform.cgi rancid-cvs rancid-fe rancid-run
27 | EXTRA_DIST= lg.cgi.in lgform.cgi.in rancid-cvs.in rancid-fe.in rancid-run.in \
28 | $(bin_in) login_top.in
29 | #dist_bin_SCRIPTS= $(bin_SCRIPTS:%=%.in)
30 |
31 | CLEANFILES= lg.cgi lgform.cgi plogin rancid rancid-cvs rancid-fe rancid-run
32 | #CLEANFILES= $(bin_SCRIPTS)
33 |
34 | hpuifilter_SOURCES = hpuifilter.c
35 | par_SOURCES = par.c
36 |
37 | #CPPFLAGS += @PG_CPPFLAGS@
38 | #INCLUDES += -I$(top_srcdir)/include @PG_CPPFLAGS@
39 | #INCLUDES += -I$(top_srcdir)/include
40 |
41 | #CFLAGS += -g
42 | CFLAGS = -g -O0
43 |
44 | YFLAGS = -d
45 | #LFLAGS = -i
46 |
47 | # no idea why automake doesnt clean these targets
48 | #CLEANFILES= y.tab.c y.tab.h lex.yy.c conf.h conf.c conflex.c
49 |
50 | #clean:
51 | # rm -f Makefile env $(BIN_DATAS) $(BIN_PROGS)
52 |
53 | # auto_edit does the autoconf variable substitution. This allows the
54 | # substitution to have the full expansion of the variables, e.g.: $sysconfdir
55 | # will be /prefix/etc instead of ${prefix}/etc.
56 | #
57 | # This is a bit of a PITA, but is the method recommended by the autoconf
58 | # documentation.
59 | auto_edit = sed \
60 | -e 's,@prefix\@,$(prefix),g' \
61 | -e 's,@localstatedir\@,$(localstatedir),g' \
62 | -e 's,@pkglibdir\@,$(pkglibdir),g' \
63 | -e 's,@sysconfdir\@,$(sysconfdir),g' \
64 | -e 's,@DIFF_CMD\@,$(DIFF_CMD),g' \
65 | -e 's,@EXPECT_PATH\@,$(EXPECT_PATH),g' \
66 | -e 's,@PERLV\@,$(PERLV),g' \
67 | -e 's,@PERLV_PATH\@,$(PERLV_PATH),g' \
68 | -e 's,@PYTHON3\@,$(PYTHON3),g' \
69 | -e 's,@PYTHON3_PATH\@,$(PYTHON3_PATH),g' \
70 | -e 's,@LG_PING_CMD\@,$(LG_PING_CMD),g' \
71 | -e 's,@ADMINMAILPLUS\@,$(ADMINMAILPLUS),g' \
72 | -e 's,@LOCKPROG\@,$(LOCKPROG),g' \
73 | -e 's,@MAILPLUS\@,$(MAILPLUS),g' \
74 | -e 's,@PACKAGE\@,$(PACKAGE),g' \
75 | -e 's,@SVN_FSTYPE\@,$(SVN_FSTYPE),g' \
76 | -e 's,@SENDMAIL\@,$(SENDMAIL),g' \
77 | -e 's,@VERSION\@,$(VERSION),g' \
78 | -e 's,@COPYYEARS\@,$(COPYYEARS),g' \
79 | -e '/@copyright@/r ../COPYING' -e '/@copyright@/d'
80 |
81 | # XXX this is the generic version for the rest of bin_scripts that comes from
82 | # configure.in now. perhaps change to use this.
83 | $(bin_in:%.in=%): Makefile $(top_builddir)/config.status ../COPYING
84 | rm -f $@ $@.tmp; \
85 | $(auto_edit) $(srcdir)/$@.in >$@.tmp; \
86 | chmod +x $@.tmp; \
87 | mv $@.tmp $@
88 | # XXX there must be a better way to produce these dependencies, perhaps in
89 | # configure, but more likely need a depend target.
90 | alogin: $(srcdir)/alogin.in
91 | control_rancid: $(srcdir)/control_rancid.in
92 | hlogin: $(srcdir)/hlogin.in
93 | hrancid: $(srcdir)/hrancid.in
94 | plogin: $(srcdir)/plogin.in
95 | rancid: $(srcdir)/rancid.in
96 |
97 | lg.cgi: Makefile $(srcdir)/lg.cgi.in
98 | rm -f lg.cgi lg.cgi.tmp; \
99 | $(auto_edit) $(srcdir)/lg.cgi.in >lg.cgi.tmp; \
100 | chmod +x lg.cgi.tmp; \
101 | mv lg.cgi.tmp lg.cgi
102 |
103 | lgform.cgi: Makefile $(srcdir)/lgform.cgi.in
104 | rm -f lgform.cgi lgform.cgi.tmp; \
105 | $(auto_edit) $(srcdir)/lgform.cgi.in >lgform.cgi.tmp; \
106 | chmod +x lgform.cgi.tmp; \
107 | mv lgform.cgi.tmp lgform.cgi
108 |
109 | rancid-cvs: Makefile $(srcdir)/rancid-cvs.in
110 | rm -f rancid-cvs rancid-cvs.tmp; \
111 | $(auto_edit) $(srcdir)/rancid-cvs.in >rancid-cvs.tmp; \
112 | chmod +x rancid-cvs.tmp; \
113 | mv rancid-cvs.tmp rancid-cvs
114 |
115 | rancid-fe: Makefile $(srcdir)/rancid-fe.in
116 | rm -f rancid-fe rancid-fe.tmp; \
117 | $(auto_edit) $(srcdir)/rancid-fe.in >rancid-fe.tmp; \
118 | chmod +x rancid-fe.tmp; \
119 | mv rancid-fe.tmp rancid-fe
120 |
121 | rancid-run: Makefile $(srcdir)/rancid-run.in
122 | rm -f rancid-run rancid-run.tmp; \
123 | $(auto_edit) $(srcdir)/rancid-run.in >rancid-run.tmp; \
124 | chmod +x rancid-run.tmp; \
125 | mv rancid-run.tmp rancid-run
126 |
127 | $(bin_PROGRAMS) $(bin_SCRIPTS): ../include/version.h
128 | $(bin_SCRIPTS): ../COPYING login_top
129 |
--------------------------------------------------------------------------------
/bin/plogin.in:
--------------------------------------------------------------------------------
1 | #! @PERLV_PATH@
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | @copyright@
5 | #
6 | # RANCID - Really Awesome New Cisco confIg Differ
7 | #
8 | # plogin - poly-login; use router.db files and rancid.{base,types}.conf
9 | # configurations to determine which login script to execute.
10 | #
11 | use 5.0010;
12 | use strict 'vars';
13 | use warnings;
14 | no warnings 'uninitialized';
15 | use Exporter;
16 | use Getopt::Long;
17 | # use Getopt::Long qw(:config no_ignore_case bundling);
18 | Getopt::Long::Configure ("bundling", "no_ignore_case");
19 | our($opt_d, $opt_S, $opt_V, $opt_autoenable, $opt_noenable, $opt_c, @opt_E,
20 | $opt_e, $opt_f, $opt_h, $opt_i, $opt_m, $opt_M, $opt_p, $opt_r, $opt_s,
21 | $opt_t, $opt_u, $opt_v, $opt_w, $opt_x, $opt_y, $opt_z);
22 | GetOptions('d' => \$opt_d, 'S' => \$opt_S, 'V' => \$opt_V,
23 | 'autoenable' => \$opt_autoenable, 'noenable' => \$opt_noenable,
24 | 'c=s' => \$opt_c, "E=s@" => \@opt_E, 'e=s' => \$opt_e, 'f=s' => \$opt_f,
25 | 'h' => \$opt_h, 'i' => \$opt_i, 'm' => \$opt_m, 'M' => \$opt_M,
26 | 'p=s' => \$opt_p, 'r=s' => \$opt_r, 's=s' => \$opt_s, 't=s' => \$opt_t,
27 | 'u=s' => \$opt_u, 'v=s' => \$opt_v, 'w=s' => \$opt_w, 'x=s' => \$opt_x,
28 | 'y=s' => \$opt_y, 'z=s' => \$opt_z);
29 | my($BASEDIR, $LIST_OF_GROUPS, $cmd, $i, $j, @routers);
30 | BEGIN {
31 | push(@INC, "@pkglibdir@");
32 | }
33 | use rancid;
34 | our @ISA = qw(Exporter rancid);
35 |
36 | sub usage()
37 | {
38 | print STDERR "plogin [-dSV] [-autoenable] [-noenable] [-c command] [-Evar=x] [-e enable-password] [-f cloginrc-file] [-p user-password] [-r passphrase] [-s script-file] [-t timeout] [-u username] [-v vty-password] [-w enable-username] [-x command-file] [-y ssh_cypher_type] [-z device_type] router [router...]\n";
39 | exit 64;
40 | }
41 |
42 | # make OUTPUT unbuffered if debugging
43 | if ($opt_d) { $| = 1; }
44 |
45 | if ($opt_h) {
46 | usage();
47 | }
48 |
49 | # option handling initialization
50 | if ($opt_V) {
51 | print "plogin: @PACKAGE@ @VERSION@\n";
52 | # do not exit; exec the script with -V and it will exit
53 | }
54 | $cmd .= " -d" if ($opt_d);
55 | $cmd .= " -i" if ($opt_i);
56 | $cmd .= " -m" if ($opt_m);
57 | $cmd .= " -M" if ($opt_M);
58 | $cmd .= " -S" if ($opt_S);
59 | $cmd .= " -V" if ($opt_V);
60 | $cmd .= " -autoenable" if ($opt_autoenable);
61 | $cmd .= " -noenable" if ($opt_noenable);
62 | $cmd .= " -c '$opt_c'" if (length($opt_c));
63 | foreach $i (@opt_E) {
64 | $cmd .= " -E$i";
65 | }
66 | $cmd .= " -e '$opt_e'" if (length($opt_e));
67 | $cmd .= " -f '$opt_f'" if (length($opt_f));
68 | $cmd .= " -p '$opt_p'" if (length($opt_p));
69 | $cmd .= " -r '$opt_r'" if (length($opt_r));
70 | $cmd .= " -s '$opt_s'" if (length($opt_s));
71 | $cmd .= " -t $opt_s" if (length($opt_t));
72 | $cmd .= " -u '$opt_u'" if (length($opt_u));
73 | $cmd .= " -v '$opt_v'" if (length($opt_v));
74 | $cmd .= " -w '$opt_w'" if (length($opt_w));
75 | $cmd .= " -x '$opt_x'" if (length($opt_x));
76 | $cmd .= " -y '$opt_y'" if (length($opt_y));
77 | $devtype = $opt_z;
78 | foreach $i (@ARGV) {
79 | $cmd .= " $i";
80 | push(@routers, $i);
81 | }
82 |
83 | # what is the device type, supplied or looked-up
84 | if ($opt_z) {
85 | $devtype = $opt_z;
86 | } else {
87 | # Look in router.dbs for device type.
88 | # read rancid.conf for BASEDIR and LIST_OF_GROUPS?
89 | my($ENVFILE) = "@sysconfdir@/rancid.conf";
90 | open(INPUT, "< $ENVFILE") || die "Could not open $ENVFILE: $!";
91 | close(INPUT);
92 | open(INPUT,
93 | "sh -c \'. $ENVFILE; echo \"BASEDIR=\$BASEDIR\"; echo \"LIST_OF_GROUPS=\$LIST_OF_GROUPS\"\' |") ||
94 | die "Could not open $ENVFILE: $!";
95 | while () {
96 | chomp;
97 | s/#.$//;
98 | s/^\s+//;
99 | my($varname, $value) = split('=');
100 | if ($varname eq "BASEDIR") {
101 | $BASEDIR = $value;
102 | }
103 | if ($varname eq "LIST_OF_GROUPS") {
104 | $LIST_OF_GROUPS = $value;
105 | $LIST_OF_GROUPS =~ s/^\s+//;
106 | $LIST_OF_GROUPS =~ s/\s+$//;
107 | }
108 | }
109 | close(INPUT);
110 |
111 | # read each router.db for the routername and thus the devtype
112 | foreach $i (split(/\s+/, $LIST_OF_GROUPS)) {
113 | if (!open(INPUT, "< $BASEDIR/$i/router.db")) {
114 | warn "Could not open $BASEDIR/$i/router.db: $!";
115 | next;
116 | }
117 | while () {
118 | chomp;
119 | s/#.$//;
120 | s/^\s+//;
121 | my($router, $type, $state) = split('\;');
122 | foreach $j (@routers) {
123 | if ($router eq $j) {
124 | $devtype = $type;
125 | close(INPUT);
126 | goto FOUND;
127 | }
128 | }
129 | }
130 | close(INPUT);
131 | }
132 | }
133 |
134 | FOUND:
135 | if (length($devtype) < 1) {
136 | die "Couldn't find device type by hostname in router.dbs\n";
137 | }
138 |
139 | # load device type spec, build @commandtable and load modules
140 | if (loadtype($devtype)) {
141 | die "Couldn't load device type spec for $rancid::devtype\n";
142 | }
143 | if (! defined($lscript)) {
144 | die "login script not defined for device type $rancid::devtype\n";
145 | }
146 | exec($lscript . " $cmd") ||
147 | printf(STDERR "exec($lscript) failed router manufacturer $devtype: $!\n");
148 | exit(-1);
149 |
--------------------------------------------------------------------------------
/bin/rancid-fe.in:
--------------------------------------------------------------------------------
1 | #! @PERLV_PATH@
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | ## Copyright (c) @COPYYEARS@ by Henry Kilmer and John Heasley
5 | ## All rights reserved.
6 | ##
7 | ## This code is derived from software contributed to and maintained by
8 | ## Henry Kilmer, John Heasley, Andrew Partan,
9 | ## Pete Whiting, Austin Schutz, and Andrew Fort.
10 | ##
11 | ## Redistribution and use in source and binary forms, with or without
12 | ## modification, are permitted provided that the following conditions
13 | ## are met:
14 | ## 1. Redistributions of source code must retain the above copyright
15 | ## notice, this list of conditions and the following disclaimer.
16 | ## 2. Redistributions in binary form must reproduce the above copyright
17 | ## notice, this list of conditions and the following disclaimer in the
18 | ## documentation and/or other materials provided with the distribution.
19 | ## 3. Neither the name of RANCID nor the names of its
20 | ## contributors may be used to endorse or promote products derived from
21 | ## this software without specific prior written permission.
22 | ##
23 | ## THIS SOFTWARE IS PROVIDED BY Henry Kilmer, John Heasley AND CONTRIBUTORS
24 | ## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 | ## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 | ## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
27 | ## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 | ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 | ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 | ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 | ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 | ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | ## POSSIBILITY OF SUCH DAMAGE.
34 | ##
35 | ## It is the request of the authors, but not a condition of license, that
36 | ## parties packaging or redistributing RANCID NOT distribute altered versions
37 | ## of the etc/rancid.types.base file nor alter how this file is processed nor
38 | ## when in relation to etc/rancid.types.conf. The goal of this is to help
39 | ## suppress our support costs. If it becomes a problem, this could become a
40 | ## condition of license.
41 | #
42 | # The expect login scripts were based on Erik Sherk's gwtn, by permission.
43 | #
44 | # The original looking glass software was written by Ed Kern, provided by
45 | # permission and modified beyond recognition.
46 | #
47 | # rancid-FE - front-end to rancid/jrancid/etc. for use with par.
48 | #
49 | # usage: rancid-fe ;
50 | #
51 |
52 | require 5;
53 |
54 | my($script);
55 | my($router, $devtype) = split('\;', $ARGV[0]);
56 | $devtype =~ tr/[A-Z]/[a-z]/;
57 | if (! length($devtype)) {
58 | printf(STDERR "unknown router manufacturer for $router: $devtype\n");
59 | exit(-1);
60 | }
61 |
62 | # XXX use rancid::loadtype() to parse these files.
63 | REPEAT: foreach $file ("@sysconfdir@/rancid.types.base",
64 | "@sysconfdir@/rancid.types.conf") {
65 | open(INPUT, "< $file") || die "Could not open $file: $!";
66 | while () {
67 | chomp;
68 | my($type, $directive, $value) = split('\;');
69 | $type =~ tr/[A-Z]/[a-z]/;
70 | $directive =~ tr/[A-Z]/[a-z]/;
71 | if ($type eq $devtype && $directive eq "script") {
72 | $script = $value;
73 | close(INPUT);
74 | goto FOUND;
75 | }
76 | if ($type eq $devtype && $directive eq "alias") {
77 | $devtype = $value;
78 | close(INPUT);
79 | goto REPEAT;
80 | }
81 | }
82 | close(INPUT);
83 | }
84 |
85 | FOUND:
86 | if (! defined($script)) {
87 | printf(STDERR "unknown router manufacturer for $router: $devtype\n");
88 | exit(-1);
89 | } else {
90 | exec($script . " $router");
91 | }
92 |
93 | printf(STDERR "exec($script) failed router manufacturer $devtype: $!\n");
94 | exit(-1);
95 |
--------------------------------------------------------------------------------
/bin/rancid-run.in:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | ## Copyright (c) @COPYYEARS@ by Henry Kilmer and John Heasley
5 | ## All rights reserved.
6 | ##
7 | ## This code is derived from software contributed to and maintained by
8 | ## Henry Kilmer, John Heasley, Andrew Partan,
9 | ## Pete Whiting, Austin Schutz, and Andrew Fort.
10 | ##
11 | ## Redistribution and use in source and binary forms, with or without
12 | ## modification, are permitted provided that the following conditions
13 | ## are met:
14 | ## 1. Redistributions of source code must retain the above copyright
15 | ## notice, this list of conditions and the following disclaimer.
16 | ## 2. Redistributions in binary form must reproduce the above copyright
17 | ## notice, this list of conditions and the following disclaimer in the
18 | ## documentation and/or other materials provided with the distribution.
19 | ## 3. Neither the name of RANCID nor the names of its
20 | ## contributors may be used to endorse or promote products derived from
21 | ## this software without specific prior written permission.
22 | ##
23 | ## THIS SOFTWARE IS PROVIDED BY Henry Kilmer, John Heasley AND CONTRIBUTORS
24 | ## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 | ## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 | ## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
27 | ## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 | ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 | ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 | ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 | ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 | ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | ## POSSIBILITY OF SUCH DAMAGE.
34 | ##
35 | ## It is the request of the authors, but not a condition of license, that
36 | ## parties packaging or redistributing RANCID NOT distribute altered versions
37 | ## of the etc/rancid.types.base file nor alter how this file is processed nor
38 | ## when in relation to etc/rancid.types.conf. The goal of this is to help
39 | ## suppress our support costs. If it becomes a problem, this could become a
40 | ## condition of license.
41 | #
42 | # The expect login scripts were based on Erik Sherk's gwtn, by permission.
43 | #
44 | # The original looking glass software was written by Ed Kern, provided by
45 | # permission and modified beyond recognition.
46 | #
47 | # Run rancid for each of the rancid groups defined by $LIST_OF_GROUPS in
48 | # @sysconfdir@/rancid.conf or those specified on the command-line.
49 | #
50 |
51 | # Default ENVFILE, overrideable with -f flag.
52 | ENVFILE="@sysconfdir@/rancid.conf"
53 |
54 | TMPDIR=${TMPDIR:=/tmp}; export TMPDIR
55 |
56 | # control_rancid argv
57 | CR_ARGV=""; export CR_ARGV
58 |
59 | # print a usage message to stderr
60 | pr_usage() {
61 | echo "usage: $0 [-V] [-c commit_msg] [-f config_file] [-r device_name] [-m mail rcpt] [group [group ...]]" >&2;
62 | }
63 |
64 | # command-line options
65 | # -V
66 | # -c
67 | # -f
68 | # -m
69 | # -r
70 | if [ $# -ge 1 ] ; then
71 | while [ 1 ] ; do
72 | case $1 in
73 | -V)
74 | echo "@PACKAGE@ @VERSION@"
75 | exit 0
76 | ;;
77 | -c)
78 | shift
79 | # next arg is the commit message
80 | CR_ARGV="$CR_ARGV -c \"$1\""; export CR_ARGV
81 | shift
82 | ;;
83 | -f)
84 | shift
85 | # next arg is the alternate config file name
86 | ENVFILE="$1"
87 | if [ -z $ENVFILE ]; then
88 | pr_usage
89 | exit 1
90 | fi
91 | CR_ARGV="$CR_ARGV -f $1"; export CR_ARGV
92 | shift
93 | ;;
94 | -m)
95 | shift
96 | # next arg is the mailto name
97 | CR_ARGV="$CR_ARGV -m $1"; export CR_ARGV
98 | shift
99 | ;;
100 | -r)
101 | shift
102 | # next arg is the device name
103 | CR_ARGV="$CR_ARGV -r $1"; export CR_ARGV
104 | shift
105 | ;;
106 | --)
107 | shift; break;
108 | ;;
109 | -h)
110 | pr_usage
111 | exit
112 | ;;
113 | -*)
114 | echo "unknown option: $1" >&2
115 | pr_usage
116 | exit 1
117 | ;;
118 | *)
119 | break;
120 | ;;
121 | esac
122 | done
123 | fi
124 |
125 | . $ENVFILE
126 |
127 | # SENDMAIL location
128 | SENDMAIL=${SENDMAIL:=sendmail};
129 |
130 | if [ $# -ge 1 ] ; then
131 | LIST_OF_GROUPS="$*"; export LIST_OF_GROUPS
132 | elif [ "$LIST_OF_GROUPS" = "" ] ; then
133 | echo "LIST_OF_GROUPS is empty in $ENVFILE"
134 | exit 1
135 | fi
136 |
137 | # LOGDIR location
138 | LOGDIR=${LOGDIR:=$BASEDIR/logs};
139 | if [ ! -d $LOGDIR ] ; then
140 | mkdir -p $LOGDIR || (echo "Could not create log directory: $LOGDIR" >&2;
141 | exit 1)
142 | fi
143 |
144 | for GROUP in $LIST_OF_GROUPS
145 | do
146 |
147 | LOCKFILE=$TMPDIR/.$GROUP.run.lock
148 |
149 | (
150 | echo starting: `date`
151 | echo
152 |
153 | if [ -f $LOCKFILE ]
154 | then
155 | echo hourly config diffs failed: $LOCKFILE exists
156 | ls -l $LOCKFILE
157 |
158 | # Send email if the lock file is old.
159 | if [ "X$LOCKTIME" = "X" ] ; then
160 | LOCKTIME=4
161 | fi
162 | GRPOLDFILE=`mktemp -q $TMPDIR/.$GROUP.XXXXXX`
163 | if [ $? -ne 0 ] ; then
164 | echo "Could not create temporary file for error email" >&2
165 | exit 1
166 | fi
167 | @PERLV@ -e "\$t = (stat(\"$LOCKFILE\"))[9]; print \"OLD\\n\" if (time() - \$t >= $LOCKTIME*60*60);" > $GRPOLDFILE
168 | if [ -s $GRPOLDFILE ]
169 | then
170 | (
171 | echo "To: @ADMINMAILPLUS@${GROUP}${MAILDOMAIN}"
172 | echo "Subject: rancid hung - $GROUP"
173 | echo "Precedence: bulk"
174 | echo "Auto-submitted: auto-generated"
175 | echo "X-Auto-Response-Suppress: All"
176 | echo ""
177 |
178 | cat <$LOGDIR/$GROUP.`date +%Y%m%d.%H%M%S` 2>&1
200 | done
201 |
--------------------------------------------------------------------------------
/bin/rancid.in:
--------------------------------------------------------------------------------
1 | #! @PERLV_PATH@
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | @copyright@
5 | #
6 | # RANCID - Really Awesome New Cisco confIg Differ
7 | #
8 | # rancid - generalized rancid module; command schedule is derived from the
9 | # rancid.types.{base,conf} configurations.
10 | #
11 | # usage: rancid [-dhltCV] -t device_type [-f filename | hostname]
12 | #
13 | use 5.010;
14 | use strict 'vars';
15 | use warnings;
16 | no warnings 'uninitialized';
17 | use Exporter;
18 | use Getopt::Std;
19 | our($opt_d, $opt_f, $opt_h, $opt_l, $opt_t, $opt_C, $opt_V);
20 | getopts('dfhlt:CV');
21 | BEGIN {
22 | push(@INC, "@pkglibdir@");
23 | }
24 | use rancid;
25 | our @ISA = qw(Exporter rancid);
26 |
27 | sub usage()
28 | {
29 | print STDERR "rancid [-dhlCV] -t device_type [-f filename | hostname]\n";
30 | exit 64;
31 | }
32 |
33 | if ($opt_h) {
34 | usage();
35 | }
36 |
37 | # basic initialization
38 | rancidinit();
39 |
40 | # load device type spec, build @commandtable and load modules
41 | if (loadtype($devtype)) {
42 | die "Couldn't load device type spec for $rancid::devtype\n";
43 | }
44 | if (! defined($script)) {
45 | die "script not defined for device type $rancid::devtype\n";
46 | }
47 | if (! defined($lscript)) {
48 | die "login script not defined for device type $rancid::devtype\n";
49 | }
50 | # if the first word of $script is not us (this script), exec the given
51 | # script.
52 | my(@script) = split(/\s+/, $script);
53 | if (which($script[0]) ne which($0)) {
54 | # -[hCV] are not handled; they will have already been handled earlier.
55 | push(@script, "-d") if $opt_d;
56 | push(@script, "-l") if $opt_l;
57 | push(@script, "-f") if $opt_f;
58 | push(@script, $host);
59 | if ($debug) {
60 | print(STDERR "device script ($script[0]) does not appear to be me ($0)".
61 | ": exec(". join(" ", @script) .")\n");
62 | }
63 | # there is no way to prevent an error msg from exec such that the die error
64 | # is the only one displayed, without also leaving the child without a
65 | # working STDERR.
66 | exec(join(" ", @script)) || die "exec($script[0]) failed: $!\n";
67 | }
68 |
69 | # check that inloop, the input/main loop, is defined
70 | if (!defined($inloop) || length($inloop) < 1) {
71 | die "inloop is not configured for device type $devtype";
72 | }
73 |
74 | # open the temporary file for the digested output
75 | open(OUTPUT,">$host.new") || die "Can't open $host.new for writing: $!\n";
76 | select(OUTPUT);
77 | if (length($#modules)) {
78 | my($module);
79 |
80 | foreach $module (@modules) {
81 | (my $file = $module) =~ s/::/\//g;
82 | my($err) = 0;
83 |
84 | # call module->init(); we expect 0 as success, as god intended it
85 | eval "\$err = ". $module ."::init();";
86 | if ($@) {
87 | printf(STDERR "loadtype: initializing $module failed: %s\n", $@);
88 | exit 1;
89 | } elsif ($err) {
90 | printf(STDERR "loadtype: %s::init() returned failure\n", $module);
91 | exit 1;
92 | }
93 | }
94 | }
95 |
96 | # open the input; a pre-collected file or start a login for a login stream or
97 | # temporary file
98 | if ($file) {
99 | print(STDERR "opening file $host\n") if ($debug || $log);
100 | open(INPUT,"<$host") || die "open failed for $host: $!\n";
101 | } else {
102 | my $cstr = $commandstr;
103 | $cstr =~ s/\"/\\\"/g;
104 | print(STDERR "executing $lscript -t $timeo -c\"$cstr\" $host\n") if ($debug || $log);
105 | system "$lscript -t $timeo -c \"$cstr\" $host $host.raw 2>&1" || die "clogin failed for $host: $!\n";
106 | open(INPUT, "< $host.raw") || die "clogin failed for $host: $!\n";
107 | }
108 |
109 | # loop over the input using the provided input/main loop
110 | eval($inloop ."(*INPUT, *OUTPUT);") && die "${inloop} failed: $@\n";
111 |
112 | print STDOUT "Done $lscript: $_\n" if ($log);
113 | # Flush History
114 | ProcessHistory("","","","");
115 | # Cleanup
116 | close(INPUT);
117 | close(OUTPUT);
118 |
119 | unlink("$host.raw") if (! $debug);
120 |
121 | # check for completeness
122 | if (scalar(%commands) || !$clean_run || !$found_end) {
123 | if (scalar(keys %commands) eq $commandcnt) {
124 | printf(STDERR "$host: missed cmd(s): all commands\n");
125 | } elsif (scalar(%commands)) {
126 | my($count, $i) = 0;
127 | for ($i = 0; $i < $#commands; $i++) {
128 | if ($commands{$commands[$i]}) {
129 | if (!$count) {
130 | printf(STDERR "$host: missed cmd(s): %s", $commands[$i]);
131 | } else {
132 | printf(STDERR ", %s", $commands[$i]);
133 | }
134 | $count++;
135 | }
136 | }
137 | if ($count) {
138 | printf(STDERR "\n");
139 | }
140 | }
141 | if (!$clean_run || !$found_end) {
142 | print(STDERR "$host: End of run not found\n");
143 | if ($debug) {
144 | print(STDERR "$host: clean_run is false\n") if (!$clean_run);
145 | print(STDERR "$host: found_end is false\n") if (!$found_end);
146 | }
147 | system("/usr/bin/tail -1 $host.new");
148 | }
149 | unlink "$host.new" if (! $debug);
150 | }
151 |
--------------------------------------------------------------------------------
/bin/rtftpcopy.in:
--------------------------------------------------------------------------------
1 | #! @PERLV_PATH@
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | ## Copyright (c) @COPYYEARS@ by Henry Kilmer and John Heasley
5 | ## All rights reserved.
6 | ##
7 | ## This code is derived from software contributed to and maintained by
8 | ## Henry Kilmer, John Heasley, Andrew Partan,
9 | ## Pete Whiting, Austin Schutz, and Andrew Fort.
10 | ##
11 | ## Redistribution and use in source and binary forms, with or without
12 | ## modification, are permitted provided that the following conditions
13 | ## are met:
14 | ## 1. Redistributions of source code must retain the above copyright
15 | ## notice, this list of conditions and the following disclaimer.
16 | ## 2. Redistributions in binary form must reproduce the above copyright
17 | ## notice, this list of conditions and the following disclaimer in the
18 | ## documentation and/or other materials provided with the distribution.
19 | ## 3. Neither the name of RANCID nor the names of its
20 | ## contributors may be used to endorse or promote products derived from
21 | ## this software without specific prior written permission.
22 | ##
23 | ## THIS SOFTWARE IS PROVIDED BY Henry Kilmer, John Heasley AND CONTRIBUTORS
24 | ## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 | ## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 | ## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
27 | ## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 | ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 | ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 | ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 | ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 | ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | ## POSSIBILITY OF SUCH DAMAGE.
34 | ##
35 | ## It is the request of the authors, but not a condition of license, that
36 | ## parties packaging or redistributing RANCID NOT distribute altered versions
37 | ## of the etc/rancid.types.base file nor alter how this file is processed nor
38 | ## when in relation to etc/rancid.types.conf. The goal of this is to help
39 | ## suppress our support costs. If it becomes a problem, this could become a
40 | ## condition of license.
41 | #
42 | # The expect login scripts were based on Erik Sherk's gwtn, by permission.
43 | #
44 | # The original looking glass software was written by Ed Kern, provided by
45 | # permission and modified beyond recognition.
46 | #
47 | # copy configs from tftpboot within rancid; assumes CWD=/configs and
48 | # that /bin/domainname is the same domainname as the routers, which is
49 | # replaced with "-confg" to form the filename expected in /tftpboot.
50 | #
51 | # usage: rtftpcopy [-dltCV] [-f filename | hostname]
52 | #
53 | use Getopt::Std;
54 | getopts('dflt:CV');
55 | if ($opt_V) {
56 | print "@PACKAGE@ @VERSION@\n";
57 | exit(0);
58 | }
59 | $log = $opt_l;
60 | $debug = $opt_d;
61 | $file = $opt_f;
62 | $host = $ARGV[0];
63 | $domain = system("/bin/domainname");
64 | $domain =~ s/[.]/\\./g;
65 | if ($file) {
66 | $srcfile = $host;
67 | $host =~ s/^.*\///;
68 | } else {
69 | $srcfile = $host;
70 | $srcfile =~ s/$domain$/-confg/;
71 | }
72 |
73 | if (length($host) == 0) {
74 | if ($file) {
75 | print(STDERR "Too few arguments: file name required\n");
76 | exit(1);
77 | } else {
78 | print(STDERR "Too few arguments: host name required\n");
79 | exit(1);
80 | }
81 | }
82 | if ($opt_C) {
83 | if ($file) {
84 | print "cp $srcfile $host.new\n";
85 | } else {
86 | print "cp /tftpboot/$srcfile $host.new\n";
87 | }
88 | exit(0);
89 | }
90 |
91 | if ($file) {
92 | print STDERR "copying file $host\n" if ($debug);
93 | print STDOUT "copying file $host\n" if ($log);
94 | system("/bin/cp $srcfile $host.new");
95 | } else {
96 | print STDERR "copying file $host\n" if ($debug);
97 | print STDOUT "copying file $host\n" if ($log);
98 | system("/bin/cp /tftpboot/$srcfile $host.new") == 0;
99 | }
100 | if (!$?) {
101 | print STDERR "copy failed: $!\n";
102 | }
103 | print STDOUT "Done cp: $_\n" if ($log);
104 |
105 | # check for completeness
106 | if (scalar(%commands) || !$clean_run || !$found_end) {
107 | if (scalar(keys %commands) eq $commandcnt) {
108 | printf(STDERR "$host: missed cmd(s): all commands\n");
109 | } elsif (scalar(%commands)) {
110 | printf(STDOUT "$host: missed cmd(s): %s\n", join(',', keys(%commands)));
111 | printf(STDERR "$host: missed cmd(s): %s\n", join(',', keys(%commands))) if ($debug);
112 | }
113 | if (!$clean_run || !$found_end) {
114 | print STDOUT "$host: End of run not found\n";
115 | print STDERR "$host: End of run not found\n" if ($debug);
116 | system("/usr/bin/tail -1 $host.new");
117 | }
118 | unlink "$host.new" if (! $debug);
119 | }
120 |
--------------------------------------------------------------------------------
/cloginrc.sample:
--------------------------------------------------------------------------------
1 | # comments are cool, as is whitespace
2 | # clogin supports a number of add directives (non-exhaustive):
3 | # password
4 | # user
5 | # userprompt
6 | # userpassword
7 | # passprompt
8 | # method
9 | # noenable
10 | # enauser
11 | # enableprompt
12 | # autoenable
13 | # cyphertype
14 | # identity
15 | #
16 | # Details on each of these follows. Also see cloginrc(5).
17 | #
18 | # add password
19 | # Special characters must be escaped. See cloginrc(5).
20 | #
21 | # add user
22 | # The default user is $USER (i.e.: the user running clogin).
23 | #
24 | # add userprompt
25 | # What the router prints to prompt for the username.
26 | # Default: {"(Username|login|user name):"}
27 | #
28 | # add userpassword
29 | # The password for user if different than the password set
30 | # using 'add password'.
31 | #
32 | # add passprompt
33 | # What the router prints to prompt for the password.
34 | # Default: {"(\[Pp]assword|passwd):"}
35 | #
36 | # add method {ssh} [...]
37 | # Defines, in order, which connection method(s) to use for a device
38 | # from the set {ssh,telnet,rsh}. e.g.: add method * {ssh} {telnet} {rsh}
39 | # will attempt ssh connection first. if ssh fails with connection
40 | # refused (i.e.: not due to authentication failure), then try telnet,
41 | # then rsh.
42 | # Default: {telnet} {ssh}
43 | #
44 | # add noenable <1>
45 | # equivalent of -noenable on the cmd line to not enable at login.
46 | #
47 | # add enableprompt
48 | # What the router prints to prompt for the enable password.
49 | # Default: {"\[Pp]assword:"}
50 | #
51 | # add enauser
52 | # This is only needed if enable asks for a username and this
53 | # username is different from what user is set to.
54 | #
55 | # add autoenable <1/0>
56 | # This is used if you are automatically enabled by the login process.
57 | #
58 | # add cyphertype
59 | # Default is 3des.
60 | #
61 | # add identity
62 | # Default is your default ssh identity.
63 | #
64 | # include
65 | # include a secondary .cloginrc file
66 | #
67 | #
68 | # Note: The first match for a hostname takes precedence. The -[Mm] options
69 | # are useful for debugging cloginrc issues.
70 | #
71 | # Also see cloginrc(5) and clogin(1).
72 |
73 | #add password sl-bb*-dc cow24
74 | #add password sl-gw*-dc geeks
75 | #add password sl* hank dog
76 | #add password at* pete cow
77 | #add password sdn* mujahid horse
78 | #add password icm* peter
79 | #add password * anything
80 | #
81 | #add user sl-gw*-dc twit
82 | #add user sdn* sdn_auto
83 | #add user sdn-bb* ops_eng
84 | #add user * $env(USER)
85 |
86 | # customer x
87 | # these routers ask for a username and password. we automatically get
88 | # enable access after successful authentication.
89 | add user *.custx.net roger
90 | add password *.custx.net {doger}
91 | add autoenable *.custx.net 1
92 |
93 | # customer y
94 | # this is the normal cisco login. a password followed by and enable password.
95 | # try ssh first, then rlogin.
96 | add password *.custy.net {vector} {victor}
97 | add method *.custy.net ssh rlogin
98 |
99 | # customer z; they use ssh only.
100 | add user *.custz.net shirley
101 | add password *.custz.net {jive} {surely}
102 | add method *.custz.net ssh
103 |
104 | # the route-server's do not provide enable access. cmdline -noenable
105 | # equivalent.
106 | add noenable route-server* 1
107 |
108 | # all our routers, i.e.: everything else
109 | add password * {clearance} {clarence}
110 |
111 | # set ssh encryption type, dflt: 3des
112 | add cyphertype * {3des}
113 |
114 | # set the username prompt to "router login:"
115 | #add userprompt * {"router login:"}
116 |
117 | # ssh identity for a juniper; used with jlogin
118 | add identity my.juniper $env(HOME)/.ssh/juniper
119 |
120 | # riverstone / enterasys / cabletron (rivlogin) example
121 | # these boxes are 'back-to-front' from cisco (i.e., ask
122 | # for vty password always, then tac+/radius if configured).
123 | #
124 | # vty password and last resort (enable) password for rivlogin
125 | add password rs3000 {vtypass} {lastresort}
126 | # if using tac+ or radius login, include these lines
127 | add user rs3000 {monster}
128 | add userpassword rs3000 {scary}
129 |
--------------------------------------------------------------------------------
/configure.regen:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # libtoolize -c -f -i;sleep 1
3 | # aclocal --force -Iaconf;sleep 1
4 | aclocal --force;sleep 1
5 | autoheader -f;sleep 1
6 | automake -a -c -f;sleep 1
7 | autoconf;sleep 1
8 |
--------------------------------------------------------------------------------
/configure.vers:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Produce package name or version from $srcdir/include/version.h.in
4 | #
5 | me=$0
6 | info=$1
7 | srcdir=`dirname $0`
8 | value=
9 | nl='
10 | '
11 | case "${info}" in
12 | package_name )
13 | value=`sed -n 's/.*package.*"\(.*\)".*/\1/p' $srcdir/include/version.h.in|tr -d ' '`
14 | ;;
15 | package_version )
16 | value=`sed -n 's/.*version.*"\(.*\)".*/\1/p' $srcdir/include/version.h.in|tr -d ' '`
17 | ;;
18 | * )
19 | echo "usage $me (package_name|package_version)" >&2
20 | exit 1
21 | ;;
22 | esac
23 |
24 | # remove trailing newline
25 | echo "${value}" | tr -d "$nl"
26 |
--------------------------------------------------------------------------------
/etc/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 | ## A Makefile.in is supplied, in case you do not have automake.
3 |
4 | #AUTOMAKE_OPTIONS=foreign no-dependencies
5 | AUTOMAKE_OPTIONS=foreign
6 |
7 | sysconf_DATA= rancid.types.base
8 | pkgdata_nogen = rancid.types.conf
9 | pkgdata_gen = lg.conf.sample rancid.conf.sample
10 | pkgdata_DATA = $(pkgdata_nogen) $(pkgdata_gen)
11 |
12 | EXTRA_DIST= $(pkgdata_gen:%=%.in) $(pkgdata_nogen) $(sysconf_DATA)
13 |
14 | CLEANFILES= $(pkgdata_gen)
15 |
16 | if CONF_INSTALL
17 | DO_CONF_INSTALL=yes
18 | endif
19 |
20 | install-data-local: all
21 | @if test "$(DO_CONF_INSTALL)" = "yes"; then \
22 | if test -f $(DESTDIR)$(sysconfdir)/rancid.conf ; then \
23 | echo ""; \
24 | echo "WARNING: *** $(DESTDIR)$(sysconfdir)/rancid.conf exists. See "; \
25 | echo " *** $(pkgdatadir)/rancid.conf.sample for new"; \
26 | echo " *** examples."; \
27 | echo ""; \
28 | else \
29 | $(INSTALL_DATA) rancid.conf.sample $(DESTDIR)$(sysconfdir)/rancid.conf; \
30 | fi; \
31 | if test ! -f $(DESTDIR)$(sysconfdir)/rancid.types.conf ; then \
32 | $(INSTALL_DATA) rancid.types.conf $(DESTDIR)$(sysconfdir)/rancid.types.conf; \
33 | fi; \
34 | if test -f $(DESTDIR)$(sysconfdir)/lg.conf ; then \
35 | echo ""; \
36 | echo "WARNING: *** $(DESTDIR)$(sysconfdir)/lg.conf exists. See "; \
37 | echo " *** $(pkgdatadir)/lg.conf.sample for new"; \
38 | echo " *** examples."; \
39 | echo ""; \
40 | else \
41 | $(INSTALL_DATA) lg.conf.sample $(DESTDIR)$(sysconfdir)/lg.conf; \
42 | fi; \
43 | fi; \
44 | $(INSTALL_DATA) rancid.types.base $(DESTDIR)$(sysconfdir)/rancid.types.base
45 |
46 | #clean:
47 | # rm -f Makefile rancid.conf $(BIN_DATAS) $(BIN_PROGS)
48 |
49 | # auto_edit does the autoconf variable substitution. This allows the
50 | # substitution to have the full expansion of the variables, e.g.: $sysconfdir
51 | # will be /prefix/etc instead of ${prefix}/etc.
52 | #
53 | # This is a bit of a PITA, but is the method recommended by the autoconf
54 | # documentation.
55 | auto_edit = sed \
56 | -e 's,@bindir\@,$(bindir),g' \
57 | -e 's,@prefix\@,$(prefix),g' \
58 | -e 's,@localstatedir\@,$(localstatedir),g' \
59 | -e 's,@pkglibdir\@,$(pkglibdir),g' \
60 | -e 's,@sysconfdir\@,$(sysconfdir),g' \
61 | -e 's,@EXPECT_PATH\@,$(EXPECT_PATH),g' \
62 | -e 's,@PERLV_PATH\@,$(PERLV_PATH),g' \
63 | -e 's,@PYTHON3\@,$(PYTHON3),g' \
64 | -e 's,@PYTHON3_PATH\@,$(PYTHON3_PATH),g' \
65 | -e 's,@ENV_PATH\@,$(ENV_PATH),g' \
66 | -e 's,@RCSSYS\@,$(RCSSYS),g' \
67 | -e 's,@PACKAGE\@,$(PACKAGE),g' \
68 | -e 's,@SENDMAIL\@,$(SENDMAIL),g' \
69 | -e 's,@VERSION\@,$(VERSION),g'
70 |
71 | lg.conf.sample: Makefile $(srcdir)/lg.conf.sample.in
72 | rm -f lg.conf.sample lg.conf.sample.tmp; \
73 | $(auto_edit) $(srcdir)/lg.conf.sample.in >lg.conf.sample.tmp; \
74 | mv lg.conf.sample.tmp lg.conf.sample
75 |
76 | rancid.conf.sample: Makefile $(srcdir)/rancid.conf.sample.in
77 | rm -f rancid.conf.sample rancid.conf.sample.tmp; \
78 | $(auto_edit) $(srcdir)/rancid.conf.sample.in >rancid.conf.sample.tmp; \
79 | mv rancid.conf.sample.tmp rancid.conf.sample
80 |
--------------------------------------------------------------------------------
/etc/rancid.conf.sample.in:
--------------------------------------------------------------------------------
1 | # @PACKAGE@ @VERSION@
2 | # This file sets up the environment used for rancid. see rancid.conf(5)
3 | #
4 | # This will be site specific
5 | #
6 | TERM=network;export TERM
7 | #
8 | # Collating locale
9 | LC_COLLATE="POSIX"; export LC_COLLATE
10 | #
11 | # Create files w/o world read/write/exec permissions, but read/exec permissions
12 | # for group.
13 | umask 027
14 | #
15 | # Set the perl module search path. perl -V shows the default
16 | PERL5LIB="@pkglibdir@"; export PERL5LIB
17 | #
18 | # Under BASEDIR (i.e.: --localstatedir), there will be a "logs" directory for
19 | # the logs from rancid and a directory for each group of routers defined in
20 | # LIST_OF_GROUPS (below). In addition to these, there will be a "CVS"
21 | # directory which is the cvs (or Subversion) repository.
22 | #
23 | # Use a full path (no sym-links) for BASEDIR.
24 | #
25 | TMPDIR=/tmp; export TMPDIR
26 | # Be careful changing this, it affects CVSROOT below. It should be a FQPN, not
27 | # relative.
28 | BASEDIR=@localstatedir@; export BASEDIR
29 | PATH=@bindir@:@ENV_PATH@; export PATH
30 | #
31 | # Check that the effective UID is not root, which could lead to permissions
32 | # problems for user who is supposed to be running rancid. If you know what
33 | # you are doing, disable this check by commenting these lines.
34 | uid=`perl -e 'print "$>"'`
35 | if [ -e /proc/1/cgroup ] ; then
36 | DOCKER=`cat /proc/1/cgroup | grep "cpu.*/docker"`
37 | fi
38 | test "x$DOCKER" = "x" && test "$uid" -eq 0 && echo "Do not run $0 as root!" && exit 1
39 | #
40 | # Set to the name of the sendmail executable (or script) that will accept the
41 | # -t option to take its rcpt and other headers from stdin and $MAILOPTS (see
42 | # below).
43 | SENDMAIL="@SENDMAIL@"
44 | #
45 | # Location of the CVS/SVN/GIT repository(ies). Be careful changing this.
46 | # If RCSSYS is svn or git, this can be:
47 | # - an (absolute) path (a subdirectory of BASEDIR by default). BASEDIR/CVS,
48 | # BASEDIR/.svn, or BASEDIR/.scm; the name does not matter, but do not use
49 | # BASEDIR/.git, as it will confuse git.
50 | # - for git, there will be a repository under CVSROOT for each rancid group.
51 | # - any URL that git or subversion understand, but beware that:
52 | # - no attempt will be made to create the repository when running rancid-cvs.
53 | # - authentication credentials, if necessary, MUST be cached (see the SVN
54 | # book, Ch. 3, Network Model, Caching credentials) before non-interactive
55 | # commands can run, e.g. by running rancid-cvs after installation.
56 | # - for git, it is likely easiest to leave CVSROOT as a local path, use
57 | # rancid-cvs to create the repository for groups, then move those
58 | # repositories to the remote and update the group's .git/config.
59 | CVSROOT=$BASEDIR/CVS; export CVSROOT
60 | # Location of log files produced by rancid-run(1).
61 | LOGDIR=$BASEDIR/logs; export LOGDIR
62 | #
63 | # Select which RCS system to use, "cvs" (default), "svn" or "git". Do not
64 | # change this after CVSROOT has been created with rancid-cvs. Changing between
65 | # these requires manual conversions.
66 | RCSSYS=@RCSSYS@; export RCSSYS
67 | #
68 | # If ACLFILTERREGEX is non-empty, it is a semi-colon-separated (';') list of
69 | # regexes. The contents of ACLs whose name matches a regex in this list will
70 | # be filtered. The purpose of this feature is to filter auto-generated lists,
71 | # thereby reducing the churn within rancid. This option implies
72 | # ACLFILTERSEQ=YES.
73 | # Not all device types nor ACL types are supported by this feature.
74 | #ACLFILTERREGEX='^Auto_;_bgp$'; export ACLFILTERREGEX
75 | #
76 | # if ACLFILTERSEQ is NO, prefix-list/access-list sequence numbers will NOT be
77 | # filtered. this option implies ACLSORT=NO for lists with sequence numbers.
78 | #ACLFILTERSEQ=YES; export ACLFILTERSEQ
79 | #
80 | # if ACLSORT is NO, access-lists will NOT be sorted.
81 | #ACLSORT=YES; export ACLSORT
82 | #
83 | # FILTER_PWDS determines which passwords are filtered from configs by the
84 | # value set (NO | YES | ALL). see rancid.conf(5).
85 | #FILTER_PWDS=YES; export FILTER_PWDS
86 | #
87 | # if NOCOMMSTR is set to YES, snmp community strings will be stripped from the
88 | # configs.
89 | #NOCOMMSTR=YES; export NOCOMMSTR
90 | #
91 | # FILTER_OSC determines if oscillating data such as keys, passwords, etc are
92 | # filtered from configs by the value set (NO | YES | ALL). FILTER_PWDS may
93 | # override this. see rancid.conf(5).
94 | #FILTER_OSC=YES; export FILTER_OSC
95 | #
96 | # How many times failed collections are retried (for each run) before
97 | # giving up. Minimum: 0
98 | #MAX_ROUNDS=4; export MAX_ROUNDS
99 | #
100 | # How many hours should pass before complaining about routers that
101 | # can not be reached. The value should be greater than the number
102 | # of hours between your rancid-run cron job. Default: 24
103 | #OLDTIME=4; export OLDTIME
104 | #
105 | # How many hours should pass before complaining that a group's collection
106 | # (the age of it's lock file) is hung.
107 | #LOCKTIME=4; export LOCKTIME
108 | #
109 | # The number of devices to collect simultaneously.
110 | #PAR_COUNT=5; export PAR_COUNT
111 | #
112 | # list of rancid groups
113 | #LIST_OF_GROUPS="sl joebobisp"; export LIST_OF_GROUPS
114 | # more groups...
115 | #LIST_OF_GROUPS="$LIST_OF_GROUPS noc billybobisp"; export LIST_OF_GROUPS
116 | #
117 | # Define an alternate filter for the output of the RCS diff. The filter
118 | # should read from stdin and write to stdout. The default is defined in
119 | # control_rancid and just improves readability.
120 | #DIFFSCRIPT="filter1 | filter2"; export DIFFSCRIPT
121 | #
122 | # For each group, define a list of people to receive the diffs.
123 | # in sendmail's /etc/aliases.
124 | # rancid-group: joe,moe@foo
125 | # rancid-admin-group: hostmaster
126 | # be sure to read ../README regarding aliases.
127 | #
128 | # If your MTA configuration is broken or you want mail to be forwarded to a
129 | # domain not the same as the local one, define that domain here. "@" must be
130 | # included, as this is simply appended to the usual recipients. It is NOT
131 | # appended to recipients specified in rancid-run's -m option.
132 | #MAILDOMAIN="@example.com"; export MAILDOMAIN
133 | #
134 | # By default, rancid mail is marked with precedence "bulk" and etc, as in the
135 | # example. This may be changed by setting the MAILHEADERS variable; for
136 | # example no header by setting it to "" or adding X- style headers. Individual
137 | # headers must be separated by a \n.
138 | #MAILHEADERS="Precedence: bulk\nAuto-submitted: auto-generated\nX-Auto-Response-Suppress: All"; export MAILHEADERS
139 | #
140 | # Additional options for sendmail(8).
141 | #MAILOPTS="-f bounces.go.here@example.com"; export MAILOPTS
142 | #
143 | # Split diffs larger then N kbytes
144 | #MAILSPLIT=0; export MAILSPLIT
145 |
--------------------------------------------------------------------------------
/etc/rancid.types.base.powerconnect:
--------------------------------------------------------------------------------
1 | diff --git a/etc/rancid.types.base b/etc/rancid.types.base
2 | index 33734a19..b3dc95bc 100644
3 | --- a/etc/rancid.types.base
4 | +++ b/etc/rancid.types.base
5 | @@ -641,6 +641,13 @@ paloalto;command;panos::ShowInfo;show system info
6 | paloalto;command;panos::ShowInventory;show chassis inventory
7 | paloalto;command;panos::ShowConfig;show config running
8 | #
9 | +powerconnect;script;rancid -t powerconnect
10 | +powerconnect;login;clogin
11 | +powerconnect;module;powerconnect
12 | +powerconnect;inloop;powerconnect::inloop
13 | +powerconnect;command;powerconnect::GetSystem;show switch
14 | +powerconnect;command;powerconnect::GetConf;show running-config
15 | +#
16 | redback;script;rrancid
17 | redback;login;clogin
18 | #
19 |
--------------------------------------------------------------------------------
/etc/rancid.types.conf:
--------------------------------------------------------------------------------
1 | # RANCiD device type configuration.
2 | #
3 | # DO NOT override the base types. Copy them from rancid.types.base and rename
4 | # them. If you override existing types, it will be harder to provide support
5 | # to you and we will secretly despise you.
6 | #
7 | # Collect UCS and its nexus switch. This is not the cleanest nor complete.
8 | cisco-ucs;script;rancid -t cisco-ucs
9 | cisco-ucs;login;clogin
10 | cisco-ucs;module;nxos
11 | cisco-ucs;inloop;nxos::inloop
12 | cisco-ucs;command;nxos::ShowVersion;show version | no more
13 | cisco-ucs;command;nxos::WriteTerm;show configuration | no more
14 | cisco-ucs;command;rancid::RunCommand;connect nxos
15 | cisco-ucs;command;nxos::ShowVersion;show version
16 | cisco-ucs;command;nxos::WriteTerm;show running-config
17 | cisco-ucs;command;rancid::RunCommand;exit
18 | #
19 | # The jlocal example device type for Juniper JUNOS is a copy of the normal
20 | # juniper type, except that it pipes the show configuration output to display
21 | # set.
22 | #
23 | jlocal;script;rancid -t jlocal
24 | jlocal;login;jlogin
25 | jlocal;module;junos
26 | jlocal;inloop;junos::inloop
27 | jlocal;command;junos::ShowChassisClocks;show chassis clocks
28 | jlocal;command;junos::ShowChassisEnvironment;show chassis environment
29 | jlocal;command;junos::ShowChassisFirmware;show chassis firmware
30 | jlocal;command;junos::ShowChassisFpcDetail;show chassis fpc detail
31 | jlocal;command;junos::ShowChassisHardware;show chassis hardware detail
32 | jlocal;command;junos::ShowChassisHardware;show chassis hardware models
33 | jlocal;command;junos::ShowChassisRoutingEngine;show chassis routing-engine
34 | jlocal;command;junos::ShowChassisSCB;show chassis scb
35 | jlocal;command;junos::ShowChassisSCB;show chassis sfm detail
36 | jlocal;command;junos::ShowChassisSCB;show chassis ssb
37 | jlocal;command;junos::ShowChassisSCB;show chassis feb detail
38 | jlocal;command;junos::ShowChassisSCB;show chassis feb
39 | jlocal;command;junos::ShowChassisSCB;show chassis cfeb
40 | jlocal;command;junos::ShowChassisAlarms;show chassis alarms
41 | jlocal;command;junos::ShowSystemLicense;show system license
42 | jlocal;command;junos::ShowSystemBootMessages;show system boot-messages
43 | jlocal;command;junos::ShowSystemCoreDumps;show system core-dumps
44 | jlocal;command;junos::ShowVersion;show version detail
45 | jlocal;command;junos::ShowConfiguration;show configuration | display set
46 | #
47 | # juniper configuration database tracking
48 | juniper-cdb;script;rancid -t juniper-cdb
49 | juniper-cdb;login;jlogin
50 | juniper-cdb;module;junos
51 | juniper-cdb;inloop;junos::inloop
52 | juniper-cdb;command;junos::ShowSystemConfDB;show system configuration database usage
53 | #
54 | # save copies in rancid of configs from /tftpboot
55 | tftpcopy;script;rtftpcopy
56 | #
57 | # Like type cisco, but uses show tech instead of show running-config, which
58 | # does not display passwords. This is a good example of using two modules
59 | # together to augment the base module.
60 | ciscoshtech;script;rancid -t ciscoshtech
61 | ciscoshtech;login;clogin
62 | ciscoshtech;module;ios
63 | ciscoshtech;module;iosshtech
64 | ciscoshtech;inloop;ios::inloop
65 | ciscoshtech;command;ios::ShowVersion;show version
66 | ciscoshtech;command;ios::ShowRedundancy;show redundancy secondary
67 | ciscoshtech;command;ios::ShowIDprom;show idprom backplane
68 | ciscoshtech;command;ios::ShowInstallActive;show install active
69 | ciscoshtech;command;ios::ShowEnv;show env all
70 | ciscoshtech;command;ios::ShowRSP;show rsp chassis-info
71 | ciscoshtech;command;ios::ShowGSR;show gsr chassis
72 | ciscoshtech;command;ios::ShowGSR;show diag chassis-info
73 | ciscoshtech;command;ios::ShowBoot;show boot
74 | ciscoshtech;command;ios::ShowBoot;show bootvar
75 | ciscoshtech;command;ios::ShowBoot;show variables boot
76 | ciscoshtech;command;ios::ShowLicense;show license udi
77 | ciscoshtech;command;ios::ShowLicense;show license feature
78 | ciscoshtech;command;ios::ShowLicense;show license
79 | ciscoshtech;command;ios::ShowLicense;show license summary
80 | ciscoshtech;command;ios::ShowFlash;show flash:
81 | ciscoshtech;command;ios::DirSlotN;dir /all nvram:
82 | ciscoshtech;command;ios::DirSlotN;dir /all bootflash:
83 | ciscoshtech;command;ios::DirSlotN;dir /all slot0:
84 | ciscoshtech;command;ios::DirSlotN;dir /all disk0:
85 | ciscoshtech;command;ios::DirSlotN;dir /all slot1:
86 | ciscoshtech;command;ios::DirSlotN;dir /all disk1:
87 | ciscoshtech;command;ios::DirSlotN;dir /all slot2:
88 | ciscoshtech;command;ios::DirSlotN;dir /all disk2:
89 | ciscoshtech;command;ios::DirSlotN;dir /all harddisk:
90 | ciscoshtech;command;ios::DirSlotN;dir /all harddiska:
91 | ciscoshtech;command;ios::DirSlotN;dir /all harddiskb:
92 | ciscoshtech;command;ios::DirSlotN;dir /all sup-bootdisk:;c6500 sup32
93 | ciscoshtech;command;ios::DirSlotN;dir /all sup-bootflash:;c6500 ios
94 | ciscoshtech;command;ios::DirSlotN;dir /all sup-microcode:;c6500 ios
95 | ciscoshtech;command;ios::DirSlotN;dir /all slavenvram:
96 | ciscoshtech;command;ios::DirSlotN;dir /all slavebootflash:
97 | ciscoshtech;command;ios::DirSlotN;dir /all slaveslot0:
98 | ciscoshtech;command;ios::DirSlotN;dir /all slavedisk0:
99 | ciscoshtech;command;ios::DirSlotN;dir /all slaveslot1:
100 | ciscoshtech;command;ios::DirSlotN;dir /all slavedisk1:
101 | ciscoshtech;command;ios::DirSlotN;dir /all slaveslot2:
102 | ciscoshtech;command;ios::DirSlotN;dir /all slavedisk2:
103 | ciscoshtech;command;ios::DirSlotN;dir /all slavesup-bootflash:;c7600
104 | ciscoshtech;command;ios::DirSlotN;dir /all sec-nvram:
105 | ciscoshtech;command;ios::DirSlotN;dir /all sec-bootflash:
106 | ciscoshtech;command;ios::DirSlotN;dir /all sec-slot0:
107 | ciscoshtech;command;ios::DirSlotN;dir /all sec-disk0:
108 | ciscoshtech;command;ios::DirSlotN;dir /all sec-slot1:
109 | ciscoshtech;command;ios::DirSlotN;dir /all sec-disk1:
110 | ciscoshtech;command;ios::DirSlotN;dir /all sec-slot2:
111 | ciscoshtech;command;ios::DirSlotN;dir /all sec-disk2:
112 | ciscoshtech;command;ios::ShowContAll;show controllers
113 | ciscoshtech;command;ios::ShowContCbus;show controllers cbus
114 | ciscoshtech;command;ios::ShowDiagbus;show diagbus
115 | ciscoshtech;command;ios::ShowDiag;show diag
116 | ciscoshtech;command;ios::ShowModule;show module;c6500 ios
117 | ciscoshtech;command;ios::ShowSpeVersion;show spe version
118 | ciscoshtech;command;ios::ShowC7200;show c7200
119 | ciscoshtech;command;ios::ShowCellular;show cellular 0 profile;Cellular modem
120 | ciscoshtech;command;ios::ShowInventory;show inventory raw
121 | ciscoshtech;command;ios::ShowVTP;show vtp status
122 | ciscoshtech;command;ios::ShowVLAN;show vlan
123 | ciscoshtech;command;ios::ShowVLAN;show vlan-switch
124 | ciscoshtech;command;ios::ShowDetail;show switch detail
125 | ciscoshtech;command;ios::ShowSDM;show sdm prefer
126 | ciscoshtech;command;ios::ShowMTU;show system mtu
127 | ciscoshtech;command;ios::ShowDebug;show debug
128 | ciscoshtech;command;iosshtech::WriteTerm;show tech-support
129 | #
130 |
--------------------------------------------------------------------------------
/include/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 | ## A Makefile.in is supplied, in case you do not have automake.
3 |
4 | ## Copyright (c) 1997-2019 by Henry Kilmer and John Heasley
5 | ## All rights reserved.
6 | ##
7 | ## Please see the file COPYING for the text of the license.
8 |
9 | #AUTOMAKE_OPTIONS=foreign no-dependencies
10 | AUTOMAKE_OPTIONS=foreign
11 |
12 | @SET_MAKE@
13 |
14 | noinst_HEADERS= config.h version.h
15 |
16 | # no idea why automake doesnt clean these targets
17 | CLEANFILES= stamp-h stamp-h1
18 |
19 | all:
20 |
21 |
--------------------------------------------------------------------------------
/include/stamp-h.in:
--------------------------------------------------------------------------------
1 | timestamp
2 |
--------------------------------------------------------------------------------
/include/version.h.in:
--------------------------------------------------------------------------------
1 | #ifndef VERSION_H
2 |
3 | #define VERSION_H
4 |
5 | /* pkg version */
6 | char package[] = "rancid";
7 | char version[] = "3.14";
8 |
9 | #endif
10 |
--------------------------------------------------------------------------------
/lib/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 | ## A Makefile.in is supplied, in case you do not have automake.
3 |
4 | AUTOMAKE_OPTIONS=foreign no-dependencies
5 |
6 | my_pkglibdir = $(pkglibdir)
7 | my_pkglib_DATA = rancid.pm rancidcontrib.pm \
8 | acos.pm aeos.pm arbor.pm arcos.pm avocent.pm \
9 | bigip.pm ciscowlc.pm \
10 | dell.pm dnos9.pm dnos10.pm edgemax.pm edgerouter.pm exos.pm \
11 | fortigate.pm foundry.pm frr.pm fss2.pm fxos.pm \
12 | ios.pm iossb.pm iosshtech.pm iosxr.pm junos.pm mrv.pm nxos.pm \
13 | panos.pm rbt.pm routeros.pm smc.pm sros.pm vrp.pm wavesvros.pm
14 | pkglib_in = $(my_pkglib_DATA:%=%.in)
15 |
16 | RANLIB= :
17 |
18 | EXTRA_DIST= $(pkglib_in)
19 | ##dist_bin_SCRIPTS= $(bin_SCRIPTS:%=%.in)
20 |
21 | CLEANFILES= rancid
22 | CLEANFILES+= $(my_pkglib_DATA)
23 |
24 | #clean:
25 | # rm -f Makefile env $(BIN_DATAS) $(BIN_PROGS)
26 |
27 | # auto_edit does the autoconf variable substitution. This allows the
28 | # substitution to have the full expansion of the variables, e.g.: $sysconfdir
29 | # will be /prefix/etc instead of ${prefix}/etc.
30 | #
31 | # This is a bit of a PITA, but is the method recommended by the autoconf
32 | # documentation.
33 | auto_edit = sed \
34 | -e 's,@bindir\@,$(bindir),g' \
35 | -e 's,@prefix\@,$(prefix),g' \
36 | -e 's,@localstatedir\@,$(localstatedir),g' \
37 | -e 's,@sysconfdir\@,$(sysconfdir),g' \
38 | -e 's,@EXPECT_PATH\@,$(EXPECT_PATH),g' \
39 | -e 's,@ENV_PATH\@,$(ENV_PATH),g' \
40 | -e 's,@PERLV\@,$(PERLV),g' \
41 | -e 's,@PERLV_PATH\@,$(PERLV_PATH),g' \
42 | -e 's,@PYTHON3\@,$(PYTHON3),g' \
43 | -e 's,@PYTHON3_PATH\@,$(PYTHON3_PATH),g' \
44 | -e 's,@LG_PING_CMD\@,$(LG_PING_CMD),g' \
45 | -e 's,@ADMINMAILPLUS\@,$(ADMINMAILPLUS),g' \
46 | -e 's,@MAILPLUS\@,$(MAILPLUS),g' \
47 | -e 's,@PACKAGE\@,$(PACKAGE),g' \
48 | -e 's,@RCSSYS\@,$(RCSSYS),g' \
49 | -e 's,@SENDMAIL\@,$(SENDMAIL),g' \
50 | -e 's,@SVN_FSTYPE\@,$(SVN_FSTYPE),g' \
51 | -e 's,@VERSION\@,$(VERSION),g' \
52 | -e 's,@COPYYEARS\@,$(COPYYEARS),g' \
53 | -e '/@copyright@/r ../COPYING' \
54 | -e '/@copyright@/d'
55 |
56 | $(pkglib_in:%.in=%): Makefile $(top_builddir)/config.status
57 | rm -f $@ $@.tmp; \
58 | $(auto_edit) $(srcdir)/$@.in >$@.tmp; \
59 | chmod +r $@.tmp; \
60 | mv $@.tmp $@
61 | # XXX there must be a better way to produce these dependencies, perhaps in
62 | # configure.
63 | acos.pm: acos.pm.in
64 | aeos.pm: aeos.pm.in
65 | arbor.pm: arbor.pm.in
66 | arcos.pm: arcos.pm.in
67 | avocent.pm: avocent.pm.in
68 | bigip.pm: bigip.pm.in
69 | ciscowlc.pm: ciscowlc.pm.in
70 | dell.pm: dell.pm.in
71 | dnos9.pm: dnos9.pm.in
72 | dnos10.pm: dnos10.pm.in
73 | edgemax.pm: edgemax.pm.in
74 | edgerouter.pm: edgerouter.pm.in
75 | exos.pm: exos.pm.in
76 | fortigate.pm: fortigate.pm.in
77 | foundry.pm: foundry.pm.in
78 | frr.pm: frr.pm.in
79 | fss2.pm: fss2.pm.in
80 | fxos.pm: fxos.pm.in
81 | ios.pm: ios.pm.in
82 | iossb.pm: iossb.pm.in
83 | iosshtech.pm: iosshtech.pm.in
84 | iosxr.pm: iosxr.pm.in
85 | junos.pm: junos.pm.in
86 | rancid.pm: rancid.pm.in
87 | rancidcontrib.pm: rancidcontrib.pm.in
88 | rancid.py: rancid.py.in
89 | mrv.pm: mrv.pm.in
90 | nxos.pm: nxos.pm.in
91 | panos.pm: panos.pm.in
92 | rbt.pm: rbt.pm.in
93 | routeros.pm: routeros.pm.in
94 | smc.pm: smc.pm.in
95 | sros.pm: sros.pm.in
96 | vrp.pm: vrp.pm.in
97 | wavesvros.pm: wavesvros.pm.in
98 |
--------------------------------------------------------------------------------
/lib/acos.pm.in:
--------------------------------------------------------------------------------
1 | package acos;
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | @copyright@
5 | #
6 | # RANCID - Really Awesome New Cisco confIg Differ
7 | #
8 | # a10.pm - A10 rancid procedures
9 |
10 | use 5.010;
11 | use strict 'vars';
12 | use warnings;
13 | no warnings 'uninitialized';
14 | require(Exporter);
15 | our @ISA = qw(Exporter);
16 |
17 | use rancid @VERSION@;
18 |
19 | @ISA = qw(Exporter rancid main);
20 |
21 | # load-time initialization
22 | sub import {
23 | 0;
24 | }
25 |
26 | # post-open(collection file) initialization
27 | sub init {
28 | # add content lines and separators
29 | ProcessHistory("","","","!RANCID-CONTENT-TYPE: $devtype\n!\n");
30 |
31 | 0;
32 | }
33 |
34 | # main loop of input of device output
35 | sub inloop {
36 | my($INPUT, $OUTPUT) = @_;
37 | my($cmd, $rval);
38 |
39 | TOP: while(<$INPUT>) {
40 | tr/\015//d;
41 | CMD: if (/[>#]\s?exit$/) {
42 | $clean_run = 1;
43 | last;
44 | }
45 | if (/^Error:/) {
46 | print STDOUT ("$host a10login error: $_");
47 | print STDERR ("$host a10login error: $_") if ($debug);
48 | $clean_run = 0;
49 | last;
50 | }
51 | while (/[>#]\s*($cmds_regexp)\s*$/) {
52 | $cmd = $1;
53 | if (!defined($prompt)) {
54 | $prompt = ($_ =~ /^([^#>]+[#>])/)[0];
55 | $prompt =~ s/([][}{)(+\\])/\\$1/g;
56 | print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
57 | }
58 | print STDERR ("HIT COMMAND:$_") if ($debug);
59 | if (! defined($commands{$cmd})) {
60 | print STDERR "$host: found unexpected command - \"$cmd\"\n";
61 | $clean_run = 0;
62 | last TOP;
63 | }
64 | $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
65 | delete($commands{$cmd});
66 | if ($rval == -1) {
67 | $clean_run = 0;
68 | last TOP;
69 | }
70 | if (defined($prompt)) {
71 | if (/$prompt/) {
72 | goto CMD;
73 | }
74 | }
75 | }
76 | }
77 | }
78 |
79 | sub basicFilter {
80 | my($INPUT, $OUTPUT, $cmd, $prefix) = @_;
81 |
82 | while (<$INPUT>) {
83 | tr/\015//d;
84 | next if (/^\s*$/);
85 | next if (/^\s*\^$/); # cli cmd error marker
86 | return(1) if (/% unrecognized command/i); # cli cmd error
87 | return(1) if (/% incomplete command/i); # cli cmd error
88 | last if (/$prompt/);
89 |
90 | s/\s*$/\n/; # trim trailing WS
91 | ProcessHistory($prefix,"","","!$prefix: $_");
92 | }
93 | ProcessHistory($prefix,"","","!\n");
94 | return(0);
95 | }
96 |
97 | # parses show version
98 | sub ShowVersion {
99 | my($INPUT, $OUTPUT, $cmd) = @_;
100 | print STDERR " In ShowVersion: $_" if ($debug);
101 |
102 | while (<$INPUT>) {
103 | tr/\015//d;
104 | next if /^\s*$/;
105 | last if (/$prompt/);
106 |
107 | next if (/Current time is/);
108 | next if (/The system has been up/);
109 | next if (/Last configuration saved/);
110 | next if (/Free Memory/);
111 | ProcessHistory("VERSION","","","!VERSION: $_");
112 | }
113 | ProcessHistory("VERSION","","","!\n");
114 | return(0);
115 | }
116 |
117 | # parses show admin
118 | sub ShowAdmin {
119 | my($INPUT, $OUTPUT, $cmd) = @_;
120 | print STDERR " In ShowAdmin: $_" if ($debug);
121 | return basicFilter($INPUT, $OUTPUT, $cmd, "Users");
122 | }
123 |
124 | sub ShowAflex {
125 | my($INPUT, $OUTPUT, $cmd) = @_;
126 | print STDERR " In ShowAflex: $_" if ($debug);
127 |
128 | while (<$INPUT>) {
129 | tr/\015//d;
130 | next if /^\s*$/;
131 | last if (/^$prompt/);
132 | return(1) if (/% unrecognized command\./i); # not in CGN/LSN image
133 |
134 | s/\s*$/\n/; # trim trailing WS
135 | ProcessHistory("AFLEX", "", "", "!AFLEX: $_");
136 | }
137 | while (/show aflex (\S+) partition/) {
138 | my($name) = $1;
139 | my($found_content) = 0;
140 |
141 | ProcessHistory("AFLEX-$name", "", "", "aflex create $name\n");
142 | while (<$INPUT>) {
143 | tr/\015//d;
144 | last if (/^$prompt/);
145 |
146 | if ($found_content) {
147 | ProcessHistory("AFLEX-$name", "", "", "$_");
148 | } elsif (/^Content:/) {
149 | $found_content = 1
150 | }
151 | }
152 | if ($found_content) {
153 | ProcessHistory("AFLEX-$name", "", "", ".\n");
154 | }
155 | }
156 | ProcessHistory("ADMIN","","","!\n");
157 | return(0);
158 | }
159 |
160 | # parses show bootimage
161 | sub ShowBootimage {
162 | my($INPUT, $OUTPUT, $cmd) = @_;
163 | print STDERR " In ShowBootimage: $_" if ($debug);
164 | return basicFilter($INPUT, $OUTPUT, $cmd, "BootImage");
165 | }
166 |
167 | # parses show license
168 | sub ShowLicense {
169 | my($INPUT, $OUTPUT, $cmd) = @_;
170 | print STDERR " In ShowLicense: $_" if ($debug);
171 | return basicFilter($INPUT, $OUTPUT, $cmd, "LICENSE");
172 | }
173 |
174 | # parses show running-config
175 | sub ShowRunningConfig {
176 | my($INPUT, $OUTPUT, $cmd) = @_;
177 | my $comment = 0;
178 | print STDERR " In ShowRunningConfig: $_" if ($debug);
179 |
180 | while (<$INPUT>) {
181 | tr/\015//d;
182 | next if (/^\s*$/);
183 | next if (/^\s*\^$/); # cli cmd error marker
184 | return(1) if (/% unrecognized command/i); # cli cmd error
185 | last if (/^$prompt/);
186 | return(1) if (/invalid (input|command) detected/i);
187 |
188 | # skip consecutive comment lines
189 | if (/^!\s*$/) {
190 | next if ($comment);
191 | ProcessHistory("CONFIG","","",$_);
192 | $comment = 1;
193 | next;
194 | }
195 | $comment = 0;
196 |
197 | next if (/^!(current configuration:|configuration last)/i);
198 | next if (/^vcs config-info/);
199 | if ((/^(.* password encrypted )\S+(.*)/ ||
200 | /^(.* secret secret-encrypted )\w+( .*)/) && $filter_pwds >= 1) {
201 | ProcessHistory("CONFIG", "", "", "$1$2\n");
202 | next;
203 | }
204 | if (/^(snmp-server community \S+ )\S+(.*)/ && $filter_commstr >= 1) {
205 | ProcessHistory("CONFIG", "", "", "!$1$2\n");
206 | next;
207 | }
208 | ProcessHistory("CONFIG","","","$_");
209 | if (/^end/) {
210 | $found_end = 1;
211 | }
212 | }
213 | ProcessHistory("CONFIG","","","\n");
214 |
215 | return(0);
216 | }
217 |
218 | # parses show vlan
219 | sub ShowVlan {
220 | my($INPUT, $OUTPUT, $cmd) = @_;
221 | print STDERR " In ShowVlan: $_" if ($debug);
222 | return basicFilter($INPUT, $OUTPUT, $cmd, "VLAN");
223 | }
224 |
225 | 1;
226 |
--------------------------------------------------------------------------------
/lib/avocent.pm.in:
--------------------------------------------------------------------------------
1 | package avocent;
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | @copyright@
5 | #
6 | # RANCID - Really Awesome New Cisco confIg Differ
7 | #
8 | # avocent.pm - Avocent ACS rancid procedures
9 | # (formerly Cyclades)
10 |
11 | use 5.010;
12 | use strict 'vars';
13 | use warnings;
14 | require(Exporter);
15 | our @ISA = qw(Exporter);
16 | #$Exporter::Verbose=1;
17 |
18 | use rancid @VERSION@;
19 |
20 | our $ShowChassisSCB; # Only run ShowChassisSCB() once
21 | our $ShowChassisFirmware; # Only run ShowChassisFirmware() once
22 |
23 |
24 | @ISA = qw(Exporter rancid main);
25 | #our @EXPORT = qw($VERSION)
26 |
27 | # load-time initialization
28 | sub import {
29 | 0;
30 | }
31 |
32 | # post-open(collection file) initialization
33 | sub init {
34 | # add content lines and separators
35 | ProcessHistory("","","","#RANCID-CONTENT-TYPE: $devtype\n#\n");
36 |
37 | 0;
38 | }
39 |
40 | # main loop of input of device output
41 | sub inloop {
42 | my($INPUT, $OUTPUT) = @_;
43 | my($cmd, $rval);
44 |
45 | TOP: while(<$INPUT>) {
46 | tr/\015//d;
47 | if (/^Error:/) {
48 | print STDOUT ("$host avologin error: $_");
49 | print STDERR ("$host avologin error: $_") if ($debug);
50 | $clean_run = 0;
51 | last;
52 | }
53 | while (/[#\$]\s*($cmds_regexp)\s*$/) {
54 | $cmd = $1;
55 | if (!defined($prompt)) {
56 | $prompt = ($_ =~ /^([^#\$]+[#\$])/)[0];
57 | $prompt =~ s/([][}{)(\\\$])/\\$1/g;
58 | print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
59 | }
60 | print STDERR ("HIT COMMAND:$_") if ($debug);
61 | if (! defined($commands{$cmd})) {
62 | print STDERR "$host: found unexpected command - \"$cmd\"\n";
63 | $clean_run = 0;
64 | last TOP;
65 | }
66 | $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
67 | delete($commands{$cmd});
68 | if ($rval == -1) {
69 | $clean_run = 0;
70 | last TOP;
71 | }
72 | }
73 | if (/[#\$]\s*exit$/) {
74 | $clean_run = 1;
75 | last;
76 | }
77 | }
78 | }
79 |
80 | # This routine parses "cat"
81 | sub CatFile {
82 | my($INPUT, $OUTPUT, $cmd) = @_;
83 | print STDERR " In CatFile: $_" if ($debug);
84 | my($catfile) = $cmd;
85 |
86 | $catfile =~ s/cat //;
87 | ProcessHistory("COMMENTS","","","# $catfile:\n");
88 | while (<$INPUT>) {
89 | tr/\015//d;
90 | last if (/^$prompt/);
91 | next if (/^(\s*|\s*$cmd\s*)$/);
92 | return(-1) if (/: Permission denied/);
93 |
94 | ProcessHistory("COMMENTS","","","$_");
95 | }
96 | ProcessHistory("COMMENTS","","","#\n");
97 | if ($catfile eq "/etc/security.opts") {
98 | $found_end = 1; $clean_run = 1;
99 | }
100 | return(0);
101 | }
102 |
103 | # This routine parses "cat" w/ output commented
104 | sub CatFileComment {
105 | my($INPUT, $OUTPUT, $cmd) = @_;
106 | print STDERR " In CatFile: $_" if ($debug);
107 | my($catfile) = $cmd;
108 |
109 | $catfile =~ s/cat //;
110 | ProcessHistory("COMMENTS","","","# $catfile:\n");
111 | while (<$INPUT>) {
112 | tr/\015//d;
113 | last if (/^$prompt/);
114 | next if (/^(\s*|\s*$cmd\s*)$/);
115 | return(-1) if (/: Permission denied/);
116 |
117 | ProcessHistory("COMMENTS","","","# $_");
118 | }
119 | ProcessHistory("COMMENTS","","","#\n");
120 | if ($catfile eq "/etc/security.opts") {
121 | $found_end = 1; $clean_run = 1;
122 | }
123 | return(0);
124 | }
125 |
126 | # This routine parses "cat /proc/meminfo"
127 | sub Meminfo {
128 | my($INPUT, $OUTPUT, $cmd) = @_;
129 | print STDERR " In Meminfo: $_" if ($debug);
130 | my($catfile) = $cmd;
131 |
132 | $catfile =~ s/cat //;
133 | ProcessHistory("COMMENTS","","","# $catfile:\n");
134 | while (<$INPUT>) {
135 | tr/\015//d;
136 | last if (/^$prompt/);
137 | next if (/^(\s*|\s*$cmd\s*)$/);
138 | return(-1) if (/: Permission denied/);
139 |
140 | if (/memtotal:\s+(\d+.*)/i) {
141 | # MemTotal: 256944 kB
142 | my($size) = bytes2human(human2bytes($1));
143 | ProcessHistory("COMMENTS","","","# Memory: total $size\n");
144 | }
145 | }
146 | ProcessHistory("COMMENTS","","","#\n");
147 | return(0);
148 | }
149 |
150 | 1;
151 |
--------------------------------------------------------------------------------
/lib/ciscowlc.pm.in:
--------------------------------------------------------------------------------
1 | package ciscowlc;
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | @copyright@
5 | #
6 | # RANCID - Really Awesome New Cisco confIg Differ
7 | #
8 | # ciscowlc.pm - Cisco WLC V4.X
9 | #
10 | # based on modified version of ciscoips by Josh Yost on 4/16/2008
11 | use 5.010;
12 | use strict 'vars';
13 | use warnings;
14 | no warnings 'uninitialized';
15 | require(Exporter);
16 | our @ISA = qw(Exporter);
17 |
18 | use rancid @VERSION@;
19 |
20 | @ISA = qw(Exporter rancid main);
21 | #XXX @Exporter::EXPORT = qw($VERSION @commandtable %commands @commands);
22 |
23 | # load-time initialization
24 | sub import {
25 | 0;
26 | }
27 |
28 | # post-open(collection file) initialization
29 | sub init {
30 | # add content lines and separators
31 | ProcessHistory("","","","!RANCID-CONTENT-TYPE: $devtype\n!\n");
32 |
33 | 0;
34 | }
35 |
36 | # main loop of input of device output
37 | sub inloop {
38 | my($INPUT, $OUTPUT) = @_;
39 | my($cmd, $rval);
40 |
41 | TOP: while(<$INPUT>) {
42 | tr/\015//d;
43 | if (/^Error:/) {
44 | print STDOUT ("$host wlogin error: $_");
45 | print STDERR ("$host wlogin error: $_") if ($debug);
46 | $clean_run = 0;
47 | last;
48 | }
49 | while (/($cmds_regexp)/) {
50 | $cmd = $1;
51 | if (!defined($prompt)) {
52 | $prompt = ($_ =~ /^([^#]+>)/)[0];
53 | $prompt =~ s/([][}{)(\\])/\\$1/g;
54 | print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
55 | }
56 | print STDERR ("HIT COMMAND:$_") if ($debug);
57 | if (! defined($commands{$cmd})) {
58 | print STDERR "$host: found unexpected command - \"$cmd\"\n";
59 | $clean_run = 0;
60 | last TOP;
61 | }
62 | if (! defined(&{$commands{$cmd}})) {
63 | printf(STDERR "$host: undefined function - \"%s\"\n",
64 | $commands{$cmd});
65 | $clean_run = 0;
66 | last TOP;
67 | }
68 | $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
69 | delete($commands{$cmd});
70 | if ($rval == -1) {
71 | $clean_run = 0;
72 | last TOP;
73 | }
74 | }
75 | if (/^.*logout(\s*connection.*closed.*)?$/i) {
76 | $clean_run = 1;
77 | last;
78 | }
79 | }
80 | }
81 |
82 | # This routine parses "show running-config"
83 | sub ShowConfig {
84 | my($INPUT, $OUTPUT, $cmd) = @_;
85 | my($linecnt) = 0;
86 | print STDERR " In ShowConfig: $_" if ($debug);
87 | ProcessHistory("","","","\n!--WLC Begin Config Data--!\n");
88 |
89 | while (<$INPUT>) {
90 | tr/\001//d; # filter garbage char
91 | tr/\015//d;
92 | tr/\020//d;
93 | last if (/^$prompt/);
94 |
95 | next if (/^\s*rogue ap classify/);
96 | next if (/^\s*rogue (adhoc|client) (alert|unknown)/i);
97 | next if (/^\s*interface nat-address management set -?[0-9]{4,}\./);
98 | next if (/\x{7f}/); # filter garbage line
99 |
100 | $linecnt++;
101 |
102 | # These can not be imported, so comment them
103 | if (/^\s*cisco public safety is not allowed to set in this domain/i ||
104 | /^\s*outdoor mesh ext.unii b domain channels:/i ||
105 | /^\s*service port.*/i ||
106 | /^\s*wlan express setup.*/i ||
107 | /^\s*wmm-ac (disabled|enabled)/i) {
108 | ProcessHistory("","","","!$_"); next;
109 | }
110 |
111 | # remove snmp community string data
112 | if (/^(\s*snmp community create)/ && $filter_pwds >= 1) {
113 | ProcessHistory("","","","!$1 \n"); next;
114 | }
115 | if (/^(\s*snmp community accessmode (ro|rw))/ && $filter_pwds >= 1) {
116 | ProcessHistory("","","","!$1 \n"); next;
117 | }
118 | if (/^(\s*snmp community ipaddr\s\S+\s\S+) / && $filter_pwds >= 1) {
119 | ProcessHistory("","","","!$1 \n"); next;
120 | }
121 |
122 | next if (/^(\s*|\s*$cmd\s*)$/);
123 |
124 | $linecnt++;
125 | if (! /^$prompt/) {
126 | ProcessHistory("","","","$_");
127 | }
128 | }
129 | ProcessHistory("","","","\n!--WLC End Config Data--!\n");
130 | # WLC lacks a definitive "end of config" marker.
131 | if ($linecnt > 5) {
132 | $found_end = 1;
133 | return(1);
134 | }
135 | return(0);
136 | }
137 |
138 | # This routine parses "show sysinfo"
139 | sub ShowSysinfo {
140 | my($INPUT, $OUTPUT, $cmd) = @_;
141 | print STDERR " In ShowSysinfo: $_" if ($debug);
142 | ProcessHistory("","","","\n!WLC Show Sysinfo Start\n!\n");
143 |
144 | while (<$INPUT>) {
145 | tr/\015//d;
146 |
147 | my($skipprocess) = 0;
148 |
149 | if (/^System Up Time/) { $skipprocess = 1; }
150 | if (/^fan status/i) { $skipprocess = 1; }
151 | if (/^Number of Active Clients/) { $skipprocess = 1; }
152 | if (/^OUI Classification Failure Count/) { $skipprocess = 1; }
153 | if (/^(memory|cpu) (current|average)/i) { $skipprocess = 1; }
154 | if (/^(mgig|internal|external) temperature/i) { $skipprocess=1; }
155 | if (/rpm$/) { $skipprocess = 1; }
156 |
157 | last if (/^$prompt/);
158 | next if (/^(\s*|\s*$cmd\s*)$/);
159 | if (! /^$prompt/) {
160 | if (! $skipprocess) {
161 | ProcessHistory("","","","! $_");
162 | }
163 | }
164 | }
165 | ProcessHistory("","","","!\n!WLC Show Sysinfo End\n");
166 | return(0);
167 | }
168 |
169 | # This routine parses "show udi"
170 | sub ShowUdi {
171 | my($INPUT, $OUTPUT, $cmd) = @_;
172 | print STDERR " In ShowUdi: $_" if ($debug);
173 | ProcessHistory("","","","\n!WLC Show Udi Start\n!\n");
174 |
175 | while (<$INPUT>) {
176 | tr/\015//d;
177 |
178 | last if (/^$prompt/);
179 | next if (/^(\s*|\s*$cmd\s*)$/);
180 | ProcessHistory("","","","! $_");
181 | }
182 | ProcessHistory("","","","!\n!WLC Show Udi End\n");
183 | return(0);
184 | }
185 |
186 | 1;
187 |
--------------------------------------------------------------------------------
/lib/dell.pm.in:
--------------------------------------------------------------------------------
1 | package dell;
2 | ##
3 | ## fnrancid patched to dlrancid to accomplish D-Link support
4 | ## adapted by: Gavin McCullagh
5 | ## Griffith College Dublin
6 | ##
7 | ## @PACKAGE@ @VERSION@
8 | @copyright@
9 | #
10 | # A library built on Stephen Gill's Netscreen stuff to accomodate
11 | # the Fortinet product line. [d_pfleger@juniper.net]
12 | #
13 | # RANCID - Really Awesome New Cisco confIg Differ
14 | #
15 | # Code tested and working fine on these D-Link models:
16 | #
17 | # DES-3010F
18 | # DES-3052P
19 | # DES-3526
20 | # DES-3550
21 | #
22 | # dell.pm - Dell D-Link rancid procedures
23 | #
24 | use 5.010;
25 | use strict 'vars';
26 | use warnings;
27 | no warnings 'uninitialized';
28 | require(Exporter);
29 | our @ISA = qw(Exporter);
30 |
31 | use rancid @VERSION@;
32 |
33 | our $proc;
34 | our $found_version;
35 |
36 | @ISA = qw(Exporter rancid main);
37 | #XXX @Exporter::EXPORT = qw($VERSION @commandtable %commands @commands);
38 |
39 | # load-time initialization
40 | sub import {
41 | 0;
42 | }
43 |
44 | # post-open(collection file) initialization
45 | sub init {
46 | $proc = "";
47 | $found_version = 0;
48 |
49 | # add content lines and separators
50 | ProcessHistory("","","","#RANCID-CONTENT-TYPE: D-Link\n\n");
51 |
52 | 0;
53 | }
54 |
55 | # main loop of input of device output
56 | sub inloop {
57 | my($INPUT, $OUTPUT) = @_;
58 | my($cmd, $rval);
59 |
60 | TOP: while(<$INPUT>) {
61 | tr/\015//d;
62 | # XXX this match is not correct for DELL
63 | if (/[>#]\s?exit(?:$|Connection)/) {
64 | $clean_run = 1;
65 | last;
66 | }
67 | if (/^Error:/) {
68 | print STDOUT ("$host dllogin error: $_");
69 | print STDERR ("$host dllogin error: $_") if ($debug);
70 | $clean_run = 0;
71 | last;
72 | }
73 | while (/^.+(#|\$)\s*($cmds_regexp)\s*$/) {
74 | $cmd = $2;
75 | # - D-Link prompts end with '#'.
76 | if ($_ =~ m/^.+#/) {
77 | $prompt = '.+#.*';
78 | }
79 | print STDERR ("HIT COMMAND:$_") if ($debug);
80 | if (! defined($commands{$cmd})) {
81 | print STDERR "$host: found unexpected command - \"$cmd\"\n";
82 | $clean_run = 0;
83 | last TOP;
84 | }
85 | if (! defined(&{$commands{$cmd}})) {
86 | printf(STDERR "$host: undefined function - \"%s\"\n",
87 | $commands{$cmd});
88 | $clean_run = 0;
89 | last TOP;
90 | }
91 | $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
92 | delete($commands{$cmd});
93 | if ($rval == -1) {
94 | $clean_run = 0;
95 | last TOP;
96 | }
97 | }
98 | }
99 | }
100 |
101 | # This routine parses "get system"
102 | sub GetSystem {
103 | my($INPUT, $OUTPUT, $cmd) = @_;
104 | print STDERR " In GetSystem: $_" if ($debug);
105 |
106 | while (<$INPUT>) {
107 | tr/\015//d;
108 | next if /^\s*$/;
109 | last if (/$prompt/);
110 |
111 | next if (/^system up time:/i);
112 | #next if (/^\s*Virus-DB: .*/);
113 | #next if (/^\s*Extended DB: .*/);
114 | #next if (/^\s*IPS-DB: .*/);
115 | #next if (/^FortiClient application signature package:/);
116 | ProcessHistory("","","","#$_");
117 | }
118 | ProcessHistory("SYSTEM","","","\n");
119 | return(0);
120 | }
121 |
122 | sub GetFile {
123 | my($INPUT, $OUTPUT, $cmd) = @_;
124 | print STDERR " In GetFile: $_" if ($debug);
125 |
126 | while (<$INPUT>) {
127 | last if (/$prompt/);
128 | }
129 | ProcessHistory("FILE","","","\n");
130 | return(0);
131 | }
132 |
133 | sub GetConf {
134 | my($INPUT, $OUTPUT, $cmd) = @_;
135 | my($password_counter) = (0);
136 | print STDERR " In GetConf: $_" if ($debug);
137 |
138 | while (<$INPUT>) {
139 | tr/\015//d;
140 | next if /^\s*$/;
141 | last if (/$prompt/);
142 |
143 | # filter variabilities between configurations. password encryption
144 | # upon each display of the configuration.
145 | #if (/^\s*(set [^\s]*)\s(Enc\s[^\s]+)(.*)/i && $filter_pwds > 0 ) {
146 | # ProcessHistory("ENC","","","#$1 ENC $3\n");
147 | # next;
148 | #}
149 | # if filtering passwords, note that we're on an opening account line
150 | # next two lines will be passwords
151 | if (/^create account / && $filter_pwds > 0 ) {
152 | $password_counter = 2;
153 | ProcessHistory("","","","#$_");
154 | next;
155 | }
156 | elsif ($password_counter > 0) {
157 | $password_counter--;
158 | ProcessHistory("","","","#\n");
159 | next;
160 | }
161 | ProcessHistory("","","","$_");
162 | }
163 | $found_end = 1;
164 | return(1);
165 | }
166 |
167 | 1;
168 |
--------------------------------------------------------------------------------
/lib/fortigate.pm.in:
--------------------------------------------------------------------------------
1 | package fortigate;
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | @copyright@
5 | #
6 | # RANCID - Really Awesome New Cisco confIg Differ
7 | #
8 | # A library built on Stephen Gill's Netscreen stuff to accomodate
9 | # the Fortinet/Fortigate product line. [d_pfleger@juniper.net]
10 | #
11 | # fortigate.pm - Fortigate rancid procedures
12 |
13 | use 5.010;
14 | use strict 'vars';
15 | use warnings;
16 | no warnings 'uninitialized';
17 | require(Exporter);
18 | our @ISA = qw(Exporter);
19 |
20 | use rancid @VERSION@;
21 |
22 | @ISA = qw(Exporter rancid main);
23 | #XXX @Exporter::EXPORT = qw($VERSION @commandtable %commands @commands);
24 |
25 | # load-time initialization
26 | sub import {
27 | 0;
28 | }
29 |
30 | # post-open(collection file) initialization
31 | sub init {
32 | # add content lines and separators
33 | ProcessHistory("","","","#RANCID-CONTENT-TYPE: $devtype\n#\n");
34 |
35 | 0;
36 | }
37 |
38 | # main loop of input of device output
39 | sub inloop {
40 | my($INPUT, $OUTPUT) = @_;
41 | my($cmd, $rval);
42 |
43 | TOP: while(<$INPUT>) {
44 | tr/\015//d;
45 | if (/^Error:/) {
46 | print STDOUT ("$host fnlogin error: $_");
47 | print STDERR ("$host fnlogin error: $_") if ($debug);
48 | $clean_run = 0;
49 | last;
50 | }
51 | while (/^.+[#\$]\s*($cmds_regexp)\s*$/) {
52 | $cmd = $1;
53 | # FortiGate prompts end with either '#' or '$'. Further, they may
54 | # be prepended with a '~' if the hostname is too long. Therefore,
55 | # we need to figure out what our prompt really is.
56 | if (!defined($prompt)) {
57 | $prompt = ($_ =~ /^([^#\$]+~?[#\$])/)[0];
58 | $prompt =~ s/([][}{)(\\])/\\$1/g;
59 | # add the possible ~
60 | $prompt =~ s/~?([#\$])/~?\\$1/g;
61 | print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
62 | }
63 | print STDERR ("HIT COMMAND:$_") if ($debug);
64 | if (!defined($commands{$cmd})) {
65 | print STDERR "$host: found unexpected command - \"$cmd\"\n";
66 | $clean_run = 0;
67 | last TOP;
68 | }
69 | if (! defined(&{$commands{$cmd}})) {
70 | printf(STDERR "$host: undefined function - \"%s\"\n",
71 | $commands{$cmd});
72 | $clean_run = 0;
73 | last TOP;
74 | }
75 | $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
76 | delete($commands{$cmd});
77 | if ($rval == -1) {
78 | $clean_run = 0;
79 | last TOP;
80 | }
81 | }
82 | if (/[#\$]\s?exit$/) {
83 | $clean_run = 1;
84 | last;
85 | }
86 | }
87 | }
88 |
89 | # This routine parses "get system"
90 | sub GetSystem {
91 | my($INPUT, $OUTPUT, $cmd) = @_;
92 | print STDERR " In GetSystem: $_" if ($debug);
93 |
94 | while (<$INPUT>) {
95 | tr/\015//d;
96 | next if /^\s*$/;
97 | last if (/$prompt/);
98 |
99 | if ($filter_osc >= 2) {
100 | next if (/^\s*APP-DB: .*/);
101 | next if (/^\s*AV AI\/ML Model:: .*/);
102 | next if (/^\s*Botnet DB: .*/);
103 | next if (/^\s*Extended DB: .*/);
104 | next if (/^\s*industrial-db: .*/i);
105 | next if (/^\s*IPS-DB: .*/);
106 | next if (/^\s*IPS-ETDB: .*/);
107 | next if (/^\s*IPS Malicious URL Database: .*/);
108 | next if (/^\s*Proxy-APP-DB: .*/);
109 | next if (/^\s*Proxy-IPS-ETDB: .*/);
110 | next if (/^\s*Virus-DB: .*/);
111 | }
112 | next if (/^system time:/i);
113 | next if (/^FortiClient application signature package:/);
114 | # Cluster uptime
115 | next if (/^\s*Cluster uptime:/);
116 |
117 | ProcessHistory("","","","#$_");
118 | }
119 | ProcessHistory("SYSTEM","","","\n");
120 | return(0);
121 | }
122 |
123 | sub GetFile {
124 | my($INPUT, $OUTPUT, $cmd) = @_;
125 | print STDERR " In GetFile: $_" if ($debug);
126 |
127 | while (<$INPUT>) {
128 | last if (/$prompt/);
129 | }
130 | ProcessHistory("FILE","","","\n");
131 | return(0);
132 | }
133 |
134 | sub GetConf {
135 | my($INPUT, $OUTPUT, $cmd) = @_;
136 | print STDERR " In GetConf: $_" if ($debug);
137 |
138 | while (<$INPUT>) {
139 | tr/\015//d;
140 | next if /^\s*$/;
141 | last if (/$prompt/);
142 |
143 | # System time is fortigate extraction time
144 | next if (/^\s*!System time:/);
145 | # remove occurrances of conf_file_ver
146 | next if (/^#?conf_file_ver=/);
147 | # filter last-login
148 | if (/^(\s*set)\slast-login\s(.*)/ && $filter_osc) {
149 | ProcessHistory("","","","#$1 last-login \n");
150 | next;
151 | }
152 |
153 | # filter cycling RSA private keys
154 | if ($filter_osc &&
155 | /^\s*set private-key "-----BEGIN (RSA|ENCRYPTED) PRIVATE KEY-----/) {
156 | ProcessHistory("","","","#$_");
157 | ProcessHistory("","","","# \n");
158 | while (<$INPUT>) {
159 | tr/\015//d;
160 | goto ENDGETCONF if (/$prompt/);
161 |
162 | if (/^\s*-----END (RSA|ENCRYPTED) PRIVATE KEY-----"/) {
163 | ProcessHistory("","","","#$_");
164 | last;
165 | }
166 | }
167 | next;
168 | }
169 | # filter ospf md5-keys
170 | if (/^(\s*set)\smd5-key\s(\d+)\s(.*)/ && $filter_osc) {
171 | ProcessHistory("","","","#$1 md5-key $2 \n");
172 | next;
173 | }
174 | # filter cycling password encryption
175 | if (/^(\s*set \S*( \d+)?)\s("?enc\s\S+"?)(.*)/i &&
176 | ($filter_osc || $filter_pwds > 0)) {
177 | ProcessHistory("ENC","","","#$1 ENC $4\n");
178 | next;
179 | }
180 |
181 | ProcessHistory("","","","$_");
182 | }
183 | ENDGETCONF:
184 | $found_end = 1;
185 | return(1);
186 | }
187 |
188 | 1;
189 |
--------------------------------------------------------------------------------
/lib/fss2.pm.in:
--------------------------------------------------------------------------------
1 | package fss2;
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | @copyright@
5 | #
6 | # RANCID - Really Awesome New Cisco confIg Differ
7 | #
8 | # onefinity.pm - Fujitsu FSS2/1finity rancid procedures
9 | #
10 |
11 | use 5.010;
12 | use strict 'vars';
13 | use warnings;
14 | require(Exporter);
15 | our @ISA = qw(Exporter);
16 | #$Exporter::Verbose=1;
17 |
18 | use rancid @VERSION@;
19 |
20 | @ISA = qw(Exporter rancid main);
21 | #our @EXPORT = qw($VERSION)
22 |
23 | # load-time initialization
24 | sub import {
25 | 0;
26 | }
27 |
28 | # post-open(collection file) initialization
29 | sub init {
30 | # add content lines and separators
31 | ProcessHistory("","","","#RANCID-CONTENT-TYPE: $devtype\n#\n");
32 | ProcessHistory("COMMENTS","keysort","A0","#\n");
33 | ProcessHistory("COMMENTS","keysort","B0","#\n");
34 |
35 | 0;
36 | }
37 |
38 | # main loop of input of device output
39 | sub inloop {
40 | my($INPUT, $OUTPUT) = @_;
41 | my($cmd, $rval);
42 |
43 | TOP: while (<$INPUT>) {
44 | tr/\015//d;
45 | if (/^Error:/) {
46 | print STDOUT ("$host jlogin error: $_");
47 | print STDERR ("$host jlogin error: $_") if ($debug);
48 | $clean_run=0;
49 | last;
50 | }
51 | if (/System shutdown message/) {
52 | print STDOUT ("$host shutdown msg: $_");
53 | print STDERR ("$host shutdown msg: $_") if ($debug);
54 | $clean_run = 0;
55 | last;
56 | }
57 | if (/error: cli version does not match Managment Daemon/i) {
58 | print STDOUT ("$host mgd version mismatch: $_");
59 | print STDERR ("$host mgd version mismatch: $_") if ($debug);
60 | $clean_run = 0;
61 | last;
62 | }
63 | while (/>\s*($cmds_regexp)\s*$/) {
64 | $cmd = $1;
65 | if (!defined($prompt)) {
66 | $prompt = ($_ =~ /^([^>]+>)/)[0];
67 | $prompt =~ s/([][}{)(\\])/\\$1/g;
68 | print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
69 | }
70 | print STDERR ("HIT COMMAND:$_") if ($debug);
71 | if (! defined($commands{$cmd})) {
72 | print STDERR "$host: found unexpected command - \"$cmd\"\n";
73 | $clean_run = 0;
74 | last TOP;
75 | }
76 | if (! defined(&{$commands{$cmd}})) {
77 | printf(STDERR "$host: undefined function - \"%s\"\n",
78 | $commands{$cmd});
79 | $clean_run = 0;
80 | last TOP;
81 | }
82 | $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
83 | delete($commands{$cmd});
84 | if ($rval == -1) {
85 | $clean_run = 0;
86 | last TOP;
87 | }
88 | }
89 | if (/>\s*quit/) {
90 | $clean_run=1;
91 | last;
92 | }
93 | }
94 | }
95 |
96 | # This routine parses "show fw-info"
97 | sub ShowFWinfo {
98 | my($INPUT, $OUTPUT, $cmd) = @_;
99 | print STDERR " In ShowFWinfo: $_" if ($debug);
100 |
101 | s/^[a-z]+@//;
102 | ProcessHistory("FWINFO","","","#\n# $_");
103 | while (<$INPUT>) {
104 | tr/\015//d;
105 | last if (/^$prompt/);
106 | next if /\[ok\]\[/i;
107 |
108 | ProcessHistory("FWINFO","","","# $_");
109 | }
110 | return(0);
111 | }
112 |
113 | # This routine parses "show inventory"
114 | sub ShowInventory {
115 | my($INPUT, $OUTPUT, $cmd) = @_;
116 | print STDERR " In ShowInventory: $_" if ($debug);
117 |
118 | s/^[a-z]+@//;
119 | ProcessHistory("INVENTORY","","","#\n# $_");
120 | while (<$INPUT>) {
121 | tr/\015//d;
122 | last if (/^$prompt/);
123 | next if /\[ok\]\[/i;
124 |
125 | next if (/^inventory\s*$/i);
126 |
127 | ProcessHistory("INVENTORY","","","# $_");
128 | }
129 | return(0);
130 | }
131 |
132 | # This routine parses "show system"
133 | sub ShowSystem {
134 | my($INPUT, $OUTPUT, $cmd) = @_;
135 | print STDERR " In ShowSystem: $_" if ($debug);
136 |
137 | s/^[a-z]+@//;
138 | ProcessHistory("COMMENTS","keysort","C","#\n# $_");
139 | while (<$INPUT>) {
140 | tr/\015//d;
141 | last if (/^$prompt/);
142 | next if /\[ok\]\[/i;
143 |
144 | next if /system (sys-)?uptime/i;
145 | /system neType\s+(.*)/ &&
146 | ProcessHistory("COMMENTS","keysort","A1","#Chassis type: $1\n") &&
147 | next;
148 | /system softwareVersion\s+(.*)/ &&
149 | ProcessHistory("COMMENTS","keysort","B1","#Image: $1\n") && next;
150 |
151 | # drop cpu stats and process stats
152 | if (/^(index\s*user type\s*|\s*cpu\s*cpu\s*$)/i) {
153 | while (<$INPUT>) {
154 | tr/\015//d;
155 | goto OUT if (/^$prompt/); # should not occur
156 | goto OUT if /\[ok\]\[/i;
157 |
158 | last if (/^\s*$/);
159 | }
160 | next;
161 | }
162 |
163 | ProcessHistory("","","","# $_");
164 | }
165 | OUT:
166 | return(0);
167 | }
168 |
169 | # This routine parses "show configuration"
170 | sub WriteTerm {
171 | my($INPUT, $OUTPUT, $cmd) = @_;
172 | my($lines) = 0;
173 | my($snmp) = 0;
174 | print STDERR " In WriteTerm: $_" if ($debug);
175 |
176 | s/^[a-z]+@//;
177 | ProcessHistory("COMMENTS","","","#\n# $_");
178 | while (<$INPUT>) {
179 | tr/\015//d;
180 | next if (/^\s*$/);
181 |
182 | # end of config - hopefully. FSS2 does not have a reliable
183 | # end-of-config tag. appears to end with "\nPROMPT>", but not sure.
184 | if (/^$prompt/ || /^\[ok\]\[/) {
185 | $found_end++;
186 | last;
187 | }
188 | next if (/^\s+(last-changed|last-updated|uptime)\s+/i);
189 | next if (/^\s+(replay-log-creation-time|replay-log-aged-time)\s+/i);
190 | next if (/^\s+sys-vstimer\s+/i);
191 | next if (/^\s+softwareversion\s+/i);
192 | next if (/^\s+(netype|vendor)\s+/i);
193 | $lines++;
194 |
195 | # filter snmp community, when in snmp { stanza }
196 | /^snmp/ && $snmp++;
197 | /^}/ && ($snmp = 0);
198 | if ($snmp && /^(\s*)(community|trap-group) [^ ;]+(\s?[;{])$/) {
199 | if ($filter_commstr) {
200 | $_ = "$1$2 \"\"$3\n";
201 | }
202 | }
203 | # this is either cleartext or *; either way, it should be filtered.
204 | if (/(\s+password\s+)[^ ;]+/) {
205 | ProcessHistory("","","","#$1$'");
206 | next;
207 | }
208 | if (/(\s+crypt-password\s+)[^ ;]+/ && $filter_pwds >= 2) {
209 | ProcessHistory("","","","#$1$'");
210 | next;
211 | }
212 | ProcessHistory("","","","$_");
213 | }
214 |
215 | if ($lines < 3) {
216 | printf(STDERR "ERROR: $host configuration appears to be truncated.\n");
217 | $found_end = 0;
218 | return(-1);
219 | }
220 |
221 | return(0);
222 | }
223 |
224 | 1;
225 |
--------------------------------------------------------------------------------
/lib/panos.pm.in:
--------------------------------------------------------------------------------
1 | package panos;
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | @copyright@
5 | #
6 | # Amazingly hacked version of Hank's rancid - this one tries to
7 | # deal with Palo Altos
8 | #
9 | # RANCID - Really Awesome New Cisco confIg Differ
10 | #
11 | # panos.pm - Palo Alto Networks rancid procedures
12 | #
13 | # 2013-01-05 - fix to put cli pager after scripting-mode is off - doug
14 | # hughesd@deshawresearch.com
15 | #
16 |
17 | use 5.010;
18 | use strict 'vars';
19 | use warnings;
20 | no warnings 'uninitialized';
21 | require(Exporter);
22 | our @ISA = qw(Exporter);
23 |
24 | use rancid @VERSION@;
25 |
26 | @ISA = qw(Exporter rancid main);
27 | #XXX @Exporter::EXPORT = qw($VERSION @commandtable %commands @commands);
28 |
29 | # load-time initialization
30 | sub import {
31 | 0;
32 | }
33 |
34 | # post-open(collection file) initialization
35 | sub init {
36 |
37 | # add content lines and separators
38 | ProcessHistory("","","","#RANCID-CONTENT-TYPE: $devtype\n#\n");
39 |
40 | 0;
41 | }
42 |
43 | # main loop of input of device output
44 | sub inloop {
45 | my($INPUT, $OUTPUT) = @_;
46 | my($cmd, $rval);
47 |
48 | # Paloalto buffers commands and prints them twice, once while buffering,
49 | # and once while executing. It's a bit weird and causes default rancid
50 | # code a bit of a conniption, so we need to only execute the callbacks
51 | # on second discovery.
52 |
53 | TOP: while(<$INPUT>) {
54 | tr/\015//d;
55 | if (/[>#]\s?exit$/) {
56 | $clean_run = 1;
57 | print STDERR "exiting\n" if ($debug);
58 | # because exit occurs implicitly, too
59 | delete($commands{exit});
60 | last;
61 | }
62 | print STDERR ("line: $_") if ($debug);
63 | if (/^Error:/) {
64 | print STDOUT ("$host panlogin error: $_");
65 | print STDERR ("$host panlogin error: $_") if ($debug);
66 | $clean_run = 0;
67 | last;
68 | }
69 | while (/\w+@\S+[>#]\s*($cmds_regexp)\s*$/) {
70 | $cmd = $1;
71 | if (!defined($prompt)) {
72 | $prompt = ($_ =~ /^([^>]+>)/)[0];
73 | $prompt =~ s/>/\[#>\]/;
74 | $prompt =~ s/\(/\\(/;
75 | $prompt =~ s/\)/\\)/;
76 | print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
77 | }
78 | print STDERR ("HIT COMMAND:$_\n") if ($debug);
79 | print STDERR ("COMMAND is: $cmd|$commands{$cmd}\n") if ($debug);
80 | if (! defined($commands{$cmd})) {
81 | print STDERR "$host: found unexpected command - \"$cmd\"\n";
82 | $clean_run = 0;
83 | last TOP;
84 | }
85 | if (! defined(&{$commands{$cmd}})) {
86 | printf(STDERR "$host: undefined function - \"%s\"\n",
87 | $commands{$cmd});
88 | $clean_run = 0;
89 | last TOP;
90 | }
91 | $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
92 | delete($commands{$cmd});
93 | if ($rval == -1) {
94 | $clean_run = 0;
95 | last TOP;
96 | }
97 | }
98 | }
99 | }
100 |
101 | # This routine parses "show system info"
102 | sub ShowInfo {
103 | my($INPUT, $OUTPUT, $cmd) = @_;
104 | print STDERR " In ShowInfo:: $_" if ($debug);
105 |
106 | while (<$INPUT>) {
107 | tr/\015//d;
108 | last if (/^$prompt/);
109 | next if (/^(time:|uptime:)/);
110 | next if (/^(app|av|global-protect-datafile|threat|wf-private|wildfire|url-filtering)-(version|release-date):/);
111 | s/\s+$/\n/; # remove tailing whitespaces
112 |
113 | ProcessHistory("INFO","","","#$_");
114 | }
115 | ProcessHistory("INFO","","","#\n");
116 | return(0);
117 | }
118 |
119 | # This routine parses "show chassis inventory"
120 | sub ShowInventory {
121 | my($INPUT, $OUTPUT, $cmd) = @_;
122 | print STDERR " In ShowInventory:: $_" if ($debug);
123 |
124 | while (<$INPUT>) {
125 | tr/\015//d;
126 | last if (/^$prompt/);
127 | return(1) if (/^Invalid syntax/);
128 | s/\s+$/\n/; # remove tailing whitespaces
129 |
130 | ProcessHistory("INV","","","#$_");
131 | }
132 | ProcessHistory("INV","","","#\n");
133 | return(0);
134 | }
135 |
136 | # This routine parses "show config running"
137 | sub ShowConfig {
138 | my($INPUT, $OUTPUT, $cmd) = @_;
139 | print STDERR " In ShowConfig: $_" if ($debug);
140 |
141 | while (<$INPUT>) {
142 | tr/\015//d;
143 | if (/^}\s*$|\[edit\]/) {
144 | $found_end = 1;
145 | ProcessHistory("","","","$_");
146 | return(1);
147 | }
148 |
149 | if (/^(\s*snmp-community-string )[^ ;]+(\s?[;{])$/ && $filter_commstr) {
150 | $_ = "#$1$2\n";
151 | }
152 | # filter protocol encryption keys
153 | if (/^(\s*key )[^ ;]+(\s?[;{])$/ && $filter_pwds >= 1) {
154 | $_ = "#$1$2\n";
155 | }
156 |
157 | ProcessHistory("","","","$_");
158 | # end of config
159 | }
160 | return 0;
161 | }
162 |
163 | 1;
164 |
--------------------------------------------------------------------------------
/lib/rancidcontrib.pm.in:
--------------------------------------------------------------------------------
1 | package rancidcontrib;
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | @copyright@
5 | #
6 | # RANCID - Really Awesome New Cisco confIg Differ
7 | #
8 | # rancid.pm - base/basic rancid procedures
9 | #
10 |
11 | use 5.010;
12 | use strict 'vars';
13 | use warnings;
14 | require(Exporter);
15 | our @ISA = qw(Exporter);
16 |
17 | use rancid @VERSION@;
18 |
19 | # load-time initialization
20 | sub import {
21 | 0;
22 | }
23 |
24 | # post-open(collection file) initialization
25 | sub init {
26 | 0;
27 | }
28 |
29 | # This routine parses "show system reboot"
30 | # Includes impending reboot for JunOS.
31 | # Add to the device type configuration (see rancid.types.conf(5)):
32 | # ;module;rancidcontrib
33 | # ;command;rancidcontrib::JunosShowSystemReboot;show system reboot
34 | # github.com/shigechika
35 | sub JunosShowSystemReboot {
36 | my($INPUT, $OUTPUT, $cmd) = @_;
37 | print STDERR " In ShowSystemReboot: $_" if ($debug);
38 |
39 | s/^[a-z]+@//;
40 | ProcessHistory("","","","# $_");
41 | while (<$INPUT>) {
42 | tr/\015//d;
43 | last if (/^$prompt/);
44 | next if (/^system (shutdown message from|going down )/i);
45 | next if (/^\{(master|backup|linecard|primary|secondary)(:(node)?\d+)?\}/);
46 |
47 | /Unrecognized command/ && return(1);
48 | /command is not valid/ && return(1);
49 | /^\s+\^/ && return(1);
50 | /syntax error/ && return(1);
51 | /^JUNOS / && <$INPUT> && next;
52 | /No such file or directory$/ && next;
53 |
54 | ProcessHistory("","","","# $_");
55 | }
56 | return(0);
57 | }
58 |
59 | 1;
60 |
--------------------------------------------------------------------------------
/lib/routeros.pm.in:
--------------------------------------------------------------------------------
1 | package routeros;
2 | ##
3 | ## @PACKAGE@ @VERSION@
4 | @copyright@
5 | #
6 | # RANCID - Really Awesome New Cisco confIg Differ
7 | #
8 | # routeros.pm - Mikrotik RouterOS rancid procedures
9 | #
10 | # Original mtrancid was modified by Chris Boot for MikroTik.
11 |
12 | use 5.010;
13 | use strict 'vars';
14 | use warnings;
15 | no warnings 'uninitialized';
16 | require(Exporter);
17 | our @ISA = qw(Exporter);
18 |
19 | use rancid @VERSION@;
20 |
21 | @ISA = qw(Exporter rancid main);
22 | #XXX @Exporter::EXPORT = qw($VERSION @commandtable %commands @commands);
23 |
24 | # load-time initialization
25 | sub import {
26 | $timeo = 90; # mtlogin timeout in seconds
27 |
28 | 0;
29 | }
30 |
31 | # post-open(collection file) initialization
32 | sub init {
33 | # add content lines and separators
34 | ProcessHistory("","","","!RANCID-CONTENT-TYPE: $devtype\n!\n");
35 | ProcessHistory("COMMENTS","keysort","B0","!\n");
36 | ProcessHistory("COMMENTS","keysort","D0","!\n");
37 | ProcessHistory("COMMENTS","keysort","F0","!\n");
38 | ProcessHistory("COMMENTS","keysort","G0","!\n");
39 |
40 | 0;
41 | }
42 |
43 | # main loop of input of device output
44 | sub inloop {
45 | my($INPUT, $OUTPUT) = @_;
46 | my($cmd, $rval);
47 |
48 | TOP: while (<$INPUT>) {
49 | tr/\015//d;
50 | if (/[>#]\s*quit$/) {
51 | $clean_run=1;
52 | last;
53 | }
54 | if (/^Error:/) {
55 | print STDOUT ("$host mtlogin error: $_");
56 | print STDERR ("$host mtlogin error: $_") if ($debug);
57 | $clean_run = 0;
58 | last;
59 | }
60 | while (/\s*($cmds_regexp)\s*$/) {
61 | $cmd = $1;
62 | if (!defined($prompt)) {
63 | $prompt = "\] > "; # crude but effective
64 | print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
65 | }
66 | print STDERR ("HIT COMMAND:$_") if ($debug);
67 | if (! defined($commands{$cmd})) {
68 | print STDERR "$host: found unexpected command - \"$cmd\"\n";
69 | $clean_run = 0;
70 | last TOP;
71 | }
72 | $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
73 | delete($commands{$cmd});
74 | if ($rval == -1) {
75 | $clean_run = 0;
76 | last TOP;
77 | }
78 | }
79 | }
80 | }
81 |
82 | # This routine parses "show version"
83 | sub SystemPackagePrintDetail {
84 | my($INPUT, $OUTPUT, $cmd) = @_;
85 | print STDERR " In SystemPackagePrintDetail: $_" if ($debug);
86 | my($buffer) = "";
87 | my($name);
88 | my(%packages) = ();
89 |
90 | while (<$INPUT>) {
91 | tr/\015//d;
92 | last if (/$prompt/);
93 | next if (/^Flags:/);
94 | return(1) if (/(bad command name )/);
95 |
96 | s/^\s+//g;
97 | s/^\d+\s+//g;
98 | s/\s+$//g;
99 |
100 | if (/^$/) {
101 | if ($buffer =~ /name="(.+)"/) {
102 | $packages{$1} = $buffer;
103 | }
104 | $buffer = "";
105 | } else {
106 | $buffer .= "$_ ";
107 | }
108 | }
109 |
110 | if ($buffer =~ /name="(.+)"/) {
111 | $packages{$1} = $buffer;
112 | }
113 |
114 | for $name (sort keys %packages) {
115 | ProcessHistory("COMMENTS","keysort","A1","# " . $packages{$name} .
116 | "\n");
117 | }
118 |
119 | return(0);
120 | }
121 |
122 | sub SystemRouterboardPrint {
123 | my($INPUT, $OUTPUT, $cmd) = @_;
124 | print STDERR " In SystemRouterboardPrint: $_" if ($debug);
125 |
126 | while (<$INPUT>) {
127 | tr/\015//d;
128 | last if (/$prompt/);
129 | next if (/^(\s*|\s*$cmd\s*)$/);
130 | return(1) if (/(bad command name )/);
131 | s/^\s+//g;
132 |
133 | # license renewal timestamp
134 | next if (/^next-renewal-at:/i);
135 |
136 | ProcessHistory("COMMENTS","keysort","C1","# $_");
137 | }
138 |
139 | return(0);
140 | }
141 |
142 | sub SystemLicensePrint {
143 | my($INPUT, $OUTPUT, $cmd) = @_;
144 | print STDERR " In SystemLicensePrint: $_" if ($debug);
145 |
146 | while (<$INPUT>) {
147 | tr/\015//d;
148 | last if (/$prompt/);
149 | next if (/^(\s*|\s*$cmd\s*)$/);
150 | return(1) if (/(bad command name )/);
151 | s/^\s+//g;
152 |
153 | ProcessHistory("COMMENTS","keysort","E1","# $_");
154 | }
155 |
156 | return(0);
157 | }
158 |
159 | sub Export {
160 | my($INPUT, $OUTPUT, $cmd) = @_;
161 | print STDERR " In Export: $_" if ($debug);
162 | my($buffer) = "";
163 |
164 | while (<$INPUT>) {
165 | tr/\015//d;
166 | if (/$prompt/) { $found_end=1; $clean_run=1; return 0};
167 | next if(/^(\s*|\s*$cmd\s*)$/);
168 | next if(/^#/);
169 | return(1) if /(bad command name )/;
170 | s/^\s+//g;
171 |
172 | # RouterOS splits long lines with backslashes - this re-joins them
173 | if (/\\\n$/) {
174 | s/\s*\\\n$//;
175 | $buffer .= $_;
176 | if (!/=$/ && !/="[^"]+$/ ) {
177 | $buffer .= " ";
178 | }
179 | } else {
180 | $buffer .= $_;
181 |
182 | # Fix quoted strings
183 | $buffer =~ s/(\S+)="(\S+)"/$1=$2/g;
184 |
185 | # skip dynamic configuration, like
186 | # set disabled=yes display-time=5s
187 | # set disabled=yes display-time=5s
188 | ($buffer = "", next) if (/set "?<\S+\s?>"? /);
189 |
190 | ProcessHistory("","","","$buffer");
191 | $buffer = "";
192 | }
193 | }
194 | }
195 |
196 | 1;
197 |
--------------------------------------------------------------------------------
/man/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 | ## A Makefile.in is supplied, in case you do not have automake.
3 |
4 | ## Copyright (c) 1997-2019 by Henry Kilmer and John Heasley
5 | ## All rights reserved.
6 | ##
7 | ## Please see the file COPYING for the text of the license.
8 |
9 | AUTOMAKE_OPTIONS=foreign no-dependencies
10 |
11 | @SET_MAKE@
12 |
13 | man_gen_MANS = cloginrc.5 lg.conf.5 rancid.3 rancid.conf.5 \
14 | rancid.types.conf.5 lg_intro.7
15 | man_nogen_MANS = a10login.1 agmrancid.1 alogin.1 anlogin.1 \
16 | arancid.1 avologin.1 blogin.1 brancid.1 brlogin.1 \
17 | cat5rancid.1 clogin.1 control_rancid.1 csblogin.1 cssrancid.1 \
18 | dllogin.1 \
19 | elogin.1 erancid.1 f5rancid.1 flogin.1 fnlogin.1 fxlogin.1 \
20 | hlogin.1 hrancid.1 htlogin.1 \
21 | htrancid.1 jerancid.1 jlogin.1 mrancid.1 \
22 | mrvlogin.1 mtlogin.1 nlogin.1 noklogin.1 \
23 | nrancid.1 nslogin.1 nsrancid.1 \
24 | panlogin.1 par.1 plogin.1 \
25 | rancid-cvs.1 rancid-run.1 rancid.1 rancidcontrib.3 \
26 | rancid.types.base.5 rancid_intro.7 \
27 | rblogin.1 rivlogin.1 rivrancid.1 \
28 | router.db.5 rrancid.1 tlogin.1 ulogin.1 wlogin.1 \
29 | xilogin.1 xlogin.1 xirancid.1 trancid.1
30 |
31 | man_MANS = $(man_nogen_MANS) $(man_gen_MANS)
32 |
33 | EXTRA_DIST = $(man_nogen_MANS) $(man_gen_MANS:%=%.in)
34 |
35 | htmls_MANS = clogin.1 cloginrc.5 control_rancid.1 lg.conf.5 lg_intro.7 \
36 | par.1 rancid-cvs.1 rancid-run.1 rancid.1 rancid.3 rancidcontrib.3 \
37 | rancid.conf.5 rancid.types.conf.5 rancid_intro.7 router.db.5
38 | htmls_gen_MANS= $(htmls_MANS:%=%.html)
39 |
40 | CLEANFILES = $(man_gen_MANS) $(htmls_gen_MANS)
41 |
42 | htmls: $(htmls_gen_MANS)
43 |
44 | $(htmls_gen_MANS): $(htmls_MANS)
45 | m=`echo $@ | sed -e 's/\.[^.]*$$//'`; \
46 | nroff -Thtml -c -mandoc $$m | man2html -nodepage > $@
47 | # groff -mandoc -Thtml < $$m > $@
48 |
49 | # auto_edit does the autoconf variable substitution. This allows the
50 | # substitution to have the full expansion of the variables, e.g.: $sysconfdir
51 | # will be /prefix/etc instead of ${prefix}/etc.
52 | #
53 | # This is a bit of a PITA, but is the method recommended by the autoconf
54 | # documentation.
55 | auto_edit = sed \
56 | -e 's,@prefix\@,$(prefix),g' \
57 | -e 's,@bindir\@,$(bindir),g' \
58 | -e 's,@localstatedir\@,$(localstatedir),g' \
59 | -e 's,@sysconfdir\@,$(sysconfdir),g' \
60 | -e 's,@pkgdatadir\@,$(pkgdatadir),g' \
61 | -e 's,@ADMINMAILPLUS\@,$(ADMINMAILPLUS),g' \
62 | -e 's,@MAILPLUS\@,$(MAILPLUS),g' \
63 | -e 's,@TELNET_CMD\@,$(TELNET_CMD),g'
64 |
65 | cloginrc.5: Makefile $(srcdir)/cloginrc.5.in
66 | rm -f cloginrc.5 cloginrc.5.tmp; \
67 | $(auto_edit) $(srcdir)/cloginrc.5.in >cloginrc.5.tmp; \
68 | mv cloginrc.5.tmp cloginrc.5
69 |
70 | lg.conf.5: Makefile $(srcdir)/lg.conf.5.in
71 | rm -f lg.conf.5 lg.conf.5.tmp; \
72 | $(auto_edit) $(srcdir)/lg.conf.5.in >lg.conf.5.tmp; \
73 | mv lg.conf.5.tmp lg.conf.5
74 |
75 | lg_intro.7: Makefile $(srcdir)/lg_intro.7.in
76 | rm -f lg_intro.7 lg_intro.7.tmp; \
77 | $(auto_edit) $(srcdir)/lg_intro.7.in >lg_intro.7.tmp; \
78 | mv lg_intro.7.tmp lg_intro.7
79 |
80 | rancid.conf.5: Makefile $(srcdir)/rancid.conf.5.in
81 | rm -f rancid.conf.5 rancid.conf.5.tmp; \
82 | $(auto_edit) $(srcdir)/rancid.conf.5.in >rancid.conf.5.tmp; \
83 | mv rancid.conf.5.tmp rancid.conf.5
84 |
85 | rancid.types.conf.5: Makefile $(srcdir)/rancid.types.conf.5.in
86 | rm -f rancid.types.conf.5 rancid.types.conf.5.tmp; \
87 | $(auto_edit) $(srcdir)/rancid.types.conf.5.in >rancid.types.conf.5.tmp; \
88 | mv rancid.types.conf.5.tmp rancid.types.conf.5
89 |
90 | rancid.3: Makefile $(srcdir)/rancid.3.in
91 | rm -f rancid.3 rancid.3.tmp; \
92 | $(auto_edit) $(srcdir)/rancid.3.in >rancid.3.tmp; \
93 | mv rancid.3.tmp rancid.3
94 |
--------------------------------------------------------------------------------
/man/a10login.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/agmrancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/alogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/anlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/arancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/avologin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/blogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/brancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/brlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/cat5rancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/control_rancid.1:
--------------------------------------------------------------------------------
1 | .\"
2 | .hys 50
3 | .TH "control_rancid" "1" "22 December 2016"
4 | .SH NAME
5 | control_rancid \- run rancid for devices of a group
6 | .SH SYNOPSIS
7 | .B control_rancid
8 | [\fB\-V\fR] [\c
9 | .BI \-c\ \c
10 | commit_msg]\ \c
11 | [\c
12 | .BI \-f\ \c
13 | config_file]\ \c
14 | [\c
15 | .BI \-m\ \c
16 | mail_rcpt]\ \c
17 | [\c
18 | .BI \-r\ \c
19 | device_name]\ \c
20 | group
21 | .SH DESCRIPTION
22 | .B control_rancid
23 | is a
24 | .IR sh (1)
25 | script to parse a group's
26 | .BR router.db (5),
27 | run rancid for each of the devices, possibly re-run rancid for devices
28 | that failed collection, e-mail diffs, and e-mail error reports.
29 | .\"
30 | .PP
31 | .B control_rancid
32 | also creates and/or re-creates the .cvsignore/.gitignore files for each
33 | group. For the configs sub-directory, it includes ".old", where a user
34 | may keep files they would like to be ignored.
35 | .\"
36 | .PP
37 | The command-line options are as follows:
38 | .TP
39 | .B \-V
40 | Prints package name and version strings.
41 | .TP
42 | .B \-c commit_msg
43 | Specify an alternative SCM commit message.
44 | .TP
45 | .B \-f group_config_file
46 | Specify an alternative rancid.conf. The global rancid.conf file is read by
47 | .B rancid-run,
48 | which calls
49 | .B control_rancid
50 | for each group, and
51 | .B control_rancid
52 | reads the group-specific rancid.conf, thereby overriding the global file.
53 | .sp
54 | The group-specific rancid.conf may not exist.
55 | .sp
56 | Default: //rancid.conf
57 | .TP
58 | .B \-m mail_rcpt
59 | Specify the recipient of diff mail, which is normally rancid-. The
60 | argument may be a single address, multiple comma separated addresses, or
61 | .B \-m
62 | may be specified multiple times.
63 | .\"
64 | .TP
65 | .B \-r device_name
66 | Specify the name, as it appears in the router.db, of a particular device
67 | to collect and generate diffs for. The device must be marked "up".
68 | .sp
69 | The
70 | .B \-r
71 | option alters the subject line of the diff mail. It will begin
72 | with / rather than just the group name alone.
73 | .\"
74 | .PP
75 | .B control_rancid
76 | is normally (and best) run via
77 | .BR rancid-run (1)
78 | which provides a locking mechanism on a group basis and saves output
79 | in a log file for each group.
80 | .\"
81 | .SH "SEE ALSO"
82 | .BR rancid-run (1),
83 | .BR rancid.conf (5),
84 | .BR router.db (5)
85 |
--------------------------------------------------------------------------------
/man/csblogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/cssrancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/dllogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/elogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/erancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/f10rancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/f5rancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/flogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/fnlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/fxlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/hlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/hrancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/htlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/htrancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/jerancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/jlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/lg.conf.5.in:
--------------------------------------------------------------------------------
1 | .\"
2 | .hys 50
3 | .TH "lg.conf" "5" "7 Jan 2004"
4 | .SH NAME
5 | lg.conf \- looking glass configuration file
6 | .SH DESCRIPTION
7 | .B lg.conf
8 | contains configuration for the looking glass scripts.
9 | .PP
10 | The syntax is that of
11 | .IR perl (1).
12 | It is used to set variables that affect run-time behavior and/or to locate
13 | resources.
14 | .\"
15 | .SH VARIABLES
16 | The following variables are used (alphabetically):
17 | .Bl -tag -width flag
18 | .\"
19 | .TP
20 | .B LG_AS_REG
21 | *** not implemented.
22 | .\"
23 | .TP
24 | .B LG_BGP_RT
25 | Allows show ip bgp neighbor commands that can produce heavy output, such as
26 | sh ip bgp neighbor advertised-routes for a transit customer when the
27 | neighbor address is followed by 'advertised-routes' for the sh ip bgp neighbor
28 | query.
29 | .\"
30 | .TP
31 | .B LG_CACHE_DIR
32 | Sets the location of the cache directory. The looking glass uses this
33 | to hold lock files, log files, and output from cached commands.
34 | .sp
35 | Default: ./tmp
36 | .sp
37 | Note that the default is relative to the directory where
38 | .IR lg.cgi
39 | runs in the server's document root (e.g.: /usr/local/www/data/lg/tmp).
40 | .\"
41 | .TP
42 | .B LG_CACHE_TIME
43 | Sets the number of seconds that the looking glass should cache output from
44 | commands that tend to produce a lot of output, such as 'show ip bgp
45 | dampened-paths'.
46 | .sp
47 | Default: 600
48 | .\"
49 | .TP
50 | .B LG_CLOGINRC
51 | Defines the location of the
52 | .BR cloginrc (5)
53 | that the looking glass should use. The path may be relative to the directory
54 | where the CGI scripts run in the server's document root.
55 | .sp
56 | Default: $HOME/.cloginrc
57 | .sp
58 | Note that the .cloginrc must be readable by the user or group that will be
59 | running the CGI and that
60 | .BR clogin (1)
61 | will not allow a world readable
62 | .IR .cloginrc .
63 | The user is normally that of the http server (httpd).
64 | .\"
65 | .TP
66 | .B LG_IMAGE
67 | Defines a html image tag () which, if defined, will be included at
68 | the top of the looking glass pages. It may contain any html as it is
69 | simply handed off to print().
70 | .sp
71 | Example: $LG_IMAGE="\\n FOO";
72 | .\"
73 | .TP
74 | .B LG_INFO
75 | Defines information in html format which, if defined, will be included at
76 | the bottom of the looking glass form page. It may contain any html as it is
77 | simply handed off to print().
78 | .sp
79 | Example: $LG_INFO="For Support contact webmaster";
80 | .\"
81 | .TP
82 | .B LG_LOG
83 | Defines the fully qualified path name (i.e.: begins with '/') for the log file
84 | or the
85 | .BR syslog (3)
86 | facility to use for logging. For syslog, the argument is the lowercase name
87 | of a syslog facility (see syslog.h) without the 'LOG_' prefix.
88 | .sp
89 | Example: local0
90 | .sp
91 | Default: $LG_CACHE_DIR/lg.log
92 | .\"
93 | .TP
94 | .B LG_ROUTERDB
95 | Sets the location for the
96 | .IR router.db
97 | file in rancid's
98 | .BR router.db (5)
99 | format. It lists the devices that should be available to the looking glass
100 | users. Only those devices of supported types and with state 'up' are made
101 | available. If not defined and the default file does not exist, the looking
102 | glass will compile a list from the router.db files of all the groups present
103 | in rancid, that is, the list will be a concatenation of the available
104 | .IR router.db (5)
105 | files.
106 | .sp
107 | Note that if the concatenation method is used, it may be necessary to alter
108 | the mode of the router.db files in the rancid group directories, since rancid's
109 | default umask is 027 (see
110 | .BR rancid.conf (5)).
111 | .\"
112 | .TP
113 | .B LG_STRIP
114 | Causes the LG to strip login information from the looking glass results.
115 | Since Expect often munges disabling echo when passwords are entered,
116 | this is a SECURITY CONCERN! However, this output can be very useful for
117 | debugging clogin problems.
118 | .\"
119 | .TP
120 | .B LG_STYLE
121 | Defines the URL of a style sheet to be used for HTML formatting.
122 | .\"
123 | .TP
124 | .B PATH
125 | Is a colon separated list of directory pathnames in the file system
126 | where rancid's login scripts,
127 | .IR clogin (1)
128 | etc.)
129 | and programs needed within these, such as
130 | .IR telnet (1),
131 | are located.
132 | Its value is set by configure. Should it be necessary to modify PATH,
133 | note that it must include $BASEDIR/bin (see above).
134 | .\"
135 | .TP
136 | Queries ...................................
137 | .\"
138 | .El
139 | .\"
140 | .SH ENVIRONMENT
141 | .Bl -tag -width LG_CONF -compact
142 | .TP
143 | .B LG_CONF
144 | Location of
145 | .B lg.conf
146 | file. See the
147 | .IR FILES
148 | section for more information.
149 | .El
150 | .\"
151 | .SH ERRORS
152 | .B lg.conf
153 | is interpreted directly by
154 | .IR perl (1),
155 | so its syntax follows that of perl. Syntax errors may produce quite unexpected
156 | results.
157 | .SH FILES
158 | .Bl -tag -width @sysconfdir@/rancid.conf -compact
159 | .TP
160 | .B @sysconfdir@/lg.conf
161 | Configuration file described here.
162 | .sp
163 | .B lg.conf
164 | is located by the value of the environment variable LG_CONF, in the CWD
165 | (current working directory), or the sysconfdir defined when rancid was
166 | installed, in that order.
167 | .El
168 | .SH "SEE ALSO"
169 | .BR cloginrc (5),
170 | .BR lg_intro (7),
171 | .BR router.db (5)
172 | .\"
173 | .SH HISTORY
174 | In RANCID releases prior to 2.3,
175 | .B lg.conf
176 | was located in the util/lg sub-directory of the install path. This was
177 | changed to be more consistent with common file location practices.
178 |
--------------------------------------------------------------------------------
/man/lg_intro.7.in:
--------------------------------------------------------------------------------
1 | .\"
2 | .hys 50
3 | .TH "lg_intro" "7" "24 Jan 2001"
4 | .SH NAME
5 | lg_intro \- introduction to the looking glass
6 | .\"
7 | .SH INTRODUCTION
8 | The
9 | .B looking glass
10 | offers a web based interface to routers to users without their needing
11 | permission to login to the router. This may be a perfect interface for customer
12 | support or less savvy folks, and many ISPs have given public access to such
13 | an interface as a "route server."
14 | .\"
15 | .SH DESCRIPTION
16 | The looking glass consists of two CGI
17 | .BR perl (1)
18 | scripts,
19 | .IR lg.cgi
20 | and
21 | .IR lgform.cgi ,
22 | and the
23 | .BR lg.conf (5)
24 | configuration file.
25 | .PP
26 | Both of these scripts begin with reading the configuration file. If
27 | there is an error in the file's syntax or if the file can not be found, error
28 | messages will be displayed on standard-error. The Apache http server
29 | redirects standard-error to its error log file by default.
30 | .PP
31 | lgform.cgi displays a html form consisting of a list of possible
32 | router commands that can be run and a scrolling list of routers that
33 | these commands may be run on. When the form is submitted, lg.cgi is
34 | run.
35 | .PP
36 | lg.cgi begins by performing some basic checks on the
37 | arguments passed to it. If these checks pass, lg.cgi either displays
38 | cached data from a previous invocation, if that data exists and is
39 | within the cache interval, or uses
40 | .BR clogin (1)
41 | to login to the device and execute the command. The
42 | results of the command are cached if applicable and displayed for the
43 | user.
44 | .\"
45 | .SH "GETTING STARTED"
46 | Besides
47 | .BR lg.conf (5),
48 | additional instructions for setting up the looking glass can be found
49 | in the README file under
50 | .IR @pkgdatadir@/README.lg .
51 | .PP
52 | Note that the looking glass scripts require a few perl modules not
53 | included with rancid. Rancid's configure process does not check for
54 | these. See the README file.
55 | .\"
56 | .SH "SEE ALSO"
57 | .BR cloginrc (5),
58 | .BR clogin (1),
59 | .BR lg.conf (5)
60 | .SH HISTORY
61 | Rancid's looking glass is based on Ed Kern's (included by permission,
62 | thanks Ed!), which could once be found on http://nitrous.digex.net/ but
63 | has apparently been removed. Support for Juniper and Foundry devices,
64 | use of rancid's device login scripts, and additional commands and checks
65 | have been added to the original.
66 |
--------------------------------------------------------------------------------
/man/mrancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/mrvlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/mtlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/mtrancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/nlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/noklogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/nrancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/nslogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/nsrancid.1:
--------------------------------------------------------------------------------
1 | .so man1/rancid.1
2 |
--------------------------------------------------------------------------------
/man/panlogin.1:
--------------------------------------------------------------------------------
1 | .so man1/clogin.1
2 |
--------------------------------------------------------------------------------
/man/par.1:
--------------------------------------------------------------------------------
1 | .\"
2 | .hys 50
3 | .TH "par" "1" "29 July 2019"
4 | .SH NAME
5 | par \- parallel command processing
6 | .SH SYNOPSIS
7 | .B par
8 | [\fB\-FHdefiqx\fP]
9 | [\c
10 | .BI \-c\
11 | command]
12 | [\c
13 | .BI \-l\
14 | logfile]
15 | [\c
16 | .BI \-n\c
17 | #]
18 | [\c
19 | .BI \-p\c
20 | #]
21 | [file [file...]]
22 | .SH DESCRIPTION
23 | .B par
24 | takes a list of files to run a command on. The first line of each file begins
25 | with a colon (:) or a pound-sign (#). If a colon, the remainder of the
26 | line is a command to run for each of the subsequent lines. If a pound-sign,
27 | then each subsequent line is a (self-contained) command, unless the
28 | .B \-c
29 | option was specified, in which case the lines become the arguments replacing
30 | the braces ({}s) in the
31 | .B \-c
32 | argument.
33 | .PP
34 | The input file may also be specified on stdin, in the format as previously
35 | described.
36 | .PP
37 | In each of the cases where the lines of the file, following the first, are
38 | not commands (ie: colon or -c), instances of open-close braces ({}) in the
39 | command will be replaced by these values.
40 | .PP
41 | For example, an inputfile whose contents is:
42 | .sp
43 | : echo {}
44 | .br
45 | a
46 | .br
47 | b
48 | .br
49 | c
50 | .sp
51 | run with
52 | .B par
53 | like so:
54 | .sp
55 | %par -q inputfile
56 | .sp
57 | will produce the following output (order will vary):
58 | .sp
59 | b
60 | .br
61 | a
62 | .br
63 | c
64 | .PP
65 | The command-line options are as follows:
66 | .PP
67 | .TP
68 | .B \-F
69 | Omit the footer that normally follows the output of each job.
70 | .\"
71 | .TP
72 | .B \-H
73 | Omit the header that normally precedes the output of each job.
74 | .\"
75 | .TP
76 | .B \-c
77 | Command to be run on each of the arguments following the command-line
78 | options, where the first line of the input file(s) begins with a pound-sign
79 | (#).
80 | .\"
81 | .TP
82 | .B \-d
83 | Print debugging information on standard error (stderr). Repeat the option
84 | up to three times for more verbosity.
85 | .\"
86 | .TP
87 | .B \-e
88 | Split args by spaces, rather than using sh -c.
89 | Note:
90 | .B \-e
91 | is incompatible with the
92 | .B \-i
93 | option.
94 | .\"
95 | .TP
96 | .B \-f
97 | No input file or STDIN, just run a quantity of the command specified with -c.
98 | .\"
99 | .TP
100 | .B \-i
101 | Run commands interactively through (multiple)
102 | .BR xterm (1)
103 | processes.
104 | .\"
105 | .TP
106 | .B \-l
107 | Prefix of logfile name, as in prefix.N where N is the
108 | .B par
109 | process number ([0..]).
110 | .sp
111 | Default: par.log.
13 |
14 |
15 |
16 | Just a few straight forward notes on our implementation of
17 | Ed Kern's looking glass (which was http://nitrous.digex.net).
18 |
19 |
20 |
21 |
22 |
Some items are not implemented for the junipers/foundrys yet (so, as i get
23 | to it) or no equivalent command exists.
24 |
If there is something which you feel is missing, feel free to ask
25 | and/or send comments to
26 | rancid@shrubbery.net. No guarantees.
27 |
Only one query per router allowed at any given time. This is to avoid
28 | resource deprivation on the looking glass host or the router. The
29 | looking glass will attempt to serialize queries.
30 |
The looking glass will ping a router prior to querying it to avoid
31 | trying to query routers which are down or otherwise inaccessible.
32 |
Login failures can be intermittent or permanent, either due to the
33 | router being inaccessible from the looking glass machine,
34 | or authorization failure(s). Contact your local network engineering
35 | folks to resolve login failures.
36 |
Queries followed by <something> require an argument(s) in the text
37 | window below the query list. Some queries take optional arguments
38 | denoted by [something]. Multiple arguments should be separated by a
39 | space.
40 |
Note that output from certain queries is cached by the server and may
41 | be slightly out of date. These queries will be noted as such in the
42 | output. This is limited to queries which could produce lots of output,
43 | such as 'sh ip bgp dampened-paths'.
44 |
Note that some queries have potential to produce great load on the router
45 | and produce lots of output, such as 'sh ip bgp' or 'sh ip bgp reg '^3561'.
46 | The looking glass attempts to deny such commands.
47 |
48 |
49 | Some useful hints:
50 |
51 |
Show interfaces can take arguments other than an interface name, assuming
52 | the router is running an O/S version with the capability. For example; a
53 | cisco can take 'descriptions' or 'brief' and 'terse' for the juniper.
54 |
Show ip bgp neighbor can take additional arguments (if configured to allow
55 | it), such as 'advertised routes', 'flap-statistics', 'received-routes',
56 | and 'routes'. The argument will be converted for the platform.