Page 1 of 2

NagVis: Can't use admin login?

Posted: Mon Apr 23, 2012 3:32 pm
by JumpingSnake
Good Afternoon,
I've installed a trial instance of Nagios XI into our VMWare environment by using the vdk file (with CentOS, etc.). I'm trying to ticker around with NagVis, but it doesn't appear that I have any accounts that I can use to administer the plugin. I've tried using both the nagiosadmin and my own account that I created an installation, but the nagiosadmin account doesn't accept the default password nor the password that it's currently set to. When I use my account, it will allow me in, but doesn't give me access to edit or change anything (which I presume to mean that my account is setup with the "user" role).

Is there anyway I can reset the admin password to NagVis?

Is there another way that I'm can either assign my account as a "manager" or "admin" role in NagVis?

Am I just a noob and am missing something glaringly obvious but I've been working on it too long to notice?! :)

Thanks for any help!

Re: NagVis: Can't use admin login?

Posted: Mon Apr 23, 2012 4:03 pm
by lmiltchev
Look in the /etc/httpd/conf.d/nagvis.conf file to see what htpasswd.users file it's referencing. Change it to the /usr/local/nagiosxi/etc/htpasswd.users file and restart apache.

Code: Select all

service httpd restart
You should be able to log in as nagiosadmin.

Re: NagVis: Can't use admin login?

Posted: Mon Apr 23, 2012 4:15 pm
by JumpingSnake
That htpasswd file you mentioned is already setup to be the basic auth:

Code: Select all

<shell banner># more nagvis.conf
# 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>
My user account is in that file. The permissions on the htpasswd file are:

Code: Select all

-rw-r--r--.  1 nagios apache   91 Apr 23 20:28 htpasswd.users
Should Apache be setup with a different authentication method other than basic?

I can log into Nagios XI with nagiosadmin, but NagVis continues to not allow login with the same password.

Re: NagVis: Can't use admin login?

Posted: Mon Apr 23, 2012 8:42 pm
by lmiltchev
Your "nagvis.conf" file and the permissions on the htpasswd look fine. I'm not sure why you cannot log in. This is strange.

Try typing in your browser:

Code: Select all

http://<ip_address>/nagvis
and enter:

Code: Select all

username: nagiosadmin
password: <your_password>
See if you have anything interesting in the apache log that can give us some clues:

Code: Select all

tail /var/log/httpd/error_log

Re: NagVis: Can't use admin login?

Posted: Mon Apr 23, 2012 11:34 pm
by JumpingSnake
Well, I tried again but to no avail. This might help:

Code: Select all

[Mon Apr 23 21:07:27 2012] [error] [client <my computer>] user iboje: authentication failure for "/nagvis/": Password Mismatch, referer: http://<server>/nagiosxi/index.php?
[Mon Apr 23 21:07:45 2012] [error] [client <my computer>] user iboje: authentication failure for "/nagvis/": Password Mismatch, referer: http://<server>/nagiosxi/index.php?
[Mon Apr 23 21:10:25 2012] [error] [client <my computer>] File does not exist: /var/www/html/favicon.ico
[Tue Apr 24 04:30:53 2012] [error] [client <my computer>] user nagiosadmin: authentication failure for "/nagvis": Password Mismatch
[Tue Apr 24 04:30:59 2012] [error] [client <my computer>] user nagiosadmin: authentication failure for "/nagvis": Password Mismatch
[Tue Apr 24 04:31:04 2012] [error] [client <my computer>] File does not exist: /var/www/html/favicon.ico
So it does appear to be a wrong password for nagvis. Is there a way to reset the password for the admin account?

Re: NagVis: Can't use admin login?

Posted: Tue Apr 24, 2012 7:52 am
by JumpingSnake
I changed the password for the nagiosadmin account from XI and that didn't work. I also set my account up as an admin, and that hasn't allowed me access either.

Well, worse comes to worse, I'm about 1 hour away from seeing if I can use some software to crack the .ht file and see what the password is while continuing to search for a solution.

Re: NagVis: Can't use admin login?

Posted: Tue Apr 24, 2012 9:43 am
by scottwilkerson
Can you log into the core interface (which should use the same htpasswd.users) file?
http://<server>/nagios/

Re: NagVis: Can't use admin login?

Posted: Tue Apr 24, 2012 9:56 am
by JumpingSnake
Ah, interesting idea. Here's what I've found:

1) http://<server>/nagios/ - I cannot log into this site using any of the defaults, old, or current passwords.

2) I'm still able to log into Nagios XI home page, but when I try to go into the Core Configure page, it only accepts the old password, not the current password.

3) NagVis is just like #1 above, still won't allow me in as anything greater than a user with my account, but won't login with the nagiosadmin account.


Ideas?

Re: NagVis: Can't use admin login?

Posted: Tue Apr 24, 2012 10:20 am
by JumpingSnake
Ok, found this out on the web (take with grain of salt, it's from 2008 and I'm not an Apache htaccess guy): http://www.cyberciti.biz/faq/apache-htaccess/

Basically, it looks like unless it's set to ALL, then the files won't be used. If I run the following:


[root@<server> /]# grep -r -i AllowOverride /etc
/etc/httpd/conf.d/nagiosql.conf: AllowOverride None
/etc/httpd/conf.d/nagios.conf: AllowOverride None
/etc/httpd/conf.d/nagios.conf: AllowOverride None
/etc/httpd/conf.d/nrdp.conf: AllowOverride None
/etc/httpd/conf.d/nagvis.conf: AllowOverride None
/etc/httpd/conf.d/nagiosxi.conf: AllowOverride None
/etc/httpd/conf/httpd.conf: AllowOverride None
/etc/httpd/conf/httpd.conf:# AllowOverride controls what directives may be placed in .htaccess files.
/etc/httpd/conf/httpd.conf: AllowOverride None
/etc/httpd/conf/httpd.conf:# AllowOverride FileInfo AuthConfig Limit
/etc/httpd/conf/httpd.conf:# for additional configuration directives. See also the AllowOverride
/etc/httpd/conf/httpd.conf: AllowOverride None
/etc/httpd/conf/httpd.conf: AllowOverride None
/etc/httpd/conf/httpd.conf: AllowOverride None

Like I said, I'm not a huge htaccess guy, so I'm not sure if changing anything to ALL would create holes to change these files or not, but I thought I'd throw this out there.

Re: NagVis: Can't use admin login?

Posted: Tue Apr 24, 2012 11:35 am
by lmiltchev
From the Nagios XI web interface, go to: Admin->Users->Manage Users->nagiosadmin->Edit, enter a new password and click on "Update User". Give it a few minutes and see if you are going to be able to log into the Nagios Core and Nagvis.