Skip to content

Commit 13835e1

Browse files
committed
Add restrict parameter
NTP servers should not restrict themselves to 127.0.0.1, and this commit adds a `restrict` parameter to enable/disable this configuration block in the relevent templates.
1 parent e6e8d9e commit 13835e1

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

manifests/init.pp

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
# '2.debian.pool.ntp.org iburst',
1919
# '3.debian.pool.ntp.org iburst', ]
2020
#
21+
# $restrict = true
22+
# Whether to restrict ntp daemons from allowing others to use as a server.
23+
#
24+
# $autoupdate = false
25+
# Whether to update the ntp package automatically or not.
26+
#
2127
# Actions:
2228
#
2329
# Installs, configures, and manages the ntp service.
@@ -34,6 +40,7 @@
3440
# [Remember: No empty lines between comments and class definition]
3541
class ntp($servers='UNSET',
3642
$ensure='running',
43+
$restrict=true,
3744
$autoupdate=false
3845
) {
3946

templates/ntp.conf.debian.erb

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ filegen clockstats file clockstats type day enable
3030
server <%= server %>
3131
<% end -%>
3232

33+
<% if @restrict -%>
3334
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
3435
# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
3536
# might also be helpful.
@@ -50,6 +51,7 @@ restrict ::1
5051
# cryptographically authenticated.
5152
#restrict 192.168.123.0 mask 255.255.255.0 notrust
5253

54+
<% end -%>
5355

5456
# If you want to provide time to your local subnet, change the next line.
5557
# (Again, the address is an example only.)

templates/ntp.conf.el.erb

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
tinker panic 0
55

66
<% end -%>
7+
<% if @restrict -%>
78
# Permit time synchronization with our time source, but do not
89
# permit the source to query or modify the service on this system.
910
restrict default kod nomodify notrap nopeer noquery
@@ -18,6 +19,7 @@ restrict -6 ::1
1819
# Hosts on local network are less restricted.
1920
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
2021

22+
<% end -%>
2123
# Use public servers from the pool.ntp.org project.
2224
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
2325

0 commit comments

Comments
 (0)