summaryrefslogtreecommitdiffstats
path: root/util/lg/README
blob: b4186b99722027fd49e736e434a4db95366e23b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
This is a looking glass based on Ed Kern's which can be found on
http://nitrous.digex.net/.  This version supports cisco and
juniper, uses rancid's [cj]login to login (so rcmd is not necessary,
it can use telnet, ssh, or rsh), and has some additional commands
implemented.  There are a few cisco commands where either no juniper
exists or we have not had time to implement yet.

packing list:
README          This file.
index.html	often the default document the server will load, contains
		an html redirect to load lgform.cgi
lg.conf		looking glass configuration file
lg.cgi          work horse of the looking glass
lgform.cgi      front-end form for the looking glass engine
lgnotes.html    user info for the looking glass

the looking glass requires the CGI and LockFile-Simple perl modules.
these can be retrieved from CPAN, http://www.cpan.org/.  CGI's home is
ftp://ftp-genome.wi.mit.edu/pub/software/WWW/.  it also requires
the POSIX module (for strftime) and Sys::Syslog, which i believe come
with perl5.

basic installation instructions:

The configure and make install process will make variable substitutions
and install bits in /usr/local/rancid/util/lg (or <prefix>/util/lg).  

1) make the scripts/html available to your server (httpd) by
   creating a directory in your server's document root directory
   (apache's httpd.conf "DocumentRoot" variable).
   eg: assuming the default in freebsd's apache pkg
	mkdir /usr/local/www/data/lg

   then either:
	- copy the files {lgnotes.html, lg.cgi, lgform.cgi} to
	  /usr/local/www/data/lg
     OR
	- create symlinks from /usr/local/www/data/lg to each of {lgnotes.html,
	  lg.cgi, lgform.cgi} in /usr/local/rancid/util/lg

   note on links: if you use symlinks, you have to configure apache to
   allow following symlinks.  eg:
	% cat /usr/local/www/data/lg/.htaccess
	Options FollowSymLinks ExecCGI

   note on index.html: index.html is typically the default file loaded
   when a url ends with a '/'.  index.html can be used to redirect this
   to lgform.cgi using a netscape meta refresh.  Though this is supported
   by many browsers, it is supposedly netscape specific and non-standard.
   In apache, the same thing can be acheived by altering the default
   directory index like this:

	% cat /usr/local/www/data/lg/.htaccess
	DirectoryIndex lgform.cgi

2) the LG needs to be able to find and read lg.conf.  by default this
   is installed as <PREFIX>/util/lg/lg.conf and the LG will look there.
   however, LG_CONF environment variable can be used to move it elsewhere.

   to get LG_CONF into the enviroment, you can SetEnvIf in apache's
   httpd.conf like this for example:
	SetEnvIf Request_URI "\/lg/.*.cgi" LG_CONF=/usr/local/util/lg/lg.conf

3) edit <PREFIX>/util/lg/lg.conf.

4) set-up cron jobs to rotate the log file and clean out old cache files.
   see LG_CACHE_DIR & LG_LOG in lg.conf.  something like (YMMV):

	# rotate lookingglass log
	#0 0 * * * cd /usr/local/www/data/lg/tmp; /usr/local/etc/savelog -m 666 -c14 lg.log
	0 0 * * * cd /usr/local/www/data/lg/tmp; /bin/mv lg.log lg.log.0
	# clean out the lookingglass cache
	0 0 * * * cd /usr/local/www/data/lg/tmp; /usr/local/bin/find . -type f -maxdepth 1 \( \! -name lg.log\* \) -mtime +1 -exec rm -f {} \;