Fix bug in gdm banner deregexify #14092
Open
+5
−3
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:
(?:[\n]+|(?:\\n)+)newline pattern, resulting in the pattern never being replaced and the remediation failing.oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_stig --remediate ssg-ubuntu2204-ds.xmlresults in the following login banner on Ubuntu2204:You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions:(?:[n]+|(?:n)+)-The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations.(?:[n]+|(?:n)+)-At any time, the USG may inspect and seize data stored on this IS.(?:[n]+|(?:n)+)-Communications ...Rationale:
bash_deregexify_banner_newline(banner_var_name, newline)macro attempts to replace the(?:[\n]+|(?:\\n)+)pattern in the original regex string with the following command:sed 's/(?:\[\\n\]+|(?:\\n)+)/{{{ newline }}}/g').\\pattern to match a single backslash. The(?:\\n)portion of the sed commands fails to match the(?:\\n)portion of the original regex string because it fails to properly escape the two backslashes.(?:\\n)with(?:\\\\n), the updated command correctly matches the pattern and replaces the string.oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_stig --remediate ssg-ubuntu2204-ds.xmlnow produces the following compliant banner:You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions:\n-The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations.\n-At any time, the USG may inspect and seize data stored on this IS.\n-Communications ...