Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-118499

Please explain how to write a newline in a banner such as /etc/issue

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • scap-security-guide
    • None
    • No
    • Low
    • rhel-security-compliance
    • 5
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • Unspecified Release Note Type - Unknown
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      This was initially brought Upstream through Issue 13080 but nobody provided any tip after several months.

      This is related to xccdf_org.ssgproject.content_value_login_banner_text.

      Due to folding and formatting, spaces have to be specified in the banner as [\s\n]+ and this is totally understandable.
      However it's unclear how to specify newline: \n doesn't work in particular.

      There is a Jinja macro (shared/macros/10-bash.jinja) which replaces the escaped newline into a newline which uses a sed line:

      {{# Strips newline or newline escape sequence regex #}}
      {{% macro bash_deregexify_banner_newline(banner_var_name, newline) -%}}
      {{{ banner_var_name }}}=$(echo "${{{ banner_var_name }}}" | sed 's/(?:\[\\n\]+|(?:\\\\n)+)/{{{ newline }}}/g')
      {{%- endmacro %}}
      

      The above sed line doesn't work at all for multiple reasons, checking the GNU sed manual :

      • ?: operator is not a valid operator
      • the pipe used to or the pattern should be escaped (|)

      IMHO the following sed may be used instead: s/\\n|[\\n]/\n/g
      This would match using \n or [\n].

      Could you please explain what is expected from the user here?

              vpolasek@redhat.com Vojtech Polasek
              rhn-support-rmetrich Renaud Métrich
              Vojtech Polasek Vojtech Polasek
              SSG Security QE SSG Security QE
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated: