-
Notifications
You must be signed in to change notification settings - Fork 711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ubuntu 24.04 6.1.2.1.2 Ensure systemd-journal-upload authentication #12852
Conversation
Hi @ericeberry. Thanks for your PR. I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor changes
...ng/journald/systemd_journal_upload_server_tls/tests/journald-conf-servercert-missing.fail.sh
Outdated
Show resolved
Hide resolved
linux_os/guide/system/logging/journald/systemd_journal_upload_server_tls/oval/shared.xml
Show resolved
Hide resolved
5bed8f1
to
53a6846
Compare
This datastream diff is auto generated by the check Click here to see the full diffNew content has different text for rule 'xccdf_org.ssgproject.content_rule_systemd_journal_upload_server_tls'.
--- xccdf_org.ssgproject.content_rule_systemd_journal_upload_server_tls
+++ xccdf_org.ssgproject.content_rule_systemd_journal_upload_server_tls
@@ -1,6 +1,6 @@
[title]:
-Configure systemd-journal-upload TLS parameters: ServerKeyFile,ServerCertificateFile and TrustedCertificateFile
+Configure systemd-journal-upload TLS parameters: ServerKeyFile, ServerCertificateFile and TrustedCertificateFile
[description]:
SUSE Linux Enterprise Micro 5 must offload rsyslog messages for networked systems in real time and
OCIL for rule 'xccdf_org.ssgproject.content_rule_systemd_journal_upload_server_tls' differs.
--- ocil:ssg-systemd_journal_upload_server_tls_ocil:questionnaire:1
+++ ocil:ssg-systemd_journal_upload_server_tls_ocil:questionnaire:1
@@ -1,5 +1,5 @@
To ensure logs are sent securely to a remote host, examine the file
-/etc/systemd/journal-upload.conf.
+/etc/systemd/journal-upload.conf(.d/*.conf).
ServerKeyFile should be present:
ServerKeyFile=
ServerCertificateFile should be present:
bash 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
@@ -1,5 +1,8 @@
# Remediation is applicable only in certain platforms
if rpm --quiet -q kernel-default; then
+
+var_journal_upload_conf_file=/etc/systemd/journal-upload.conf
+
var_journal_upload_server_key_file=''
@@ -13,16 +16,16 @@
# If the key exists, change it. Otherwise, add it to the config_file.
# We search for the key string followed by a word boundary (matched by \>),
# so if we search for 'setting', 'setting2' won't match.
-if LC_ALL=C grep -q -m 1 -i -e "^ServerKeyFile\\>" "/etc/systemd/journal-upload.conf"; then
+if LC_ALL=C grep -q -m 1 -i -e "^ServerKeyFile\\>" "$var_journal_upload_conf_file"; then
escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output")
- LC_ALL=C sed -i --follow-symlinks "s/^ServerKeyFile\\>.*/$escaped_formatted_output/gi" "/etc/systemd/journal-upload.conf"
+ LC_ALL=C sed -i --follow-symlinks "s/^ServerKeyFile\\>.*/$escaped_formatted_output/gi" "$var_journal_upload_conf_file"
else
- if [[ -s "/etc/systemd/journal-upload.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/systemd/journal-upload.conf" || true)" ]]; then
- LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/systemd/journal-upload.conf"
+ if [[ -s "$var_journal_upload_conf_file" ]] && [[ -n "$(tail -c 1 -- "$var_journal_upload_conf_file" || true)" ]]; then
+ LC_ALL=C sed -i --follow-symlinks '$a'\\ "$var_journal_upload_conf_file"
fi
cce="CCE-94080-9"
- printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/systemd/journal-upload.conf" >> "/etc/systemd/journal-upload.conf"
- printf '%s\n' "$formatted_output" >> "/etc/systemd/journal-upload.conf"
+ printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$var_journal_upload_conf_file" >> "$var_journal_upload_conf_file"
+ printf '%s\n' "$formatted_output" >> "$var_journal_upload_conf_file"
fi
var_journal_upload_server_certificate_file=''
@@ -37,16 +40,16 @@
# If the key exists, change it. Otherwise, add it to the config_file.
# We search for the key string followed by a word boundary (matched by \>),
# so if we search for 'setting', 'setting2' won't match.
-if LC_ALL=C grep -q -m 1 -i -e "^ServerCertificateFile\\>" "/etc/systemd/journal-upload.conf"; then
+if LC_ALL=C grep -q -m 1 -i -e "^ServerCertificateFile\\>" "$var_journal_upload_conf_file"; then
escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output")
- LC_ALL=C sed -i --follow-symlinks "s/^ServerCertificateFile\\>.*/$escaped_formatted_output/gi" "/etc/systemd/journal-upload.conf"
+ LC_ALL=C sed -i --follow-symlinks "s/^ServerCertificateFile\\>.*/$escaped_formatted_output/gi" "$var_journal_upload_conf_file"
else
- if [[ -s "/etc/systemd/journal-upload.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/systemd/journal-upload.conf" || true)" ]]; then
- LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/systemd/journal-upload.conf"
+ if [[ -s "$var_journal_upload_conf_file" ]] && [[ -n "$(tail -c 1 -- "$var_journal_upload_conf_file" || true)" ]]; then
+ LC_ALL=C sed -i --follow-symlinks '$a'\\ "$var_journal_upload_conf_file"
fi
cce="CCE-94080-9"
- printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/systemd/journal-upload.conf" >> "/etc/systemd/journal-upload.conf"
- printf '%s\n' "$formatted_output" >> "/etc/systemd/journal-upload.conf"
+ printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$var_journal_upload_conf_file" >> "$var_journal_upload_conf_file"
+ printf '%s\n' "$formatted_output" >> "$var_journal_upload_conf_file"
fi
var_journal_upload_server_trusted_certificate_file=''
@@ -61,16 +64,16 @@
# If the key exists, change it. Otherwise, add it to the config_file.
# We search for the key string followed by a word boundary (matched by \>),
# so if we search for 'setting', 'setting2' won't match.
-if LC_ALL=C grep -q -m 1 -i -e "^TrustedCertificateFile\\>" "/etc/systemd/journal-upload.conf"; then
+if LC_ALL=C grep -q -m 1 -i -e "^TrustedCertificateFile\\>" "$var_journal_upload_conf_file"; then
escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output")
- LC_ALL=C sed -i --follow-symlinks "s/^TrustedCertificateFile\\>.*/$escaped_formatted_output/gi" "/etc/systemd/journal-upload.conf"
+ LC_ALL=C sed -i --follow-symlinks "s/^TrustedCertificateFile\\>.*/$escaped_formatted_output/gi" "$var_journal_upload_conf_file"
else
- if [[ -s "/etc/systemd/journal-upload.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/systemd/journal-upload.conf" || true)" ]]; then
- LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/systemd/journal-upload.conf"
+ if [[ -s "$var_journal_upload_conf_file" ]] && [[ -n "$(tail -c 1 -- "$var_journal_upload_conf_file" || true)" ]]; then
+ LC_ALL=C sed -i --follow-symlinks '$a'\\ "$var_journal_upload_conf_file"
fi
cce="CCE-94080-9"
- printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/systemd/journal-upload.conf" >> "/etc/systemd/journal-upload.conf"
- printf '%s\n' "$formatted_output" >> "/etc/systemd/journal-upload.conf"
+ printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$var_journal_upload_conf_file" >> "$var_journal_upload_conf_file"
+ printf '%s\n' "$formatted_output" >> "$var_journal_upload_conf_file"
fi
else
OCIL for rule 'xccdf_org.ssgproject.content_rule_systemd_journal_upload_url' differs.
--- ocil:ssg-systemd_journal_upload_url_ocil:questionnaire:1
+++ ocil:ssg-systemd_journal_upload_url_ocil:questionnaire:1
@@ -1,5 +1,5 @@
To ensure logs are sent to a remote host, examine the file
-/etc/systemd/journal-upload.conf.
+/etc/systemd/journal-upload.conf(.d/*.conf).
URL should be present:
URL=
Is it the case that systemd-journal-upload URL is missing or commented in /etc/systemd/journal-upload.conf?
bash remediation for rule 'xccdf_org.ssgproject.content_rule_systemd_journal_upload_url' differs.
--- xccdf_org.ssgproject.content_rule_systemd_journal_upload_url
+++ xccdf_org.ssgproject.content_rule_systemd_journal_upload_url
@@ -1,5 +1,8 @@
# Remediation is applicable only in certain platforms
if rpm --quiet -q kernel-default; then
+
+var_journal_upload_conf_file=/etc/systemd/journal-upload.conf
+
var_journal_upload_url=''
@@ -13,16 +16,16 @@
# If the key exists, change it. Otherwise, add it to the config_file.
# We search for the key string followed by a word boundary (matched by \>),
# so if we search for 'setting', 'setting2' won't match.
-if LC_ALL=C grep -q -m 1 -i -e "^URL\\>" "/etc/systemd/journal-upload.conf"; then
+if LC_ALL=C grep -q -m 1 -i -e "^URL\\>" "$var_journal_upload_conf_file"; then
escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output")
- LC_ALL=C sed -i --follow-symlinks "s/^URL\\>.*/$escaped_formatted_output/gi" "/etc/systemd/journal-upload.conf"
+ LC_ALL=C sed -i --follow-symlinks "s/^URL\\>.*/$escaped_formatted_output/gi" "$var_journal_upload_conf_file"
else
- if [[ -s "/etc/systemd/journal-upload.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/systemd/journal-upload.conf" || true)" ]]; then
- LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/systemd/journal-upload.conf"
+ if [[ -s "$var_journal_upload_conf_file" ]] && [[ -n "$(tail -c 1 -- "$var_journal_upload_conf_file" || true)" ]]; then
+ LC_ALL=C sed -i --follow-symlinks '$a'\\ "$var_journal_upload_conf_file"
fi
cce="CCE-94081-7"
- printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/systemd/journal-upload.conf" >> "/etc/systemd/journal-upload.conf"
- printf '%s\n' "$formatted_output" >> "/etc/systemd/journal-upload.conf"
+ printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$var_journal_upload_conf_file" >> "$var_journal_upload_conf_file"
+ printf '%s\n' "$formatted_output" >> "$var_journal_upload_conf_file"
fi
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes needed
linux_os/guide/system/logging/journald/systemd_journal_upload_server_tls/bash/shared.sh
Show resolved
Hide resolved
linux_os/guide/system/logging/journald/systemd_journal_upload_server_tls/rule.yml
Outdated
Show resolved
Hide resolved
linux_os/guide/system/logging/journald/systemd_journal_upload_server_tls/rule.yml
Outdated
Show resolved
Hide resolved
linux_os/guide/system/logging/journald/systemd_journal_upload_url/bash/shared.sh
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a conflict that needs solving, could you please rebase on top of current master?
bdffdd1
to
20825d0
Compare
Code Climate has analyzed commit 20825d0 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 61.9% (0.0% change). View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
Description:
Rationale: