From 02160b12ee763ff4cd0820ebbc47808cbccbdbff Mon Sep 17 00:00:00 2001 From: Josh Brower Date: Sun, 10 May 2020 07:57:45 -0400 Subject: [PATCH] Fix playbook mysql errors --- salt/playbook/init.sls | 20 ++++++++++++++++++++ salt/top.sls | 2 -- setup/so-functions | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/salt/playbook/init.sls b/salt/playbook/init.sls index 81c7dd309..772577822 100644 --- a/salt/playbook/init.sls +++ b/salt/playbook/init.sls @@ -52,6 +52,26 @@ query_updatepluginurls: - connection_user: root - connection_pass: {{ MYSQLPASS }} +playbookdbuser: + mysql_user.present: + - host: 172.17.0.0/255.255.0.0 + - password: {{ PLAYBOOKPASS }} + - connection_host: {{ MAINIP }} + - connection_port: 3306 + - connection_user: root + - connection_pass: {{ MYSQLPASS }} + +playbookdbdbpriv: + mysql_grants.present: + - grant: all privileges + - database: playbook.* + - user: playbookdbuser + - host: 172.17.0.0/255.255.0.0 + - connection_host: {{ MAINIP }} + - connection_port: 3306 + - connection_user: root + - connection_pass: {{ MYSQLPASS }} + {% if PLAYBOOKPASS == None %} playbook_password_none: diff --git a/salt/top.sls b/salt/top.sls index 6af94e26a..e28c60bd0 100644 --- a/salt/top.sls +++ b/salt/top.sls @@ -68,9 +68,7 @@ base: - firewall - idstools - healthcheck - {%- if FLEETMASTER or FLEETNODE %} - mysql - {%- endif %} {%- if WAZUH != 0 %} - wazuh {%- endif %} diff --git a/setup/so-functions b/setup/so-functions index dae31a79c..94f01898a 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -122,6 +122,7 @@ secrets_pillar(){ printf '%s\n'\ "secrets:"\ " mysql: $MYSQLPASS"\ + " playbook: $PLAYBOOKPASS"\ " fleet: $FLEETPASS"\ " fleet_jwt: $FLEETJWT"\ " fleet_enroll-secret: False" > /opt/so/saltstack/pillar/secrets.sls @@ -736,6 +737,7 @@ fleet_pillar() { generate_passwords(){ # Generate Random Passwords for Things MYSQLPASS=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) + PLAYBOOKPASS=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) FLEETPASS=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) FLEETJWT=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) HIVEKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)