Page 1 of 1
Nagvis autologin
Posted: Fri Mar 01, 2013 10:35 am
by Alex
Hi everyone
I want to automatically login to Nagvis with my nagiosadmin account (usually I have to log on Nagios XI first and then to Nagvis to access the maps but I would like to login just once for both)
I found this on the Nagvis FAQ:
The following mod_rewrite config maps the user "nagiosadmin" to NagVis:
RewriteEngine on
RewriteLock var/log/rewrite.lck
RewriteLog /dev/null
RewriteLogLevel 0
# The following line is the really important step,
# it tells the webserver that the user "nagiosadmin" has
# successfully authenticated and is sending the request,
# regardless who is sending it really.
RewriteRule /nagvis/ - [E=REMOTE_USER:nagiosadmin]
My problem is that I don't know where I have to put this (I tried on http.conf but nothing happened)
Does anyone did configure the autologin and succeed?
Re: Nagvis autologin
Posted: Fri Mar 01, 2013 4:19 pm
by scottwilkerson
This would go in /etc/httpd/conf.d/nagvis.conf
Re: Nagvis autologin
Posted: Mon Mar 04, 2013 3:51 am
by Alex
I tried to put it in /etc/httpd/conf.d/nagvis.conf, the httpd service restarted succesfully but when I go to Nagvis (from nagios XI), the username and password are still required.
Here is my nagvis.conf file:
Code: Select all
# NagVis Apache2 sample configuration file
#
# #############################################################################
Alias /nagvis "/usr/local/nagvis/share"
<Directory "/usr/local/nagvis/share">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
# To enable Nagios basic auth on NagVis use the following options
# Just uncomment it. Maybe you need to adjust the path to the
# Auth user file.
#
# If you use the NagVis internal auth mechanism based on the web
# for you won't need this.
#
AuthName "NagVis Access"
AuthType Basic
AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users
Require valid-user
# With installed and enabled mod_rewrite there are several redirections
# available to fix deprecated and/or wrong urls. None of those rules is
# mandatory to get NagVis working.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /nagvis
# Use mod_rewrite for old url redirection even if there are php files which
# redirect the queries itselfs. In some cases the mod_rewrite redirect
# is better than the php redirect.
RewriteCond %{REQUEST_URI} ^/nagvis(/index\.php|/|)(\?.*|)$
RewriteRule ^(index\.php|)(\?.*|)$ /nagvis/frontend/nagvis-js/$1$2 [R=301,L]
RewriteCond %{REQUEST_URI} ^/nagvis/config\.php.*$
RewriteRule ^config\.php(.*) /nagvis/frontend/wui/$1 [R=301,L]
# Redirect old regular map links
RewriteCond %{REQUEST_URI} ^/nagvis/frontend/nagvis-js
RewriteCond %{QUERY_STRING} map=(.*)
RewriteRule ^(.*)$ /nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=%1 [R=301,L]
# Redirect old wui map links
RewriteCond %{REQUEST_URI} ^/nagvis/frontend/wui
RewriteCond %{QUERY_STRING} map=(.*)
RewriteRule ^(.*)$ /nagvis/frontend/wui/index.php?mod=Map&act=edit&show=%1 [R=301,L]
# Redirect old rotation calls
RewriteCond %{REQUEST_URI} ^/nagvis/frontend/nagvis-js
RewriteCond %{QUERY_STRING} !mod
RewriteCond %{QUERY_STRING} rotation=(.*)
RewriteRule ^(.*)$ /nagvis/frontend/nagvis-js/index.php?mod=Rotation&act=view&show=%1 [R=301,L]
</IfModule>
</Directory>
RewriteEngine on
RewriteLock var/log/rewrite.lck
RewriteLog /dev/null
RewriteLogLevel 0
RewriteRule /nagvis/ - [E=REMOTE_USER:nagiosadmin]
Re: Nagvis autologin
Posted: Mon Mar 04, 2013 12:49 pm
by lmiltchev
Make sure you have all these lines commented out in the "/etc/httpd/conf.d/nagvis.conf" file:
Code: Select all
# AuthName "NagVis Access"
# AuthType Basic
# AuthUserFile /usr/local/nagiosxi/etc/htpasswd.users
# Require valid-user
Then, add the following lines on the bottom of the file (under the "</Directory>" line):
Code: Select all
RewriteEngine on
RewriteLock var/log/rewrite.lck
RewriteLog /dev/null
RewriteLogLevel 0
RewriteRule /nagvis/ - [E=REMOTE_USER:nagiosadmin]
Restart apache:
Let us know if this worked.
Re: Nagvis autologin
Posted: Tue Mar 05, 2013 3:31 am
by Alex
Thanks very much for your help,
I didn't commented the lines, now everything works perfectlly
Re: Nagvis autologin
Posted: Tue Mar 05, 2013 11:10 am
by lmiltchev
I'm glad I could help!