From b331c2f99c1217c6f4208159c64ca6a5b0053bc7 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sun, 22 May 2016 16:40:50 +0200 Subject: Tunnel internal NTP traffic through IPSec. More precisely, between our NTP-master (stratum 1) host and the other machines (all stratum 2). Providing authentification and integrity for internal NTP traffic ensures a consistent time within our internal infrastructure. --- production | 1 - roles/common/templates/etc/iptables/services.j2 | 5 ----- roles/common/templates/etc/ntp.conf.j2 | 6 +++--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/production b/production index 066e469..c6cb7a0 100644 --- a/production +++ b/production @@ -20,7 +20,6 @@ benjamin.skangas.se [LDAP-provider:children] mistral -# ntp.fripost.org [NTP-master:children] mistral diff --git a/roles/common/templates/etc/iptables/services.j2 b/roles/common/templates/etc/iptables/services.j2 index 6bd2533..8450f00 100644 --- a/roles/common/templates/etc/iptables/services.j2 +++ b/roles/common/templates/etc/iptables/services.j2 @@ -16,12 +16,7 @@ out tcp 9418 # GIT out udp 53 # DNS out udp 67 # DHCP out tcp 22 # SSH -{% if 'NTP-master' in group_names %} -in udp 123 # NTP -out udp 123 # NTP -{% else %} out udp 123 123 # NTP -{% endif %} in tcp {{ ansible_port|default('22') }} # SSH {% if 'LDAP-provider' in group_names %} diff --git a/roles/common/templates/etc/ntp.conf.j2 b/roles/common/templates/etc/ntp.conf.j2 index d46ba18..5957276 100644 --- a/roles/common/templates/etc/ntp.conf.j2 +++ b/roles/common/templates/etc/ntp.conf.j2 @@ -24,9 +24,9 @@ server ntp2.sth.netnod.se iburst {% else %} # Sychronize to our (stratum 2) NTP server, to ensure our network has a # consistent time. -# TODO: use to pubkey authentication to unsure an attacker doesn't -# impersonate our NTP server and gives us incorrect time. -server ntp.fripost.org iburst +{% for host in groups['NTP-master'] | sort %} +server {{ ipsec[ hostvars[host].inventory_hostname_short ] }} prefer iburst +{% endfor %} server 0.se.pool.ntp.org iburst server 1.se.pool.ntp.org iburst {% endif %} -- cgit v1.2.3