Concept

L'authentification par mot de passe à MongoDB garantit que seul l'utilisateur Shinken peut accéder aux données dans la base.

Activer l'authentification par mot de passe dans MongoDB

Pour activer l'authentification dans MongoDB, il rajoute le champ suivant dans le fichier de configuration /etc/mongod.conf 



security:
 authorization: enabled



Exemple de fichier de configuration :



# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# Where and how to store data.
storage:
  dbPath: /var/lib/mongo
  journal:
    enabled: true


# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid


# network interfaces
# NOTE: when go as a replicat member (cluster), change the 27017 to 27018 according to configuration
#       and comment the bindIp parameter
net:
  port: 27017
  unixDomainSocket:
    enabled: false
  bindIp: 127.0.0.1  # Listen to local interface only, comment to listen on all interfaces.




storage:
    engine: wiredTiger


security:
 authorization: enabled



Pour prendre en compte l'activation de l'authentification, il faut redémarrer le démon de la base de données : 



Créer l'utilisateur Shinken


Déclarer l'utilisateur et le mot de passe dans Shinken


Dans les fichiers de configuration


Dans les commandes