Database corruption issues

This support forum board is for questions relating to Nagios Fusion.
Locked
User avatar
gwakem
Posts: 238
Joined: Mon Jan 23, 2012 2:02 pm
Location: Asheville, NC

Database corruption issues

Post by gwakem »

Server info: Fusion 4.1.7 on RHEL 7.5
Question: Is there a quick command I can use within mariadb to reset the password field for all fused servers?
Background: All of my servers stopped allowing fusion to check in after a reboot. It appears that all passwords stored in the database have become corrupt. I manually changed one and it corrected, but here is the type of data Im looking at:

Code: Select all

[password] => �m(y�	Ca�,
There are over 200 servers fused in there so I really, really do not want to do it by hand.
--
Griffin Wakem
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Database corruption issues

Post by ssax »

Do they all use the same username/password?

If yes, you could do this:

Code: Select all

mysql -ufusion -pfusion fusion -e "update servers set password = 'YOURPASSWORD';"
User avatar
gwakem
Posts: 238
Joined: Mon Jan 23, 2012 2:02 pm
Location: Asheville, NC

Re: Database corruption issues

Post by gwakem »

Unfortunately this did not seem to fix the issue. I did have a special charicter in the password, but even escaping that left the password still did not work.

I changed the password on a single remote server, and updated the password field globally to test a plain password with no special characters, but that does not work either. I confirmed the password is being updated in the database.

As a special control I did this:
* Set password manually on a remote Nagios instance

Code: Select all

htpasswd /usr/local/nagios/etc/htpasswd.users xxxxxxxx
New password: 
Re-type new password: 
Updating password for user xxxxxxxx
* Set password globally on the fusion server

Code: Select all

mysql -ufusion -pfusion fusion -e "update servers set password = 'password';"
* Verified the database updated correctly:

Code: Select all

MariaDB [fusion]> select * from servers limit 5;
(good results for password field)
* Fusion > Admin > Manage Fused Servers > Server in question > Edit > Test Fusion Settings > FAIL

* copy password directly from SQL query output (select * from servers limit 5;) into Password field in the web interface > Test Fusion Settings > SUCCESS

Wat
--
Griffin Wakem
User avatar
gwakem
Posts: 238
Joined: Mon Jan 23, 2012 2:02 pm
Location: Asheville, NC

Re: Database corruption issues

Post by gwakem »

I see why. Its because in the database, it's hashed. When I run the command, it puts it in plaintext. I mean, this makes sense.

I took the hash from the test case, re-ran the command with the hash as the password, and that worked. I can change the password globally on all remote systems using Anisble so that's fine.

Its working now, this can be locked.
--
Griffin Wakem
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Database corruption issues

Post by npolovenko »

@gwakem, Good catch! I will be closing this thread as resolved.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked