Skip to content

Commit bb8e3e3

Browse files
add feature to disable coredump to limit task (#511)
Signed-off-by: Ludwig Bayerlein <[email protected]> Co-authored-by: Ludwig Bayerlein <[email protected]>
1 parent db78f61 commit bb8e3e3

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

roles/os_hardening/tasks/limits.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,38 @@
3434
path: /etc/security/limits.d/10.hardcore.conf
3535
state: absent
3636
when: os_security_kernel_enable_core_dump | bool
37+
38+
- block:
39+
- name: create coredump.conf.d-directory if it does not exist
40+
file:
41+
path: '/etc/systemd/coredump.conf.d'
42+
owner: root
43+
group: root
44+
mode: 0755
45+
state: directory
46+
47+
- name: create custom.conf for disabling coredumps
48+
template:
49+
src: 'etc/systemd/coredump.conf.d/coredumps.conf.j2'
50+
dest: '/etc/systemd/coredump.conf.d/custom.conf'
51+
owner: root
52+
group: root
53+
mode: 0644
54+
55+
- name: Reload daemon
56+
systemd:
57+
daemon_reload: yes
58+
59+
when: not os_security_kernel_enable_core_dump | bool
60+
61+
- block:
62+
- name: Remove coredump.conf.d directory with files
63+
file:
64+
path: /etc/systemd/coredump.conf.d
65+
state: absent
66+
67+
- name: Reload daemon
68+
systemd:
69+
daemon_reload: yes
70+
71+
when: os_security_kernel_enable_core_dump | bool
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Coredump]
2+
Storage=none

0 commit comments

Comments
 (0)