<def-group>
  <definition class="compliance" id="audit_rules_usergroup_modification" version="1">
    <metadata>
      <title>Audit User/Group Modification</title>
      <affected family="unix">
        <platform>Red Hat Enterprise Linux 7</platform>
        <platform>multi_platform_fedora</platform>
      </affected>
      <description>Audit user/group modification.</description>
      <reference source="sdw" ref_id="RHEL7_20150407" ref_url="test_attestation" />
      <reference source="sdw" ref_id="FEDORA20_20150407" ref_url="test_attestation" />
    </metadata>
    <criteria operator="OR">
      <criteria operator="AND">
        <criterion comment="audit augenrules" test_ref="test_audit_rules_usergroup_modification_augenrules" />
	<criterion comment="audit /etc/group" test_ref="test_audit_rules_usergroup_modification_etc_group_augen" />
	<criterion comment="audit /etc/passwd" test_ref="test_audit_rules_usergroup_modification_etc_passwd_augen" />
	<criterion comment="audit /etc/gshadow" test_ref="test_audit_rules_usergroup_modification_etc_gshadow_augen" />
	<criterion comment="audit /etc/shadow" test_ref="test_audit_rules_usergroup_modification_etc_shadow_augen" />
	<criterion comment="audit /etc/security/opasswd" test_ref="test_audit_rules_usergroup_modification_etc_security_opasswd_augen" />
      </criteria>
      <criteria operator="AND">
        <criterion comment="audit auditctl" test_ref="test_audit_rules_usergroup_modification_auditctl" />
        <criterion comment="audit /etc/group" test_ref="test_audit_rules_usergroup_modification_etc_group_auditctl" />
        <criterion comment="audit /etc/passwd" test_ref="test_audit_rules_usergroup_modification_etc_passwd_auditctl" />
        <criterion comment="audit /etc/gshadow" test_ref="test_audit_rules_usergroup_modification_etc_gshadow_auditctl" />
        <criterion comment="audit /etc/shadow" test_ref="test_audit_rules_usergroup_modification_etc_shadow_auditctl" />
        <criterion comment="audit /etc/security/opasswd" test_ref="test_audit_rules_usergroup_modification_etc_security_opasswd_auditctl" />
      </criteria>
    </criteria>
  </definition>

  <!-- Test the augenrules case -->
  <ind:textfilecontent54_test check="all" comment="audit augenrules" id="test_audit_rules_usergroup_modification_augenrules" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_augenrules" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_augenrules" version="1">
    <ind:filepath>/usr/lib/systemd/system/auditd.service</ind:filepath>
    <ind:pattern operation="pattern match">^ExecStartPost=\-\/sbin\/augenrules.*$</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" comment="audit augenrules /etc/group" id="test_audit_rules_usergroup_modification_etc_group_augen" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_etc_group_augen" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_etc_group_augen" version="1">
    <ind:filepath operation="pattern match">/etc/audit/rules\.d/.*\.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/etc/group[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b[\s+]\-k[\s]+\w+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" comment="audit augenrules /etc/passwd" id="test_audit_rules_usergroup_modification_etc_passwd_augen" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_etc_passwd_augen" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_etc_passwd_augen" version="1">
    <ind:filepath operation="pattern match">/etc/audit/rules\.d/.*\.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/etc/passwd[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b[\s]+\-k[\s]+\w+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" comment="audit augenrules /etc/gshadow" id="test_audit_rules_usergroup_modification_etc_gshadow_augen" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_etc_gshadow_augen" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_etc_gshadow_augen" version="1">
    <ind:filepath operation="pattern match">/etc/audit/rules\.d/.*\.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/etc/gshadow[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b[\s]+\-k[\s]+\w+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" comment="audit augenrules /etc/shadow" id="test_audit_rules_usergroup_modification_etc_shadow_augen" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_etc_shadow_augen" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_etc_shadow_augen" version="1">
    <ind:filepath operation="pattern match">/etc/audit/rules\.d/.*\.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/etc/shadow[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b[\s]+\-k[\s]+\w+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" comment="audit augenrules /etc/security/opasswd" id="test_audit_rules_usergroup_modification_etc_security_opasswd_augen" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_etc_security_opasswd_augen" />
  </ind:textfilecontent54_test>  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_etc_security_opasswd_augen" version="1">
    <ind:filepath operation="pattern match">/etc/audit/rules\.d/.*\.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/etc/security/opasswd[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b[\s]+\-k[\s]+\w+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <!-- Test the auditctl case -->
  <ind:textfilecontent54_test check="all" comment="audit auditctl" id="test_audit_rules_usergroup_modification_auditctl" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_auditctl" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_auditctl" version="1">
    <ind:filepath>/usr/lib/systemd/system/auditd.service</ind:filepath>
    <ind:pattern operation="pattern match">^ExecStartPost=\-\/sbin\/auditctl.*$</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" comment="audit /etc/group" id="test_audit_rules_usergroup_modification_etc_group_auditctl" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_etc_group_auditctl" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_etc_group_auditctl" version="1">
    <ind:filepath>/etc/audit/audit.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/etc/group[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b[\s+]\-k[\s]+\w+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" comment="audit /etc/passwd" id="test_audit_rules_usergroup_modification_etc_passwd_auditctl" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_etc_passwd_auditctl" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_etc_passwd_auditctl" version="1">
    <ind:filepath>/etc/audit/audit.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/etc/passwd[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b[\s]+\-k[\s]+\w+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" comment="audit /etc/gshadow" id="test_audit_rules_usergroup_modification_etc_gshadow_auditctl" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_etc_gshadow_auditctl" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_etc_gshadow_auditctl" version="1">
    <ind:filepath>/etc/audit/audit.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/etc/gshadow[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b[\s]+\-k[\s]+\w+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" comment="audit /etc/shadow" id="test_audit_rules_usergroup_modification_etc_shadow_auditctl" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_etc_shadow_auditctl" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_etc_shadow_auditctl" version="1">
    <ind:filepath>/etc/audit/audit.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/etc/shadow[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b[\s]+\-k[\s]+\w+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" comment="audit /etc/security/opasswd" id="test_audit_rules_usergroup_modification_etc_security_opasswd_auditctl" version="1">
    <ind:object object_ref="object_audit_rules_usergroup_modification_etc_security_opasswd_auditctl" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_usergroup_modification_etc_security_opasswd_auditctl" version="1">
    <ind:filepath>/etc/audit/audit.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/etc/security/opasswd[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b[\s]+\-k[\s]+\w+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

</def-group>
