<def-group>

  <definition class="compliance" id="{{{ rule_id }}}" version="1">
    {{{ oval_metadata("The gpgcheck option should be used to ensure that checking
      of an RPM package's signature always occurs prior to its
      installation.", rule_title=rule_title) }}}
    {{% if 'sle' in product or 'slmicro' in product %}} 
      <criteria operator="AND">
        <criterion comment="check value of gpgcheck in {{{ pkg_manager_config_file }}}" test_ref="test_ensure_gpgcheck_globally_activated" />
        <criterion comment="no value 0_off_no_false set in {{{ pkg_manager_config_file }}}" test_ref="test_ensure_gpgcheck_globally_no_deactivated" />
      </criteria> 
    {{% else %}}   
      <criteria >
        <criterion comment="check value of gpgcheck in {{{ pkg_manager_config_file }}}" test_ref="test_ensure_gpgcheck_globally_activated" />
      </criteria >  
    {{% endif %}}
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="check value of gpgcheck in {{{ pkg_manager_config_file }}}" id="test_ensure_gpgcheck_globally_activated" version="1">
    <ind:object object_ref="object_ensure_gpgcheck_globally_activated" />
  </ind:textfilecontent54_test>
  
  <ind:textfilecontent54_object id="object_ensure_gpgcheck_globally_activated" comment="gpgcheck set in {{{ pkg_manager_config_file }}}" version="1">
    <ind:filepath>{{{ pkg_manager_config_file }}}</ind:filepath>
    <ind:pattern operation="pattern match">^\s*gpgcheck\s*=\s*(1|True|yes)\s*$</ind:pattern>
    <ind:instance datatype="int" operation="equals">1</ind:instance>
  </ind:textfilecontent54_object>  

{{% if 'sle' in product or 'slmicro' in product %}}

  <ind:textfilecontent54_test check="all" check_existence="none_exist" comment="no value 0 set in {{{ pkg_manager_config_file }}}" id="test_ensure_gpgcheck_globally_no_deactivated" version="1">
    <ind:object object_ref="object_test_ensure_gpgcheck_globally_no_deactivated" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object id="object_test_ensure_gpgcheck_globally_no_deactivated" comment="0_off_no_false set in {{{ pkg_manager_config_file }}}" version="1">
    <ind:filepath>{{{ pkg_manager_config_file }}}</ind:filepath>
    <ind:pattern operation="pattern match">^\s*gpgcheck\s*=\s*(0|off|no|false)\s*$</ind:pattern>
    <ind:instance datatype="int" operation="equals">0</ind:instance>
  </ind:textfilecontent54_object>

{{% endif %}}  
</def-group>
