<def-group>
    <definition class="compliance" id="{{{ rule_id }}}" version="1">
        {{{ oval_metadata("Configure the nts setting in /etc/ntp.conf or chrony.conf to use NTS on all time servers.", rule_title=rule_title) }}}
        <criteria>
            <criterion test_ref="test_chrony_all_server_has_nts"></criterion>
        </criteria>
    </definition>

    {{% set filepath_regex = "^(" + chrony_conf_path | replace(".", "\.") + "|" + chrony_d_path | replace(".", "\.") + ".+\.conf)$" %}}

    <ind:textfilecontent54_test check="all" check_existence="all_exist"
    comment="check if all server entries have nts set in {{{ chrony_conf_path }}} or {{{ chrony_d_path }}}"
    id="test_chrony_all_server_has_nts" version="1">
      <ind:object object_ref="obj_chrony_all_server_has_nts" />
      <ind:state state_ref="state_chrony_all_server_has_nts" />
    </ind:textfilecontent54_test>
    <ind:textfilecontent54_object id="obj_chrony_all_server_has_nts" version="1">
      <ind:filepath operation="pattern match">{{{ filepath_regex }}}</ind:filepath>
      <ind:pattern operation="pattern match">^(?:server|pool|peer)[\s]+[\S]+[\s]+(.*)</ind:pattern>
      <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
    </ind:textfilecontent54_object>

    <ind:textfilecontent54_state id="state_chrony_all_server_has_nts" version="1">
      <ind:subexpression operation="pattern match" datatype="string">nts</ind:subexpression>
    </ind:textfilecontent54_state>

</def-group>
