Align /var/log ownership rules with Ubuntu CIS#14443
Merged
Mab879 merged 2 commits intoComplianceAsCode:masterfrom Feb 27, 2026
Merged
Align /var/log ownership rules with Ubuntu CIS#14443Mab879 merged 2 commits intoComplianceAsCode:masterfrom
Mab879 merged 2 commits intoComplianceAsCode:masterfrom
Conversation
alanmcanonical
approved these changes
Feb 24, 2026
Mab879
reviewed
Feb 24, 2026
Member
Mab879
left a comment
There was a problem hiding this comment.
I only commented first two instances but normally in XML files use {{%. Please double check.
2055a30 to
79ebec2
Compare
The rule file_ownerships_var_log was fixed to allow log files to be owned by all system accounts (accounts without valid login shell).
The rule file_groupownerships_var_log was fixed to allow log files to be owned by all system accounts (accounts without valid login shell).
79ebec2 to
7d9f4fd
Compare
|
This datastream diff is auto generated by the check Click here to see the full diffbash remediation for rule 'xccdf_org.ssgproject.content_rule_systemd_journal_upload_server_tls' differs.
--- xccdf_org.ssgproject.content_rule_systemd_journal_upload_server_tls
+++ xccdf_org.ssgproject.content_rule_systemd_journal_upload_server_tls
@@ -28,19 +28,19 @@
fi
# find key in section and change value
- if grep -qzosP "(?m)^[[:space:]]*\[Upload\]([^\n\[]*\n+)+?[[:space:]]*ServerKeyFile" "$f"; then
- if ! grep -qzosP "(?m)^[[:space:]]*ServerKeyFile[[:space:]]*=[[:space:]]*$var_journal_upload_server_key_file" "$f"; then
+ if grep -qzosP "[[:space:]]*\[Upload\]([^\n\[]*\n+)+?[[:space:]]*ServerKeyFile" "$f"; then
+ if ! grep -qPz "ServerKeyFile=$var_journal_upload_server_key_file" "$f"; then
- sed -i "/^[[:space:]]*ServerKeyFile/s/\([[:blank:]]*=[[:blank:]]*\).*/\1$var_journal_upload_server_key_file/" "$f"
+ sed -i "s/ServerKeyFile[^(\n)]*/ServerKeyFile=$var_journal_upload_server_key_file/" "$f"
fi
found=true
# find section and add key = value to it
- elif grep -qs "^[[:space:]]*\[Upload\]" "$f"; then
+ elif grep -qs "[[:space:]]*\[Upload\]" "$f"; then
- sed -i "/^[[:space:]]*\[Upload\]/a ServerKeyFile=$var_journal_upload_server_key_file" "$f"
+ sed -i "/[[:space:]]*\[Upload\]/a ServerKeyFile=$var_journal_upload_server_key_file" "$f"
found=true
fi
@@ -63,19 +63,19 @@
fi
# find key in section and change value
- if grep -qzosP "(?m)^[[:space:]]*\[Upload\]([^\n\[]*\n+)+?[[:space:]]*ServerCertificateFile" "$f"; then
- if ! grep -qzosP "(?m)^[[:space:]]*ServerCertificateFile[[:space:]]*=[[:space:]]*$var_journal_upload_server_certificate_file" "$f"; then
+ if grep -qzosP "[[:space:]]*\[Upload\]([^\n\[]*\n+)+?[[:space:]]*ServerCertificateFile" "$f"; then
+ if ! grep -qPz "ServerCertificateFile=$var_journal_upload_server_certificate_file" "$f"; then
- sed -i "/^[[:space:]]*ServerCertificateFile/s/\([[:blank:]]*=[[:blank:]]*\).*/\1$var_journal_upload_server_certificate_file/" "$f"
+ sed -i "s/ServerCertificateFile[^(\n)]*/ServerCertificateFile=$var_journal_upload_server_certificate_file/" "$f"
fi
found=true
# find section and add key = value to it
- elif grep -qs "^[[:space:]]*\[Upload\]" "$f"; then
+ elif grep -qs "[[:space:]]*\[Upload\]" "$f"; then
- sed -i "/^[[:space:]]*\[Upload\]/a ServerCertificateFile=$var_journal_upload_server_certificate_file" "$f"
+ sed -i "/[[:space:]]*\[Upload\]/a ServerCertificateFile=$var_journal_upload_server_certificate_file" "$f"
found=true
fi
@@ -98,19 +98,19 @@
fi
# find key in section and change value
- if grep -qzosP "(?m)^[[:space:]]*\[Upload\]([^\n\[]*\n+)+?[[:space:]]*TrustedCertificateFile" "$f"; then
- if ! grep -qzosP "(?m)^[[:space:]]*TrustedCertificateFile[[:space:]]*=[[:space:]]*$var_journal_upload_server_trusted_certificate_file" "$f"; then
+ if grep -qzosP "[[:space:]]*\[Upload\]([^\n\[]*\n+)+?[[:space:]]*TrustedCertificateFile" "$f"; then
+ if ! grep -qPz "TrustedCertificateFile=$var_journal_upload_server_trusted_certificate_file" "$f"; then
- sed -i "/^[[:space:]]*TrustedCertificateFile/s/\([[:blank:]]*=[[:blank:]]*\).*/\1$var_journal_upload_server_trusted_certificate_file/" "$f"
+ sed -i "s/TrustedCertificateFile[^(\n)]*/TrustedCertificateFile=$var_journal_upload_server_trusted_certificate_file/" "$f"
fi
found=true
# find section and add key = value to it
- elif grep -qs "^[[:space:]]*\[Upload\]" "$f"; then
+ elif grep -qs "[[:space:]]*\[Upload\]" "$f"; then
- sed -i "/^[[:space:]]*\[Upload\]/a TrustedCertificateFile=$var_journal_upload_server_trusted_certificate_file" "$f"
+ sed -i "/[[:space:]]*\[Upload\]/a TrustedCertificateFile=$var_journal_upload_server_trusted_certificate_file" "$f"
found=true
fi
bash remediation for rule 'xccdf_org.ssgproject.content_rule_coredump_disable_backtraces' differs.
--- xccdf_org.ssgproject.content_rule_coredump_disable_backtraces
+++ xccdf_org.ssgproject.content_rule_coredump_disable_backtraces
@@ -10,19 +10,19 @@
fi
# find key in section and change value
- if grep -qzosP "(?m)^[[:space:]]*\[Coredump\]([^\n\[]*\n+)+?[[:space:]]*ProcessSizeMax" "$f"; then
- if ! grep -qzosP "(?m)^[[:space:]]*ProcessSizeMax[[:space:]]*=[[:space:]]*0" "$f"; then
+ if grep -qzosP "[[:space:]]*\[Coredump\]([^\n\[]*\n+)+?[[:space:]]*ProcessSizeMax" "$f"; then
+ if ! grep -qPz "ProcessSizeMax=0" "$f"; then
- sed -i "/^[[:space:]]*ProcessSizeMax/s/\([[:blank:]]*=[[:blank:]]*\).*/\10/" "$f"
+ sed -i "s/ProcessSizeMax[^(\n)]*/ProcessSizeMax=0/" "$f"
fi
found=true
# find section and add key = value to it
- elif grep -qs "^[[:space:]]*\[Coredump\]" "$f"; then
+ elif grep -qs "[[:space:]]*\[Coredump\]" "$f"; then
- sed -i "/^[[:space:]]*\[Coredump\]/a ProcessSizeMax=0" "$f"
+ sed -i "/[[:space:]]*\[Coredump\]/a ProcessSizeMax=0" "$f"
found=true
fi
bash remediation for rule 'xccdf_org.ssgproject.content_rule_coredump_disable_storage' differs.
--- xccdf_org.ssgproject.content_rule_coredump_disable_storage
+++ xccdf_org.ssgproject.content_rule_coredump_disable_storage
@@ -10,19 +10,19 @@
fi
# find key in section and change value
- if grep -qzosP "(?m)^[[:space:]]*\[Coredump\]([^\n\[]*\n+)+?[[:space:]]*Storage" "$f"; then
- if ! grep -qzosP "(?m)^[[:space:]]*Storage[[:space:]]*=[[:space:]]*none" "$f"; then
+ if grep -qzosP "[[:space:]]*\[Coredump\]([^\n\[]*\n+)+?[[:space:]]*Storage" "$f"; then
+ if ! grep -qPz "Storage=none" "$f"; then
- sed -i "/^[[:space:]]*Storage/s/\([[:blank:]]*=[[:blank:]]*\).*/\1none/" "$f"
+ sed -i "s/Storage[^(\n)]*/Storage=none/" "$f"
fi
found=true
# find section and add key = value to it
- elif grep -qs "^[[:space:]]*\[Coredump\]" "$f"; then
+ elif grep -qs "[[:space:]]*\[Coredump\]" "$f"; then
- sed -i "/^[[:space:]]*\[Coredump\]/a Storage=none" "$f"
+ sed -i "/[[:space:]]*\[Coredump\]/a Storage=none" "$f"
found=true
fi |
Contributor
Author
|
@Mab879 can you have a look? |
Mab879
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Rules
file_ownerships_var_logandfile_groupownerships_var_logwere fixedto allow log files to be owned by all system accounts (accounts without valid login shell).
Rationale:
The change aligns the rules with: