Skip to content
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

[Enhancement] [BugFix] Port selected audit DAC && time rules to RHEL-7 && Fedora systems #536

Merged
merged 27 commits into from
May 7, 2015

Conversation

iankko
Copy link

@iankko iankko commented Apr 29, 2015

This patchset ports the following audit DAC and time modification rules:

  • audit_rules_mac_modification,
  • audit_rules_networkconfig_modification,
  • audit_rules_time_watch_localtime,
  • audit_rules_time_clock_settime,
  • audit_rules_time_stime,
  • audit_rules_time_settimeofday, and
  • audit_rules_time_adjtimex

to RHEL-7 && Fedora operating systems.

Note: The audit_rules_usergroup_modification has been previously ported to RHEL-7 && Fedora by Shawn, so it was just enabled to be called by default in the common profile for both of the products.

Porting of each rule consists of two corresponding commits:

  • the first commit of the pair ports the underlying OVAL check to RHEL-7 && Fedora systems,
  • the second commit from the pair updates the XCCDF prose for that rule for both products to reflect the fact there are two locations (induced by use of augenrules vs auditctl tools to load audit rule entries into final /etc/audit/audit.rules file respectively).

Testing report:

Each of the committed changes (the OVAL check port, and also the XCCDF text / prose update) has been tested prior commit on Red Hat Enterprise Linux 7 and Fedora 20 x86_64 architecture based systems, and AFAICT both of the changes for each rule are fine (the OVAL check works for both auditctl && augenrules tools, subsequently the XCCDF prose update is shown in the guide built for that product).

Please review.

Thank you, Jan.

Jan Lieskovsky added 26 commits April 24, 2015 16:03
…&& Fedora

Testing report:
---------------
Verified manually on both products the proposed change works fine
…ification

rule to reflect the fact there are two locations where the settings can be applied

Testing report:
---------------
Have built the updated guide on both products manually && verified the prose
contains the expected form
…cation OVAL

check to RHEL-7 && Fedora

Testing report:
---------------
Verified manually on both products the OVAL check works fine for both (auditctl &&
augenrules) cases
…config_modification

rule to reflect the fact there are two possible locations where the settings can be applied

Testing report:
---------------
Have built the guide manually for both products && verified the updated prose
has expected form on both of them
check in the common profile for both products
… OVAL check

to RHEL-7 && Fedora

Testing report:
---------------
Verified manually on both products the proposed check works fine
* audit_rules_usergroup_modification, and
* audit_rules_time_watch_localtime

rules to reflect the fact there are two possible locations where
the setting can be applied.

Testing report:
---------------
Have built the guide manually on both products && verified the
updated prose has the expected form.
…VAL check

to RHEL-7 && Fedora

Testing report:
---------------
Verified manually the proposed checks works fine on both products (for both auditctl
&& augenrules cases)
…ock_settime

to reflect the fact there are two locations where the setting can be applied

Testing report:
---------------
Have built the guide for both products manually && verified the updated
prose has the expected form
to RHEL-7 && Fedora

Testing report:
---------------
Verified manually on both products (RHEL-7 && Fedora 20) the check works
fine
…&& Fedora

Testing report:
---------------
Verified manually on both products the proposed change works fine
…ification

rule to reflect the fact there are two locations where the settings can be applied

Testing report:
---------------
Have built the updated guide on both products manually && verified the prose
contains the expected form
…cation OVAL

check to RHEL-7 && Fedora

Testing report:
---------------
Verified manually on both products the OVAL check works fine for both (auditctl &&
augenrules) cases
…config_modification

rule to reflect the fact there are two possible locations where the settings can be applied

Testing report:
---------------
Have built the guide manually for both products && verified the updated prose
has expected form on both of them
check in the common profile for both products
… OVAL check

to RHEL-7 && Fedora

Testing report:
---------------
Verified manually on both products the proposed check works fine
* audit_rules_usergroup_modification, and
* audit_rules_time_watch_localtime

rules to reflect the fact there are two possible locations where
the setting can be applied.

Testing report:
---------------
Have built the guide manually on both products && verified the
updated prose has the expected form.
…VAL check

to RHEL-7 && Fedora

Testing report:
---------------
Verified manually the proposed checks works fine on both products (for both auditctl
&& augenrules cases)
…ock_settime

to reflect the fact there are two locations where the setting can be applied

Testing report:
---------------
Have built the guide for both products manually && verified the updated
prose has the expected form
to RHEL-7 && Fedora

Testing report:
---------------
Verified manually on both products (RHEL-7 && Fedora 20) the check works
fine
…e_stime

rule to reflect the fact there are two possible locations where the setting
can be applied

Testing report:
---------------
Have built the updated guide for both products manually && verified the
updated prose for the *_stime rule contains expected form for both products
OVAL check to RHEL-7 && Fedora

Testing report:
---------------
Verified manually on both products the ported check works as expected
…ttimeofday rule to:

* reflect the fact there are two possible locations, where the setting can be applied,
* correct the arch recommendation (current version recommends b32 rule form for 32-bit
  arch, and b64 rule form for 64-bit arch. But it should be b32 rule form for 32-bit
  arch, and *both* b32 and b64 rule forms for 64-bit arch, since according to ausyscall
  settimeofday() system call has different numbers on 32-bit vs 64-bit audit tables,
  therefore on a 64-bit system to track both 32-bit & 64-bit calls we need to write two
  rules).

Testing report:
---------------
Have built updated guides on both products && verified the *_settimeofday rule prose
contains the expected form
…heck

to RHEL-7 && Fedora

Testing report:
---------------
Verified manually on both products (RHEL-7 && Fedora 20) it works as expected
(see test_attestations)
…jtimex rule to:

* reflect the fact there are two possible locations where the setting can be applied,
* correct the recommendation for 64-bit architecture (on 64-bit system both b32 && b64
  form audit rule versions need to be present since adjtimex has different audit syscall
  table numbers for i386 and x86_64 architectures,
* drop couple of space characters at end of line in selected descriptions.
@iankko iankko added bugfix Fixes to reported bugs. enhancement General enhancements to the project. Fedora Fedora product related. RHEL Red Hat Enterprise Linux product related. labels Apr 29, 2015
@iankko iankko added this to the Draft RHEL 7 STIG milestone Apr 29, 2015
@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling ad97389 on iankko:even_more_rhel7_audit into eb7b3b8 on OpenSCAP:master.

satisfies common requirements.
The following example from Fedora Documentation available at
satisfies common requirements.
The following example from Fedora Documentation available at
<tt>http://docs.fedoraproject.org/en-US/Fedora/13/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Fixing_Problems-Raw_Audit_Messages.html</tt>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* ComplianceAsCode#536 (comment)
  (update raw audit messages explanation URL),
* ComplianceAsCode#536 (comment)
  (update audit_rules_time_stime rule's XCCDF prose to more explicitly reflect the
  "-F arch=b64" rule form is not required on 64 bit systems),
* perform couple of s/lines/line/ replacements
@iankko
Copy link
Author

iankko commented Apr 30, 2015

@shawndwells
Updated:

  • the "raw audit messages" URLs in both RHEL-7 & Fedora's auditing.xml (RHEL-7 one to point to URL you suggested, updated the Fedora one to point to Fedora 21's documentation),
  • audit_rules_time_stime XCCDF prose to more explicitly mention there isn't 64-bit version of the stime system call in the audit lookup table (both in RHEL-7 && Fedora's auditing.xml),
  • and replaced couple of lines occurrences with line (dropped the unnecessary comments part so people wouldn't by mistake include just the comment line and omit the actually required audit rule line, and kept only the true audit rule line part).

Feel free to re-review.

Thank you for catching those issues!

Jan

@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling ee269c1 on iankko:even_more_rhel7_audit into eb7b3b8 on OpenSCAP:master.

@iankko
Copy link
Author

iankko commented May 5, 2015

Kind bump for re-review -- anyone?

@redhatrises
Copy link
Contributor

@iankko I will take it.

@redhatrises redhatrises self-assigned this May 5, 2015
@redhatrises
Copy link
Contributor

@iankko looks like testcheck.py errors out on duplicate key sequences when trying to run the rules with <extend_definition comment="64-bit system" definition_ref="system_info_architecture_x86_64" negate="true" /> as it is listed twice. This maybe a separate PR, but it would be nice to get testcheck fixed asap so as not to confuse users using testcheck.py.

iankko pushed a commit to iankko/scap-security-guide that referenced this pull request May 6, 2015
…k.py script too

Don't include the underlying OVAL entity ID when creating final OVAL XML
check file via testcheck.py script in the case particular OVAL entity
(definition, object, state, or variable) with the same ID has been already
included in the check. This prevents creation of an invalid OVAL content file.

Fixes issue reported by Gabe Alford in: ComplianceAsCode#536 (comment)
@iankko
Copy link
Author

iankko commented May 6, 2015

@redhatrises

Thanks. I was able to reproduce the issue. The problem is the testcheck.py script when building the testing OVAL check doesn't perform the sanity check if the underlying OVAL entity with the same ID isn't included in the OVAL check already (like e.g. combinechecks.py script is doing), and instead of that blindly copies all OVAL entities from the extended_definition (even in case they have been included already). This obviously allows to create an invalid OVAL content.

I have fixed this issue by submitting a new PR:
    #547

Margin note: As mentioned e.g. in RHEL/7/input/checks/README sometimes it makes sense to duplicate OVAL object in OVAL definition. This PR is one of those cases -- the current layout of <criteria> across the commits in this PR is the straightforward approach:

  • we first check if augenrules or auditctl tools are used to load audit rules,
  • depending on that, then check if are on 32-bit system. If so, check just the 32-bit variants of the rules. If not (we are on 64-bit system), check also the 64-bit variants of the rules.

It's not possible to use just one occurrence of the system_info_architecture_x86_64 extend definition test, since it would require the logical operations between the different <criterion> elements to be yet more complex (not that straightforward) like they are now. Their reorganization might help testcheck.py not to require the fix in newly submitted PR, but on the other hand the OVAL checks would be less readable / understandable. So I preferred to fix testcheck.py (introduce the sanity check) rather than to modify the existing OVAL checks above.

The issue should be fixed now (under assumption change from #547 is applied together with the changes from this PR).

@redhatrises
Copy link
Contributor

Ack. Will merge this one after #547 is merged.

@redhatrises
Copy link
Contributor

#547 has been merged, so I am merging this one as well.

redhatrises added a commit that referenced this pull request May 7, 2015
[Enhancement] [BugFix] Port selected audit DAC && time rules to RHEL-7 && Fedora systems
@redhatrises redhatrises merged commit 8828a83 into ComplianceAsCode:master May 7, 2015
@iankko
Copy link
Author

iankko commented May 7, 2015

#547 has been merged, so I am merging this one as well.

Thank you.

@iankko iankko deleted the even_more_rhel7_audit branch May 7, 2015 13:00
@mpreisler mpreisler modified the milestone: Draft RHEL 7 STIG Jul 25, 2016
@marcusburghardt marcusburghardt added RHEL7 Red Hat Enterprise Linux 7 product related. STIG STIG Benchmark related. labels Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes to reported bugs. enhancement General enhancements to the project. Fedora Fedora product related. RHEL Red Hat Enterprise Linux product related. RHEL7 Red Hat Enterprise Linux 7 product related. STIG STIG Benchmark related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants