Skip to content

Commit 9fa496f

Browse files
authored
Merge pull request #119 from dev-sec/exec_shield
remove execshield sysctl-parameter on rhel7
2 parents 02a475a + 1303e0c commit 9fa496f

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ script:
5555
- 'docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-os-hardening/default.yml --skip-tags "sysctl"'
5656

5757
# Verify role
58-
- 'inspec exec https://github.com/dev-sec/linux-baseline/ -t docker://$(cat ${container_id}) --controls=os-01 os-02 os-03 os-04 os-05 os-06 os-07 package-01 package-02 package-03 package-04 package-05 package-06'
58+
- 'inspec exec https://github.com/dev-sec/linux-baseline/ -t docker://$(cat ${container_id}) --controls=os-01 os-02 os-03 os-04 os-05 os-06 os-07 os-09 os-10 package-01 package-02 package-03 package-04 package-05 package-06 package-09'
5959

6060
notifications:
6161
webhooks: https://galaxy.ansible.com/api/v1/notifications/

defaults/main.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ os_chfn_restrict: ''
2222
# may contain: change_user
2323
os_security_users_allow: []
2424
# specify system accounts those login should not be disabled and password not changed
25-
os_ignore_users: ['vagrant']
25+
os_ignore_users: ['vagrant', 'kitchen']
2626
os_security_kernel_enable_module_loading: true
2727
os_security_kernel_enable_core_dump: false
2828
os_security_suid_sgid_enforce: true
@@ -182,9 +182,3 @@ sysctl_config:
182182
# Do not delete the following line or otherwise the playbook will fail
183183
# at task 'create a combined sysctl-dict if overwrites are defined'
184184
sysctl_overwrite:
185-
186-
sysctl_rhel_config:
187-
# ExecShield protection against buffer overflows | sysctl-33
188-
kernel.exec-shield: 1
189-
# Syncookies is used to prevent SYN-flooding attacks. | sysctl-11
190-
net.ipv4.tcp_syncookies: 1

tasks/main.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
---
2-
- name: add the OS specific variables
2+
- name: Set OS family dependent variables
33
include_vars: '{{ ansible_os_family }}.yml'
44
tags: always
55

6+
- name: Set OS dependent variables
7+
include_vars: '{{ item }}'
8+
with_first_found:
9+
- files:
10+
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
11+
- '{{ ansible_distribution }}.yml'
12+
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml'
13+
skip: true
14+
tags: always
15+
616
- include: limits.yml
717
tags: limits
818

tasks/sysctl.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@
5151
ignoreerrors: yes
5252
with_dict: '{{ sysctl_config }}'
5353

54-
- name: Change various sysctl-settings on rhel-hosts, look at the sysctl-vars file for documentation
54+
- name: Change various sysctl-settings on rhel6-hosts or older, look at the sysctl-vars file for documentation
5555
sysctl:
5656
name: '{{ item.key }}'
5757
value: '{{ item.value }}'
5858
state: present
5959
reload: yes
6060
ignoreerrors: yes
6161
with_dict: '{{ sysctl_rhel_config }}'
62-
when: ansible_distribution == 'RedHat' or ansible_distribution == 'Fedora' or ansible_distribution == 'CentOS'
62+
when: (ansible_distribution == 'RedHat' or ansible_distribution == 'Fedora' or ansible_distribution == 'CentOS') and ansible_distribution_major_version < '7'
6363

6464
- name: Apply ufw defaults
6565
template:

vars/RedHat-6.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
sysctl_rhel_config:
3+
# ExecShield protection against buffer overflows
4+
kernel.exec-shield: 1
5+
# Syncookies is used to prevent SYN-flooding attacks.
6+
net.ipv4.tcp_syncookies: 1

0 commit comments

Comments
 (0)