Puppet Class: profile::dumps::distribution::ferm

Defined in:
modules/profile/manifests/dumps/distribution/ferm.pp

Overview

Setup ferm rules for internal and external clients - By default the resolve() function in ferm performs only an IPv4/A DNS lookup. It fails if a host only has an IPv6 address. Ferm also provides a AAAA lookup mode for IPv6 addresses, but this equally fails if only an IPv4 address is present.

Parameters:

  • internal_rsync_clients (Any) (defaults to: hiera('profile::dumps::rsync_internal_clients'))
  • rsync_mirrors (Any) (defaults to: hiera('profile::dumps::distribution::mirrors'))


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
# File 'modules/profile/manifests/dumps/distribution/ferm.pp', line 6

class profile::dumps::distribution::ferm(
    $internal_rsync_clients = hiera('profile::dumps::rsync_internal_clients'),
    $rsync_mirrors = hiera('profile::dumps::distribution::mirrors'),
) {
    $internal_clients_ipv4 = $internal_rsync_clients['ipv4']
    $internal_clients_ipv6 = $internal_rsync_clients['ipv6']

    $active_mirrors = $rsync_mirrors.filter |$item| { $item['active'] == 'yes' }
    $ipv4_mirrors = $active_mirrors.reduce([]) |$mirrorlist, $item| { $mirrorlist + $item['ipv4'] }
    $ipv6_mirrors = $active_mirrors.reduce([]) |$mirrorlist, $item| { $mirrorlist + $item['ipv6'] }

    $rsync_clients_ipv4_ferm = join(flatten($internal_clients_ipv4 + $ipv4_mirrors), ' ')
    $rsync_clients_ipv6_ferm = join(flatten($internal_clients_ipv6 + $ipv6_mirrors), ' ')

    ferm::service {'dumps_rsyncd_ipv4':
        port   => '873',
        proto  => 'tcp',
        srange => "@resolve((${rsync_clients_ipv4_ferm}))",
    }

    ferm::service {'dumps_rsyncd_ipv6':
        port   => '873',
        proto  => 'tcp',
        srange => "@resolve((${rsync_clients_ipv6_ferm}),AAAA)",
    }
}