Skip to content

Commit f878fa0

Browse files
committed
Merge pull request redhat-openstack#238 from ccin2p3/broadcast_and_auth
Broadcast and auth
2 parents 05b6a27 + ab5804c commit f878fa0

5 files changed

Lines changed: 70 additions & 0 deletions

File tree

README.markdown

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ The following parameters are available in the `::ntp` class:
135135

136136
**Deprecated; replaced by the `package_ensure` parameter**. Tells Puppet whether to keep the ntp module updated to the latest version available. Valid options: 'true' or 'false'. Default value: 'false'
137137

138+
####`broadcastclient`
139+
140+
Enable reception of broadcast server messages to any local interface.
141+
138142
####`config`
139143

140144
Specifies a file for ntp's configuration info. Valid options: string containing an absolute path. Default value: '/etc/ntp.conf' (or '/etc/inet/ntp.conf' on Solaris)
@@ -143,6 +147,11 @@ Specifies a file for ntp's configuration info. Valid options: string containing
143147

144148
Specifies a file to act as a template for the config file. Valid options: string containing a path (absolute, or relative to the module path). Default value: 'ntp/ntp.conf.erb'
145149

150+
####`disable_auth`
151+
152+
Do not require cryptographic authentication for broadcast client, multicast
153+
client and symmetric passive associations.
154+
146155
####`disable_monitor`
147156

148157
Tells Puppet whether to refrain from monitoring the NTP service. Valid options: 'true' or 'false'. Default value: 'false'

manifests/init.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
class ntp (
22
$autoupdate = $ntp::params::autoupdate,
3+
$broadcastclient = $ntp::params::broadcastclient,
34
$config = $ntp::params::config,
45
$config_template = $ntp::params::config_template,
6+
$disable_auth = $ntp::params::disable_auth,
57
$disable_monitor = $ntp::params::disable_monitor,
68
$driftfile = $ntp::params::driftfile,
79
$logfile = $ntp::params::logfile,
@@ -26,8 +28,10 @@
2628
$udlc = $ntp::params::udlc
2729
) inherits ntp::params {
2830

31+
validate_bool($broadcastclient)
2932
validate_absolute_path($config)
3033
validate_string($config_template)
34+
validate_bool($disable_auth)
3135
validate_bool($disable_monitor)
3236
validate_absolute_path($driftfile)
3337
if $logfile { validate_absolute_path($logfile) }

manifests/params.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
$service_manage = true
1616
$udlc = false
1717
$interfaces = []
18+
$disable_auth = false
19+
$broadcastclient = false
1820

1921
# On virtual machines allow large clock skews.
2022
$panic = str2bool($::is_virtual) ? {

spec/classes/ntp_spec.rb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,54 @@
126126
}
127127
end
128128
end
129+
describe 'with parameter disable_auth' do
130+
context 'when set to true' do
131+
let(:params) {{
132+
:disable_auth => true,
133+
}}
134+
135+
it 'should contain disable auth setting' do
136+
should contain_file('/etc/ntp.conf').with({
137+
'content' => /^disable auth\n/,
138+
})
139+
end
140+
end
141+
context 'when set to false' do
142+
let(:params) {{
143+
:disable_auth => false,
144+
}}
145+
146+
it 'should not contain disable auth setting' do
147+
should_not contain_file('/etc/ntp.conf').with({
148+
'content' => /^disable auth\n/,
149+
})
150+
end
151+
end
152+
end
153+
describe 'with parameter broadcastclient' do
154+
context 'when set to true' do
155+
let(:params) {{
156+
:broadcastclient => true,
157+
}}
158+
159+
it 'should contain broadcastclient setting' do
160+
should contain_file('/etc/ntp.conf').with({
161+
'content' => /^broadcastclient\n/,
162+
})
163+
end
164+
end
165+
context 'when set to false' do
166+
let(:params) {{
167+
:broadcastclient => false,
168+
}}
169+
170+
it 'should not contain broadcastclient setting' do
171+
should_not contain_file('/etc/ntp.conf').with({
172+
'content' => /^broadcastclient\n/,
173+
})
174+
end
175+
end
176+
end
129177

130178
describe "ntp::install on #{system}" do
131179
let(:params) {{ :package_ensure => 'present', :package_name => ['ntp'], :package_manage => true, }}

templates/ntp.conf.erb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ tinker panic 0
99
<% if @disable_monitor == true -%>
1010
disable monitor
1111
<% end -%>
12+
<% if @disable_auth == true -%>
13+
disable auth
14+
<% end -%>
1215

1316
<% if @restrict != [] -%>
1417
# Permit time synchronization with our time source, but do not
@@ -27,6 +30,10 @@ interface listen <%= interface %>
2730
<% end -%>
2831
<% end -%>
2932

33+
<% if @broadcastclient == true -%>
34+
broadcastclient
35+
<% end -%>
36+
3037
<% [@servers].flatten.each do |server| -%>
3138
server <%= server %><% if @iburst_enable == true -%> iburst<% end %><% if @preferred_servers.include?(server) -%> prefer<% end %>
3239
<% end -%>

0 commit comments

Comments
 (0)