Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

Commit d73fa4f

Browse files
authored
Merge pull request #22 from agno01/mysql-hardening-hardening-conf
- renamed 'mysql_hardening_mysql_conf' var to 'mysql_hardening_mysql_…
2 parents b6a9c11 + 6fa5784 commit d73fa4f

File tree

6 files changed

+12
-9
lines changed

6 files changed

+12
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This hardening role installs the hardening but expects an existing installation
2626
- `mysql_hardening_enabled: yes` role is enabled by default and can be disabled without removing it from a playbook. You can use conditional variable, for example: `mysql_hardening_enabled: "{{ true if mysql_enabled else false }}"`
2727
- `mysql_hardening_user: 'mysql'` The user that mysql runs as.
2828
- `mysql_datadir: '/var/lib/mysql'` The MySQL data directory
29-
- `mysql_hardening_hardening_conf: '/etc/mysql/conf.d/hardening.cnf'` The path to the configuration file where the hardening will be performed
29+
- `mysql_hardening_mysql_hardening_conf_file: '/etc/mysql/conf.d/hardening.cnf'` The path to the configuration file where the hardening will be performed
3030

3131
## Security Options
3232

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mysql_hardening_enabled: yes
55
mysql_hardening_user: 'mysql'
66
mysql_hardening_group: 'root'
77
mysql_datadir: '/var/lib/mysql'
8-
mysql_hardening_hardening_conf: '/etc/mysql/conf.d/hardening.cnf'
8+
mysql_hardening_mysql_hardening_conf_file: '{{mysql_hardening_mysql_confd_dir}}/hardening.cnf'
99
# You have to change this to your own strong enough mysql root password
1010
mysql_root_password: '-----====>SetR00tPa$$wordH3r3!!!<====-----'
1111
# There .my.cnf with mysql root credentials will be installed

tasks/configure.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22

33
- name: protect my.cnf
4-
file: path='{{mysql_hardening_mysql_conf}}' mode=0600 owner=root group=root follow=yes
4+
file: path='{{mysql_hardening_mysql_conf_file}}' mode=0400 owner='{{mysql_hardening_user}}' group='{{mysql_hardening_group}}' follow=yes
55

66
- name: ensure permissions on mysql-datadir are correct
77
file: path='{{mysql_datadir}}' state=directory owner='{{mysql_hardening_user}}' group='{{mysql_hardening_user}}'
88

99
- name: check mysql configuration-directory exists and has right permissions
10-
file: path='/etc/mysql/conf.d' state=directory owner='{{mysql_hardening_user}}' group='{{mysql_hardening_group}}' mode=0470
10+
file: path='{{mysql_hardening_mysql_confd_dir}}' state=directory owner='{{mysql_hardening_user}}' group='{{mysql_hardening_group}}' mode=0570
1111

1212
- name: check include-dir directive is present in my.cnf
13-
lineinfile: dest='{{mysql_hardening_mysql_conf}}' line='!includedir /etc/mysql/conf.d/' insertafter='EOF' state=present backup=yes
13+
lineinfile: dest='{{mysql_hardening_mysql_conf_file}}' line='!includedir {{mysql_hardening_mysql_confd_dir}}' insertafter='EOF' state=present backup=yes
1414
notify: restart mysql
1515

1616
- name: apply hardening configuration
17-
template: src='hardening.cnf.j2' dest='{{mysql_hardening_hardening_conf}}' owner='{{mysql_hardening_user}}' group='{{mysql_hardening_group}}' mode=0460
17+
template: src='hardening.cnf.j2' dest='{{mysql_hardening_mysql_hardening_conf_file}}' owner='{{mysql_hardening_user}}' group='{{mysql_hardening_group}}' mode=0460
1818
notify: restart mysql

vars/Debian.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mysql_daemon: mysql
2-
mysql_hardening_mysql_conf: '/etc/mysql/my.cnf'
2+
mysql_hardening_mysql_conf_file: '/etc/mysql/my.cnf'
3+
mysql_hardening_mysql_confd_dir: '/etc/mysql/conf.d'

vars/Oracle Linux.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mysql_daemon: mysqld
2-
mysql_hardening_mysql_conf: '/etc/my.cnf'
2+
mysql_hardening_mysql_conf_file: '/etc/my.cnf'
3+
mysql_hardening_mysql_confd_dir: '/etc/my.cnf.d'

vars/RedHat.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mysql_daemon: mysqld
2-
mysql_hardening_mysql_conf: '/etc/my.cnf'
2+
mysql_hardening_mysql_conf_file: '/etc/my.cnf'
3+
mysql_hardening_mysql_confd_dir: '/etc/my.cnf.d'

0 commit comments

Comments
 (0)