Nagvis autologin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Alex
Posts: 5
Joined: Fri Feb 15, 2013 5:03 am

Nagvis autologin

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagvis autologin

Post by scottwilkerson »

This would go in /etc/httpd/conf.d/nagvis.conf
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Alex
Posts: 5
Joined: Fri Feb 15, 2013 5:03 am

Re: Nagvis autologin

Post 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]
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagvis autologin

Post 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:

Code: Select all

service httpd restart
Let us know if this worked.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Alex
Posts: 5
Joined: Fri Feb 15, 2013 5:03 am

Re: Nagvis autologin

Post by Alex »

Thanks very much for your help,

I didn't commented the lines, now everything works perfectlly :D
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagvis autologin

Post by lmiltchev »

I'm glad I could help! :D
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked