content
content copied to clipboard
You can't use `sed -i` on /etc/sysctl.d/*.conf
https://github.com/ComplianceAsCode/content/blob/59013f66872e02613ba822587d7c5d57ba92cd9e/linux_os/guide/system/permissions/restrictions/sysctl_kernel_core_pattern_empty_string/bash/shared.sh#L15
This clobbers the symlink and ruins everything!
The whole thing is a mess. You use grep to find a pattern, then see if it was found, and then a while read loop to read it back in, just to have sed add a hash mark. sed can search for things too. the whole thing probably equivalent to sed 's/^\s*kernel\.core_pattern.*/# &/' "$f" but add a --follow-symlinks in there I guess.
@neutronscott would you like to propose a PR to improve this? I would be happy to review it.
I can try that. I was at work and unable to. Also, sorry about the tone, work is like that sometimes.