Solved

User is blocked


Badge +1

Guys i just installed Centreon for testing on my lab, for whatever reason i was using the incorrect password for the user admin in the web access and now the user is bloqued.

Do you have any advise on how to unlock the user, i have access to the centos root without any problems.

 

Thanks

icon

Best answer by ponchoh 23 June 2022, 22:05

View original

20 replies

Userlevel 4
Badge +13

Hello @rusomenace 

Just to confirm, do you want a solution to change the admin password without any access to the GUI?

Regards

Badge

Hello @sduret,

I have the same problem, the admin account is blocked after the installation.

I want to reset the password with the command line but i don’t know how to do.

Thanks

Userlevel 4
Badge +13

Hello
You can connect to the DB and execute this query:

USE centreon
UPDATE contact SET contact_passwd = md5('NEW_PASSWORD') WHERE contact_alias = 'CONTACT_ALIAS';

Regards

Badge

I'm new to Linux.
How can I connect to the Centreon database to execute the command you sent me?

Thanks

Regards

Userlevel 4
Badge +13

@AVAYER you can read this article:

https://dev.mysql.com/doc/refman/8.0/en/connecting.html

 

So for instance, you can use this ocmmand line:

mysql -h XX.XX.XX.XX -u centreon -ppassword

If the database is on localhost and you don’t have password for root user, you can simply use:

mysql -u root

Regards

Userlevel 4
Badge +13

hi @AVAYER and @rusomenace if you are blocked under the v.22.04

 

you can reset the user with the next query, make sure to use the right contact ID (replace [change] with the right number id.

 

update centreon.contact set login_attempts=NULL, blocking_time=NULL where contact_id=[change];

 

 

Can I recommend to use the CentOS7 VMWare (OVA) images (https://download.centreon.com/) and follow the documentation https://docs.centreon.com/docs/installation/installation-of-a-central-server/using-virtual-machines/

Badge

I managed to successfully login to the web interface. Thanks a lot for your help

Userlevel 1
Badge +7

Hello,

 

If you want to desactivate the “blocking option” as me, you need to set “Time that must pass before new connection is allowed” to 0 minute.

Badge

Hi, 

Tried to reset my admin password with the next command :

UPDATE contact SET contact_passwd=md5('toto') where contact_alias='admin';

but ==> Unknown column 'contact_passwd' in 'field list'

 

Checked the fields with “SELECT * FROM contact;” …did not find it.

 

Any help ?

Userlevel 4
Badge +13

@BastienO have you had the opportunity of looking at the contact and contact_password tables if you are using 22.04+

Userlevel 4
Badge +13

Hi @BastienO 

From Centreon 22.04, the algorithm of password hash is in BCRYPT and no more in MD5.

If you need to hardcode a password directly in a database, the MD5('mypassword') function will no more work (the login will try to compare a MD5 password in database with a BCRYPT hash and your authentication will fail).

To avoid this, here is a pair of clear password => hash value. Be sure to write the hashed password in database.

Clear password

Hashed Value

centreon

$2y$10$ubq1hJ9z3YPXBhejjae.Ie9u3AcMrwFNImPhOnnkLmEoNtwRGwNrC

 

Also the database structure has changed. Now the password are stored in a dedicate table, to update your user password use the following query:

MariaDB [centreon]> desc contact_password;
+---------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------------------+------+-----+---------+----------------+
| id | int(11) unsigned | NO | PRI | NULL | auto_increment |
| password | varchar(255) | NO | | NULL | |
| contact_id | int(11) | NO | MUL | NULL | |
| creation_date | bigint(20) unsigned | NO | MUL | NULL | |
+---------------+---------------------+------+-----+---------+----------------+
INSERT INTO contact_password (password, contact_id, creation_date) VALUES (<your_encrypted_password, <contact_id>, (SELECT UNIX_TIMESTAMP(NOW())));

 

You can now login as usual with your credentials:

  • username: <your_username>
  • password: centreon

 

Warning: You will be able to connect to Centreon UI or API with this password, but it doesn’t follow any security policy so be sure to change it for a safer one when you are able to connect to Centreon.

Badge

Worked ! 

Thank you very much

Badge +6

Bonjour.

Je m’appel Laurent et je débute sur Centreon et je n’ai que très très peu de notion dans Mysql.
Je sais me connecte à ma DB centreon avec mysql en root.

Je suis dans le même cas que Rusomenace.
J’ai appliqué les 2 commandes données par @ponchoh et @sduret mais hélas, à chaque fois j’ai la même erreur.
 

Quand je tape : 

 update centreon.contact set login_attempts=NULL, blocking_time=NULL where contact_id = admin;

ou 

UPDATE contact SET contact_passwd = md5(mypwd) WHERE contact_alias = admin;

cela me répond : 

ERROR 1054 (42S22): Unknown column 'admin' in 'where clause'

Je ne sais pas comment interpréter cette réponse, je suis bloqué.

A savoir que c’est “admin” qui est bloqué à la page web de connexion à centreon.
Et bien entendu je n’ai qu’un seul utilisateur.

Merci d’avance pour votre aide.

 

Badge +6

PS : ce n’est pas un problème de mot car je suis sur de celui ci.

Badge +6

J’ai réussi après plusieurs essai!!!

J’ai tapé ca : 

MariaDB [centreon]> update centreon.contact set login_attempts=NULL, blocking_time=NULL;

Ca a répondu : 

Query OK, 1 row affected (0.005 sec)
Rows matched: 4 Changed: 1 Warnings: 0

et j’ai récupéré mon accès  :)

Merci quand même de m’avoir lu ;)

Userlevel 4
Badge +13

Hi @laurentl 
Thanks for your feedback.

There error message Unknown column 'admin' in 'where clause' was displayed because you forgot the quotes.

Here is the query with quotes;

update centreon.contact set login_attempts=NULL, blocking_time=NULL where contact_id = 'admin';

Good to know it works now

Badge +6

Hi @laurentl 
Thanks for your feedback.

There error message Unknown column 'admin' in 'where clause' was displayed because you forgot the quotes.

Here is the query with quotes;

update centreon.contact set login_attempts=NULL, blocking_time=NULL where contact_id = 'admin';

Good to know it works now

Merci pour votre explication :)

Laurent.

Badge +2

 

@sduret 

Hello, I try : 

INSERT INTO contact_password (password, contact_id, creation_date) VALUES (<your_encrypted_password, <contact_id>, (SELECT UNIX_TIMESTAMP(NOW())));

 

and : 

 

INSERT INTO contact_password (password, contact_id, creation_date) VALUES (<$2y$10$ubq1hJ9z3YPXBhejjae.Ie9u3AcMrwFNImPhOnnkLmEoNtwRGwNrC>, <admin>, (SELECT UNIX_TIMESTAMP(NOW())));

 

and : 

 

INSERT INTO contact_password (password, contact_id, creation_date) VALUES ($2y$10$ubq1hJ9z3YPXBhejjae.Ie9u3AcMrwFNImPhOnnkLmEoNtwRGwNrC, <admin>, (SELECT UNIX_TIMESTAMP(NOW())));

 

Without any succes can you help me I’m in 22.10.

Badge +2

It’s OK I find it :

INSERT INTO contact_password (password, contact_id, creation_date) VALUES ('$2y$10$ubq1hJ9z3YPXBhejjae.Ie9u3AcMrwFNImPhOnnkLmEoNtwRGwNrC', 1, (SELECT UNIX_TIMESTAMP(NOW())));

 

It will be more easy for noob like me to have the full cmd line !

Badge

Bonjour,

 

Pour ma part en 22.10 pour débloquer l’user admin :

Je me suis connecté sur le serveur central.

ensuite pour accéder a la bdd : 

mysql --host=(ip du serveur bdd) --user=centreon --password=(password de la bdd)

 

Ensuite il faut choisir la base donc :

USE centreon

 

et enfin la commande qui m’a débloqué : 

update centreon.contact set login_attempts=NULL, blocking_time=NULL where contact_alias = 'admin'

Reply