Symptoms
Authentication to Centreon fails in the following cases:
- After a fresh installation or an update, the following error message occurs during the authentication process: “User is blocked”.
- This message appears after a mistake in the configuration in MAP or Autodiscovery:
API] d127.0.0.1] Authentication failed for 'admin'
- In the /var/log/centreon/login.log file, you meet many errors as follows:
- This error occurs in the MAP diagnostic:
cERROR] Could not authenticate using admin (error 500)
Problem
There is no specific user defined for Autodiscovery and MAP. As recommended, you need to use specific users for those modules.
For example, the user for Autodiscovery could be autodisco and the user for MAP could be admin_map.
Solution
Given that the blocked account is Admin.
Step 1: Unblock the Admin user
From version 22.04
Go to http://phptester.net/
- Edit the following script with the password you want (centreon in the example below) and paste it in the phptester site:
<?php
echo password_hash('centreon', PASSWORD_BCRYPT); - Click on Click to test your php code.
-
Copy the password (see example in the screenshot above) and paste it in the following command, where here is the password to paste and contact_id is the blocked user id. Then run the query:
INSERT INTO contact_password (password, contact_id, creation_date) VALUES ('
here', <
contact_id>, (SELECT UNIX_TIMESTAMP(NOW())));
Before version 22.04
- Enter this command:
mysql -uroot centreon
- Retrieve the id corresponding to the user blocked:
select contact_name,contact_id from contact\G
- Enter the following command to change your password, where pwd is the password you want and id is the id previously retrieved:
UPDATE contact SET contact_passwd = md5('$pwd') WHERE contact_id= $id;
Step 2: Change the MAP configuration
- Make sure the account in the /etc/centreon-studio/studio-config.properties file is not the default Admin account used to administrate Centreon. If so, edit the file.
- If you have edited the file, enter this command to apply the change:
systemctl restart centreon-map
Step 3: Change the Autodiscovery configuration
- Make sure the account in the /etc/centreon-gorgone/config.d/31-centreon-api.yaml file is not the default Admin account used to administrate Centreon. If so, edit the file.
- If you have edited the file, enter this command to apply the change:
systemctl restart gorgoned
Step 4: Unblock the Admin user in the database
Enter the following commands:
mysql -uroot
update centreon.contact set login_attempts=NULL, blocking_time=NULL;
Still stuck?
If you are still stuck for MAP, follow this procedure.
See also