Sha256: 92e2abfbc03ed9d37b4c267465ce6cd92ab7b4a7cfa088a73be338c4f12b956a

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

---
title: About the ntp_conf Resource
---

# ntp_conf

Use the `ntp_conf` InSpec audit resource to test the synchronization settings defined in the `ntp.conf` file. This file is typically located at `/etc/ntp.conf`.


# Syntax

An `ntp_conf` resource block declares the synchronization settings that should be tested:

    describe ntp_conf('path') do
      its('setting_name') { should eq 'value' }
    end

where

* `'setting_name'` is a synchronization setting defined in the `ntp.conf` file
* `('path')` is the non-default path to the `ntp.conf` file
* `{ should eq 'value' }` is the value that is expected


# Matchers

This resource matches any service that is listed in the `ntp.conf` file:

    its('server') { should_not eq nil }

or:

    its('restrict') { should include '-4 default kod notrap nomodify nopeer noquery'}

For example:

    describe ntp_conf do
      its('server') { should_not eq nil }
      its('restrict') { should include '-4 default kod notrap nomodify nopeer noquery'}
    end


## be

<%= partial "/shared/matcher_be" %>

## cmp

<%= partial "/shared/matcher_cmp" %>

## eq

<%= partial "/shared/matcher_eq" %>

## include

<%= partial "/shared/matcher_include" %>

## match

<%= partial "/shared/matcher_match" %>

# Examples

The following examples show how to use this InSpec audit resource.

## Test for clock drift against named servers

    describe ntp_conf do
      its('driftfile') { should eq '/var/lib/ntp/ntp.drift' }
      its('server') { should eq [
        0.ubuntu.pool.ntp.org,
        1.ubuntu.pool.ntp.org,
        2.ubuntu.pool.ntp.org
      ] }
    end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inspec-1.0.0 docs/resources/ntp_conf.md.erb
inspec-1.0.0.beta3 docs/resources/ntp_conf.md.erb