Bläddra i källkod

graylog: Use mongodb with authentication

Philipp Fromme 1 år sedan
förälder
incheckning
172990e9c3
2 ändrade filer med 10 tillägg och 1 borttagningar
  1. 9 0
      graylog/init.sls
  2. 1 1
      graylog/server.conf.tmpl

+ 9 - 0
graylog/init.sls

@@ -12,6 +12,15 @@
 include:
   - elasticsearch
 
+mongouser:
+  mongodb_user.present:
+  - name: {{ graylog_config['mongodb_username'] }}
+  - passwd: {{ graylog_config['mongodb_password'] }}
+  - database: graylog
+  - roles: {{ graylog_config['mongodb_roles'] }}
+  - user: {{ mongodb_admin_username }}
+  - password: {{ mongodb_admin_password }}
+
 graylog-repo:
 # add Graylog Repo
   pkgrepo.managed:

+ 1 - 1
graylog/server.conf.tmpl

@@ -530,7 +530,7 @@ lb_recognition_period_seconds = 3
 
 # MongoDB connection string
 # See https://docs.mongodb.com/manual/reference/connection-string/ for details
-mongodb_uri = mongodb://localhost/graylog
+mongodb_uri = mongodb://{{ graylog_config['mongodb_username'] }}:{{ graylog_config['mongodb_password'] }}@localhost/graylog
 
 # Authenticate against the MongoDB server
 # '+'-signs in the username or password need to be replaced by '%2B'