Gestion des mots de passe de l'interface web de shinken

Shinken est sortie il y a peu de temps en version 1.0rc1. J'ai voulu l'installer et utiliser la nouvelle interface web. Comme j'ai eu quelques difficultés et qu'il semblerait que d'autre ai eu le même problème que moi (merci à David pour ton aide !), je me permets de déposer quelques éléments sur le sujet.
Pour l'installation, il faut tout d'abord télécharger l'archive à l'adresse suivante :https://github.com/naparuba/shinken/tarball/1.0rc1
Vous obtiendrez alors l'archive naparuba-shinken-1.0rc1-0-g5a2075e.tar.gz. Une fois l'archive décompressé, vous pourrez lancer l'installation à l'aide de la commande suivante :
sudo python setup.py install --install-scripts=/usr/bin/
De là, lancez shinken avec la commande /etc/init.d/shinken start
Si vous jetez un oeil au process shinken de votre machine, vous devriez obtenir les choses suivantes :
root@robert:/home/drayan/dev/naparuba-shinken-5a2075e# ps -fu shinken
UID PID PPID C STIME TTY TIME CMD
shinken 15495 30036 0 00:15 ? 00:00:00 /usr/bin/python /usr/bin//shinken-reactionner -d -c /etc/shinken/reactionnerd.ini
shinken 30009 1 0 Feb25 ? 00:00:56 /usr/bin/python /usr/bin//shinken-scheduler -d -c /etc/shinken/schedulerd.ini
shinken 30019 30009 0 Feb25 ? 00:00:00 /usr/bin/python /usr/bin//shinken-scheduler -d -c /etc/shinken/schedulerd.ini
shinken 30021 1 0 Feb25 ? 00:00:51 /usr/bin/python /usr/bin//shinken-poller -d -c /etc/shinken/pollerd.ini
shinken 30031 30021 0 Feb25 ? 00:00:21 /usr/bin/python /usr/bin//shinken-poller -d -c /etc/shinken/pollerd.ini
shinken 30036 1 0 Feb25 ? 00:00:40 /usr/bin/python /usr/bin//shinken-reactionner -d -c /etc/shinken/reactionnerd.ini
shinken 30046 30036 0 Feb25 ? 00:00:07 /usr/bin/python /usr/bin//shinken-reactionner -d -c /etc/shinken/reactionnerd.ini
shinken 30051 1 0 Feb25 ? 00:00:54 /usr/bin/python /usr/bin//shinken-broker -d -c /etc/shinken/brokerd.ini
shinken 30061 30051 2 Feb25 ? 00:05:53 /usr/bin/python /usr/bin//shinken-broker -d -c /etc/shinken/brokerd.ini
shinken 30063 1 0 Feb25 ? 00:00:22 /usr/bin/python /usr/bin//shinken-receiver -d -c /etc/shinken/receiverd.ini
shinken 30073 30063 0 Feb25 ? 00:00:00 /usr/bin/python /usr/bin//shinken-receiver -d -c /etc/shinken/receiverd.ini
shinken 30079 1 0 Feb25 ? 00:01:11 /usr/bin/python /usr/bin//shinken-arbiter -d -c /etc/shinken/nagios.cfg -c /etc/shinken/shinken-specific.cfg
shinken 30080 30079 0 Feb25 ? 00:00:03 /usr/bin/python /usr/bin//shinken-arbiter -d -c /etc/shinken/nagios.cfg -c /etc/shinken/shinken-specific.cfg
shinken 30087 30079 0 Feb25 ? 00:00:00 /usr/bin/python /usr/bin//shinken-arbiter -d -c /etc/shinken/nagios.cfg -c /etc/shinken/shinken-specific.cfg
shinken 30109 30021 0 Feb25 ? 00:00:04 /usr/bin/python /usr/bin//shinken-poller -d -c /etc/shinken/pollerd.ini
shinken 30116 30021 0 Feb25 ? 00:00:04 /usr/bin/python /usr/bin//shinken-poller -d -c /etc/shinken/pollerd.ini
shinken 30124 30021 0 Feb25 ? 00:00:04 /usr/bin/python /usr/bin//shinken-poller -d -c /etc/shinken/pollerd.ini
shinken 30140 30051 1 Feb25 ? 00:03:26 /usr/bin/python /usr/bin//shinken-broker -d -c /etc/shinken/brokerd.ini
shinken 30149 30051 0 Feb25 ? 00:00:14 /usr/bin/python /usr/bin//shinken-broker -d -c /etc/shinken/brokerd.ini
shinken 30170 30021 0 Feb25 ? 00:00:04 /usr/bin/python /usr/bin//shinken-poller -d -c /etc/shinken/pollerd.ini
Vous pouvez maintenant vous rendre sur l'interface web de shinken sur l'url suivante : http://localhost:7767/
Un utilisateur vous sera demandé. Il s'agira par défaut de admin/admin.
A ce sujet, il faut savoir que le système d'authentification s'appuie sur la configuration contenu dans le fichier shinken-specific.cfg (dans le répertoire /etc/shinken) et notamment sur le passage suivant :


# The WebUI broker module
define module{
module_name WebUI
module_type webui

host 0.0.0.0 ; mean all interfaces
port 7767

[...]
modules Apache_passwd,ActiveDir_UI,Cfg_password
[...]
}
Comme indiqué, l'interface essaye d'authentifier l'utilisateur avec 3 modules différents. Le premier qui y arrive arrête le mécanisme.
Dans le cas présent, nous allons tout d'abord essayer de nous authentifier avec un fichier htpasswd apache (toujours dans shinken-specific.cfg) :

define module{
module_name Apache_passwd
module_type passwd_webui

# WARNING : put the full PATH for this value!
passwd /etc/shinken/htpasswd.users

}
Vient ensuite le module active directory :

# Check authentification for WebUI using a Active Directory
define module{
module_name ActiveDir_UI
module_type ad_webui

# UNCOMMENT this line to really enable this module and allow it to
# connect!
# ldap_uri ldaps://myserver
username user
password password
basedn DC=google,DC=com

}
Enfin, dans le cas de l'interface web de shinken (avec sa conf par défaut), ce dernier va s'appuyer sur ces fichiers de configuration. Dans le cas de l'utilisateur admin, il s'agit d'un contact (au sens nagios) définie dans les fichiers de configuration (par défaut, fichier contacts.cfg). Le mot de passe est par ailleurs définie de la manière suivante :

define contact{
use generic-contact
contact_name admin
email shinken@localhost
pager 0600000000 ; contact phone number
password admin
is_admin 1
}
De là, vous pouvez changer le mot de passe et le faire prendre en compte par shinken. Il ne reste plus maintenant qu'à configurer vos services !
Vus : 1750
Publié par Yannig : 63