1.5.10 Ensure systemd-coredump Storage is configured

Information

A core dump is the memory of an executable program. It is generally used to determine why a program aborted. It can also be used to glean confidential information from a core file.

A core dump includes a memory image taken at the time the operating system terminates an application. The memory image could contain sensitive data and is generally useful only for developers trying to debug problems.

Solution

- Review all files ending inconf in the /etc/systemd/coredump.conf.d/ directory and comment out or remove all Storage= lines in the [Coredump] block that are not Storage=none

Example script:

#!/usr/bin/env bash

{
l_block="Coredump" l_option="Storage" l_value="none"
while IFS= read -r -d $'\0' l_file; do
awk '/\['"$l_block"'\]/{a=1;next}/\[/{a=0}a' "$l_file" 2>/dev/null | \
grep -Poi '\h*'"$l_option"'\h*=\h*\H+\b' | \
grep -Pivq '^\h*'"$l_option"'\h*=\h*'"$l_value"'\b' && \
sed -ri '/^\s*[Ss]torage\s*=/s/^/# /' "$l_file"
done < <(find /etc/systemd/coredump.conf.d/ -type f -name '*.conf' -print0)
} <xhtml:ol start="2"> - Create or edit a file in the /etc/systemd/coredump.conf.d directory ending inconf and edit or add the following line to the [Coredump] section:

Storage=none

Example:

#!/usr/bin/env bash

{
[ ! -d /etc/systemd/coredump.conf.d/ ] && mkdir /etc/systemd/coredump.conf.d/
l_file="/etc/systemd/coredump.conf.d/60-coredump.conf"
if grep -Psq -- '^\h*\[Coredump\]' "$l_file"; then
sed -ri '/^\s*\[Coredump\]/a Storage=none' "$l_file"
else
printf '%s\n' "" "[Coredump]" "Storage=none" >> "$l_file"
fi
} <xhtml:ol start="3"> - Run the following command to load the updated configuration:

# systemctl reload-or-restart systemd-coredump.socket

See Also

https://workbench.cisecurity.org/benchmarks/23597

Item Details

Category: CONFIGURATION MANAGEMENT

References: 800-53|CM-7b.

Plugin: Unix

Control ID: 167de6174407e34013003f5bf1810b99c33f6ae2e9c83868b618496e2942e973