This repository has been archived by the owner on Nov 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from agno01/mysql-hardening-hardening-conf
- renamed 'mysql_hardening_mysql_conf' var to 'mysql_hardening_mysql_…
- Loading branch information
Showing
6 changed files
with
12 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
--- | ||
|
||
- name: protect my.cnf | ||
file: path='{{mysql_hardening_mysql_conf}}' mode=0600 owner=root group=root follow=yes | ||
file: path='{{mysql_hardening_mysql_conf_file}}' mode=0400 owner='{{mysql_hardening_user}}' group='{{mysql_hardening_group}}' follow=yes | ||
|
||
- name: ensure permissions on mysql-datadir are correct | ||
file: path='{{mysql_datadir}}' state=directory owner='{{mysql_hardening_user}}' group='{{mysql_hardening_user}}' | ||
|
||
- name: check mysql configuration-directory exists and has right permissions | ||
file: path='/etc/mysql/conf.d' state=directory owner='{{mysql_hardening_user}}' group='{{mysql_hardening_group}}' mode=0470 | ||
file: path='{{mysql_hardening_mysql_confd_dir}}' state=directory owner='{{mysql_hardening_user}}' group='{{mysql_hardening_group}}' mode=0570 | ||
|
||
- name: check include-dir directive is present in my.cnf | ||
lineinfile: dest='{{mysql_hardening_mysql_conf}}' line='!includedir /etc/mysql/conf.d/' insertafter='EOF' state=present backup=yes | ||
lineinfile: dest='{{mysql_hardening_mysql_conf_file}}' line='!includedir {{mysql_hardening_mysql_confd_dir}}' insertafter='EOF' state=present backup=yes | ||
notify: restart mysql | ||
|
||
- name: apply hardening configuration | ||
template: src='hardening.cnf.j2' dest='{{mysql_hardening_hardening_conf}}' owner='{{mysql_hardening_user}}' group='{{mysql_hardening_group}}' mode=0460 | ||
template: src='hardening.cnf.j2' dest='{{mysql_hardening_mysql_hardening_conf_file}}' owner='{{mysql_hardening_user}}' group='{{mysql_hardening_group}}' mode=0460 | ||
notify: restart mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mysql_daemon: mysql | ||
mysql_hardening_mysql_conf: '/etc/mysql/my.cnf' | ||
mysql_hardening_mysql_conf_file: '/etc/mysql/my.cnf' | ||
mysql_hardening_mysql_confd_dir: '/etc/mysql/conf.d' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mysql_daemon: mysqld | ||
mysql_hardening_mysql_conf: '/etc/my.cnf' | ||
mysql_hardening_mysql_conf_file: '/etc/my.cnf' | ||
mysql_hardening_mysql_confd_dir: '/etc/my.cnf.d' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
mysql_daemon: mysqld | ||
mysql_hardening_mysql_conf: '/etc/my.cnf' | ||
mysql_hardening_mysql_conf_file: '/etc/my.cnf' | ||
mysql_hardening_mysql_confd_dir: '/etc/my.cnf.d' |