Skip to content

Commit 52ff81b

Browse files
author
Ashley Penney
committed
Convert restrict to an array of restrictions.
Instead of a boolean with hardcoded values we now just convert restrict into an array of lines related to restrictions.
1 parent e3feec2 commit 52ff81b

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ group :development, :test do
77
gem 'puppet-lint', :require => false
88
gem 'serverspec', :require => false
99
gem 'rspec-system-serverspec', :require => false
10+
gem 'vagrant-wrapper', :require => false
1011
end
1112

1213
if puppetversion = ENV['PUPPET_GEM_VERSION']

manifests/init.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
validate_array($package_name)
3232
validate_bool($panic)
3333
validate_array($preferred_servers)
34-
validate_bool($restrict)
34+
validate_array($restrict)
3535
validate_array($servers)
3636
validate_bool($service_enable)
3737
validate_string($service_ensure)

manifests/params.pp

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
$keys_trusted = []
99
$package_ensure = 'present'
1010
$preferred_servers = []
11-
$restrict = true
11+
$restrict = [
12+
'restrict default kod nomodify notrap nopeer noquery',
13+
'restrict -6 default kod nomodify notrap nopeer noquery',
14+
'restrict 127.0.0.1',
15+
'restrict -6 ::1',
16+
]
1217
$service_enable = true
1318
$service_ensure = 'running'
1419
$service_manage = true

templates/ntp.conf.erb

+6-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
tinker panic 0
77
<% end -%>
88

9-
<% if @restrict -%>
10-
# Permit time synchronization with our time source, but do not
11-
# permit the source to query or modify the service on this system.
12-
restrict default kod nomodify notrap nopeer noquery
13-
restrict -6 default kod nomodify notrap nopeer noquery
14-
restrict 127.0.0.1
15-
restrict -6 ::1
9+
<% if @restrict != [] -%>
10+
# Permit time synchronization with our time source, but do not'
11+
# permit the source to query or modify the service on this system.'
12+
<% @restrict.flatten.each do |restrict| -%>
13+
<%= restrict %>
14+
<% end %>
1615
<% end -%>
1716

1817
# Servers

0 commit comments

Comments
 (0)