Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert restrict to an array of restrictions. #87

Merged
merged 1 commit into from Aug 8, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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