From 9cf6dfd4922c1ea3407a871987c8ba60f173de0e Mon Sep 17 00:00:00 2001 From: Gabriel Becker Date: Fri, 17 Jan 2025 12:05:45 +0100 Subject: [PATCH] Add a script to ensure coredump configuration file exists. In RHEL10, the /etc/systemd/coredump.conf file does not exist by default and it needs to be created properly with the [Coredump] section in order for the test scenarios to work as expected. --- .../coredumps/coredump_disable_backtraces/tests/common.sh | 7 +++++++ .../tests/coredumps_processsizemax_0.pass.sh | 2 ++ .../tests/coredumps_processsizemax_default.fail.sh | 2 ++ .../tests/coredumps_processsizemax_nonzero.fail.sh | 2 ++ 4 files changed, 13 insertions(+) create mode 100644 linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/common.sh diff --git a/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/common.sh b/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/common.sh new file mode 100644 index 00000000000..e4365c1ea55 --- /dev/null +++ b/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/common.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +COREDUMP_PATH=/etc/systemd/coredump.conf + +if [ ! -f $COREDUMP_PATH ]; then + echo "[Coredump]" >> $COREDUMP_PATH +fi diff --git a/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_0.pass.sh b/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_0.pass.sh index 128c504be03..4e6e47b41ec 100644 --- a/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_0.pass.sh +++ b/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_0.pass.sh @@ -1,3 +1,5 @@ #!/bin/bash +source common.sh + echo ProcessSizeMax=0 >> /etc/systemd/coredump.conf diff --git a/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_default.fail.sh b/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_default.fail.sh index a9bf588e2f8..995227f244c 100644 --- a/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_default.fail.sh +++ b/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_default.fail.sh @@ -1 +1,3 @@ #!/bin/bash + +source common.sh diff --git a/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_nonzero.fail.sh b/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_nonzero.fail.sh index b58fb2b534a..e219b7d4477 100644 --- a/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_nonzero.fail.sh +++ b/linux_os/guide/system/permissions/restrictions/coredumps/coredump_disable_backtraces/tests/coredumps_processsizemax_nonzero.fail.sh @@ -1,3 +1,5 @@ #!/bin/bash +source common.sh + echo ProcessSizeMax=2G >> /etc/systemd/coredump.conf