<def-group>
  <!-- THIS FILE IS GENERATED by RHEL/6/input/checks/templates/create_umask_checks.py.  DO NOT EDIT.  -->
  <!-- INSTEAD OF EDIT THAT TEMPLATE IF NECESSARY. AFTER THAT BE SURE TO REGENERATE ALL CORRESPONDING -->
  <!-- UNCOMMENTED CHECSK FROM file_umask_checks.csv CSV FILE -->
  <definition class="compliance" id="accounts_umask_etc_login_defs" version="1">
    <metadata>
      <title>Ensure that Users Have Sensible Umask Values in /etc/login.defs</title>
      <affected family="unix">
        <platform>multi_platform_rhel</platform>
      </affected>
      <description>The default umask for all users specified in /etc/login.defs</description>
      <reference source="JL" ref_id="RHEL6_20140912" ref_url="test_attestation"/>
      <reference source="JL" ref_id="RHEL7_20140912" ref_url="test_attestation"/>
    </metadata>
    <criteria>
      <criterion test_ref="tst_accounts_umask_etc_login_defs" />
    </criteria>
  </definition>

  <ind:textfilecontent54_object id="obj_umask_from_etc_login_defs" comment="Umask value from /etc/login.defs" version="1">
    <ind:filepath>/etc/login.defs</ind:filepath>
    <ind:pattern operation="pattern match">^[\s]*(?i)UMASK(?-i)[\s]+([^#\s]*)</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>

  <local_variable id="var_first_digit_of_umask_from_etc_login_defs" datatype="int" version="1" comment="First octal digit of umask from /etc/login.defs">
    <substring substring_start="1" substring_length="1">
      <object_component item_field="subexpression" object_ref="obj_umask_from_etc_login_defs" />
    </substring>
  </local_variable>

  <local_variable id="var_second_digit_of_umask_from_etc_login_defs" datatype="int" version="1" comment="Second octal digit of umask from /etc/login.defs">
    <substring substring_start="2" substring_length="1">
      <object_component item_field="subexpression" object_ref="obj_umask_from_etc_login_defs" />
    </substring>
  </local_variable>

  <local_variable id="var_third_digit_of_umask_from_etc_login_defs" datatype="int" version="1" comment="Third octal digit of umask from /etc/login.defs">
    <substring substring_start="3" substring_length="1">
      <object_component item_field="subexpression" object_ref="obj_umask_from_etc_login_defs" />
    </substring>
  </local_variable>

  <local_variable id="var_etc_login_defs_umask_as_number" datatype="int" version="1" comment="/etc/login.defs umask converted from string to a number">
    <arithmetic arithmetic_operation="add">
      <arithmetic arithmetic_operation="multiply">
        <literal_component datatype="int">64</literal_component>
        <variable_component var_ref="var_first_digit_of_umask_from_etc_login_defs" />
      </arithmetic>
      <arithmetic arithmetic_operation="multiply">
        <literal_component datatype="int">8</literal_component>
        <variable_component var_ref="var_second_digit_of_umask_from_etc_login_defs" />
      </arithmetic>
      <variable_component var_ref="var_third_digit_of_umask_from_etc_login_defs" />
    </arithmetic>
  </local_variable>

  <external_variable id="var_accounts_user_umask" datatype="string" version="1" comment="Expected umask" />

  <local_variable id="var_first_digit_of_umask_from_var_accounts_user_umask" datatype="int" version="1" comment="First octal digit of umask from var_accounts_user_umask">
    <substring substring_start="1" substring_length="1">
      <variable_component var_ref="var_accounts_user_umask" />
    </substring>
  </local_variable>

  <local_variable id="var_second_digit_of_umask_from_var_accounts_user_umask" datatype="int" version="1" comment="Second octal digit of umask from var_accounts_user_umask">
    <substring substring_start="2" substring_length="1">
      <variable_component var_ref="var_accounts_user_umask" />
    </substring>
  </local_variable>

  <local_variable id="var_third_digit_of_umask_from_var_accounts_user_umask" datatype="int" version="1" comment="Third octal digit of umask from var_accounts_user_umask">
    <substring substring_start="3" substring_length="1">
      <variable_component var_ref="var_accounts_user_umask" />
    </substring>
  </local_variable>

  <local_variable id="var_accounts_user_umask_umask_as_number" datatype="int" version="1" comment="var_accounts_user_umask umask converted from string to a number">
    <arithmetic arithmetic_operation="add">
      <arithmetic arithmetic_operation="multiply">
        <literal_component datatype="int">64</literal_component>
        <variable_component var_ref="var_first_digit_of_umask_from_var_accounts_user_umask" />
      </arithmetic>
      <arithmetic arithmetic_operation="multiply">
        <literal_component datatype="int">8</literal_component>
        <variable_component var_ref="var_second_digit_of_umask_from_var_accounts_user_umask" />
      </arithmetic>
      <variable_component var_ref="var_third_digit_of_umask_from_var_accounts_user_umask" />
    </arithmetic>
  </local_variable>

  <ind:variable_test id="tst_accounts_umask_etc_login_defs" version="1" check="all" comment="Test the retrieved /etc/login.defs umask value(s) match the var_accounts_user_umask requirement">
    <ind:object object_ref="obj_accounts_umask_etc_login_defs" />
    <ind:state state_ref="ste_accounts_umask_etc_login_defs" />
  </ind:variable_test>

  <ind:variable_object id="obj_accounts_umask_etc_login_defs" version="1">
    <ind:var_ref>var_etc_login_defs_umask_as_number</ind:var_ref>
  </ind:variable_object>

  <ind:variable_state id="ste_accounts_umask_etc_login_defs" version="1">
    <ind:value datatype="int" operation="bitwise and" var_ref="var_accounts_user_umask_umask_as_number" />
  </ind:variable_state>
</def-group>
