Puppet Class: ntp::packetfilter
- Inherits:
- ntp::params
- Defined in:
- manifests/packetfilter.pp
Overview
Class ntp::packetfilter
Configures packetfiltering rules for ntpd
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'manifests/packetfilter.pp', line 6
class ntp::packetfilter
(
$ensure,
String $allow_address_ipv4,
String $allow_address_ipv6
) inherits ntp::params
{
# IPv4 rules
# Set the allowable source address, unless 'any', in which case the 'source'
# parameter is left undefined.
$source_v4 = $allow_address_ipv4 ? {
'any' => undef,
default => $allow_address_ipv4,
}
$ensure_firewall = $ensure ? {
/(running|present)/ => 'present',
'absent' => 'absent',
}
@firewall { '008 ipv4 accept ntp':
ensure => $ensure_firewall,
provider => 'iptables',
chain => 'INPUT',
proto => 'udp',
source => $source_v4,
dport => 123,
action => 'accept',
tag => 'default',
}
# IPv6 rules
$source_v6 = $allow_address_ipv6 ? {
'any' => undef,
default => $allow_address_ipv6,
}
@firewall { '008 ipv6 accept ntp':
ensure => $ensure_firewall,
provider => 'ip6tables',
chain => 'INPUT',
proto => 'udp',
source => $source_v6,
dport => 123,
action => 'accept',
tag => 'default',
}
}
|