Skip to content

Commit

Permalink
Merge pull request #87 from apenney/restrict
Browse files Browse the repository at this point in the history
Convert restrict to an array of restrictions.
  • Loading branch information
Ashley Penney committed Aug 8, 2013
2 parents e3feec2 + 52ff81b commit 042fa75
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -7,6 +7,7 @@ group :development, :test do
gem 'puppet-lint', :require => false
gem 'serverspec', :require => false
gem 'rspec-system-serverspec', :require => false
gem 'vagrant-wrapper', :require => false
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Expand Up @@ -31,7 +31,7 @@
validate_array($package_name)
validate_bool($panic)
validate_array($preferred_servers)
validate_bool($restrict)
validate_array($restrict)
validate_array($servers)
validate_bool($service_enable)
validate_string($service_ensure)
Expand Down
7 changes: 6 additions & 1 deletion manifests/params.pp
Expand Up @@ -8,7 +8,12 @@
$keys_trusted = []
$package_ensure = 'present'
$preferred_servers = []
$restrict = true
$restrict = [
'restrict default kod nomodify notrap nopeer noquery',
'restrict -6 default kod nomodify notrap nopeer noquery',
'restrict 127.0.0.1',
'restrict -6 ::1',
]
$service_enable = true
$service_ensure = 'running'
$service_manage = true
Expand Down
13 changes: 6 additions & 7 deletions templates/ntp.conf.erb
Expand Up @@ -6,13 +6,12 @@
tinker panic 0
<% end -%>
<% if @restrict -%>
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
<% if @restrict != [] -%>
# Permit time synchronization with our time source, but do not'
# permit the source to query or modify the service on this system.'
<% @restrict.flatten.each do |restrict| -%>
<%= restrict %>
<% end %>
<% end -%>

# Servers
Expand Down

0 comments on commit 042fa75

Please sign in to comment.