# rancid looking glass



## andrewm659 (Sep 16, 2016)

I need some help.  I'm trying to setup the looking glass portion of rancid. I have it mostly setup.  I can view the web page.  However when I go to try and run a command on remote device it says that its unreachable or busy.  I'm not sure if I need install another perl module.  Just need some help figuring this out.  

This is running on FreeBSD 10.3 running inside a ezjail setup.


```
[Thu Sep 15 18:03:54.657489 2016] [authz_core:debug] [pid 92042] mod_authz_core.c(806): [client 10.150.1.250:52075] AH01626: authorization result of Require all granted: granted
[Thu Sep 15 18:03:54.657572 2016] [authz_core:debug] [pid 92042] mod_authz_core.c(806): [client 10.150.1.250:52075] AH01626: authorization result of <RequireAny>: granted
[Thu Sep 15 18:04:01.295631 2016] [authz_core:debug] [pid 92042] mod_authz_core.c(806): [client 10.150.1.250:52076] AH01626: authorization result of Require all granted: granted, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:04:01.295699 2016] [authz_core:debug] [pid 92042] mod_authz_core.c(806): [client 10.150.1.250:52076] AH01626: authorization result of <RequireAny>: granted, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:04:01.377210 2016] [cgi:error] [pid 92042] [client 10.150.1.250:52076] AH01215: [Thu Sep 15 23:04:01 2016] could not open log file /var/log/lg.log: Permission denied: /usr/local/www/apache24/cgi-bin/lg.cgi, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:04:01.377315 2016] [cgi:error] [pid 92042] [client 10.150.1.250:52076] AH01215:  10.150.1.250  - - [Thu Sep 15 23:04:01 2016] ping asm-asa 8.8.8.8: /usr/local/www/apache24/cgi-bin/lg.cgi, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:32.410888 2016] [authz_core:debug] [pid 92042] mod_authz_core.c(806): [client 10.150.1.250:52077] AH01626: authorization result of Require all granted: granted, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:32.411011 2016] [authz_core:debug] [pid 92042] mod_authz_core.c(806): [client 10.150.1.250:52077] AH01626: authorization result of <RequireAny>: granted, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:32.497472 2016] [cgi:error] [pid 92042] [client 10.150.1.250:52077] AH01215: [Thu Sep 15 23:06:32 2016] could not open log file /var/log/lg.log: Permission denied: /usr/local/www/apache24/cgi-bin/lg.cgi, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:32.497713 2016] [cgi:error] [pid 92042] [client 10.150.1.250:52077] AH01215:  10.150.1.250  - - [Thu Sep 15 23:06:32 2016] ping asm-asa 8.8.8.8: /usr/local/www/apache24/cgi-bin/lg.cgi, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:43.236114 2016] [authz_core:debug] [pid 92042] mod_authz_core.c(806): [client 10.150.1.250:52078] AH01626: authorization result of Require all granted: granted, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:43.236180 2016] [authz_core:debug] [pid 92042] mod_authz_core.c(806): [client 10.150.1.250:52078] AH01626: authorization result of <RequireAny>: granted, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:43.237945 2016] [cgi:error] [pid 92042] [client 10.150.1.250:52078] AH01215: (8)Exec format error: exec of '/usr/local/www/apache24/cgi-bin/lgnotes.html' failed: /usr/local/www/apache24/cgi-bin/lgnotes.html, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:43.237985 2016] [cgi:error] [pid 92042] [client 10.150.1.250:52078] End of script output before headers: lgnotes.html, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:49.893410 2016] [authz_core:debug] [pid 92042] mod_authz_core.c(806): [client 10.150.1.250:52081] AH01626: authorization result of Require all granted: granted, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:49.893479 2016] [authz_core:debug] [pid 92042] mod_authz_core.c(806): [client 10.150.1.250:52081] AH01626: authorization result of <RequireAny>: granted, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:49.975811 2016] [cgi:error] [pid 92042] [client 10.150.1.250:52081] AH01215: [Thu Sep 15 23:06:49 2016] could not open log file /var/log/lg.log: Permission denied: /usr/local/www/apache24/cgi-bin/lg.cgi, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
[Thu Sep 15 18:06:49.976051 2016] [cgi:error] [pid 92042] [client 10.150.1.250:52081] AH01215:  10.150.1.250  - - [Thu Sep 15 23:06:49 2016] ping meyer-asa 8.8.8.8: /usr/local/www/apache24/cgi-bin/lg.cgi, referer: http://rancid3svn.borg.local/cgi-bin/lgform.cgi
root@rancid3svn:/tmp # 

cat /usr/local/etc/apache24/Includes/rancid-lg.conf
<VirtualHost 10.150.1.71>
LoadModule cgi_module libexec/apache24/mod_cgi.so
LoadModule fcgid_module libexec/apache24/mod_fcgid.so
AddHandler cgi-script .cgi
  <IfModule mod_fcgid.c>
    AddHandler fcgid-script .fcgi
  </IfModule>
ServerName lookingglass.borg.local
<Directory /usr/local/www/apache24/cgi-bin>
     Options Includes ExecCGI FollowSymlinks SymLinksIfOwnerMatch MultiViews
     AllowOverride All
     Order allow,deny
     DirectoryIndex lgform.cgi index.html
     Require all granted
</Directory>
</VirtualHost>

root@rancid3svn:/usr/local/www/apache24/cgi-bin # ls -la
total 69
drwxr-xr-x  3 root  wheel     10 Sep 15 18:47 .
drwxr-xr-x  7 root  wheel      7 Sep 14 17:09 ..
-rw-r--r-x  1 root  wheel    490 Sep 14 22:31 index.html
drwxr-xr-x  2 root  wheel      7 Sep 14 21:32 lg
-rwxr-xr-x  1 root  wheel  27117 Sep 15 08:01 lg.cgi
-rwxr-xr-x  1 root  wheel   7820 Sep 14 22:30 lgform.cgi
-rw-r--r-x  1 root  wheel   2607 Sep 14 22:31 lgnotes.html
-r--------  1 root  wheel    820 Dec 17  2012 printenv
lrwxr-xr-x  1 root  wheel     47 Sep 14 21:32 routers.db -> /usr/local/var/rancid/NetworkDevices/routers.db
-r--------  1 root  wheel   1261 Dec 17  2012 test-cgi
root@rancid3svn:/usr/local/www/apache24/cgi-bin # 

cat /usr/local/etc/rancid/lg.conf | egrep -v '^(;|#|//)' | head -6
$ENV{PATH}="/usr/local/bin:/usr/local/bin:/usr/sbin:/usr/bin:/bin";
$LG_CACHE_DIR="/tmp";
$LG_CLONGINRC="/usr/local/var/rancid/.cloginrc";
$LG_LOG="/var/log/lg.log";
$LG_ROUTERDB="/usr/local/var/rancid/NetworkDevices/router.db";
$LG_STRIP=1;
```


----------



## SirDice (Sep 16, 2016)

I'd fix the error regarding the logs first. Keep in mind that the www user doesn't have permission to write to /var/log/. Once you fixed the logging I'm sure the cause of the failure will be logged.


----------

