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

RFE: harden auditctl when it complains about "There was an error in line X of /etc/audit/audit.rules" causing no rule to be loaded

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • rhel-9.6
    • rhel-7.9.z, rhel-8.8.0.z, rhel-9.2.0.z
    • audit
    • None
    • None
    • Moderate
    • 1
    • rhel-sst-security-special-projects
    • ssg_security
    • None
    • False
    • Hide

      None

      Show
      None
    • No
    • SECENGSP Cycle 12
    • Pass
    • None
    • Unspecified Release Note Type - Unknown
    • All
    • None

      1.  
      2. What were you trying to do that didn't work?

      Starting the service shows no rule is loaded and no error is seen in the journal for auditd.service unit.

      However, searching for auditctl errors in the journal, we can see the following message:

      [...] auditctl[2083]: There was an error in line 2 of /etc/audit/audit.rules

      The file content looks correct:

      # head -2 /etc/audit/audit.rules
      ## This file is automatically generated from /etc/audit/rules.d
      -D
      

      But in fact it's not because the file (and corresponding snippet in /etc/audit/rules.d/*.rules) is in DOS mode, causing the issue:

      # head -2 /etc/audit/audit.rules | hexdump -C
      [...]
      00000040  2d 44 0d 0a                                       |-D..|
      00000044        ^^^^^
                      DOS LINEFEED
      

      Please consider hardening auditctl to support DOS files. 

      Please provide the package NVR for which bug is seen:

      audit

      How reproducible:

      Always

      Steps to reproduce

      1. Convert /etc/audit/rules.d/audit.rules to DOS

       

      # vim /etc/audit/rules.d/audit.rules
      :set ff=dos
      :wq
      
      1. Restart the audit service

      Expected results

      Rules loaded or auditd.service failing

      Actual results

      No rule loaded

              rh-ee-alakatos Attila Lakatos
              rhn-support-rmetrich Renaud Métrich
              Sergio Correia Sergio Correia
              SSG Security QE SSG Security QE
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: