aboutsummaryrefslogtreecommitdiffstats
path: root/modules/opendkim/manifests/init.pp
blob: 6e45345a683bf105c1c3993114f102abcce8dc5a (plain)
1
2
3
4
5
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# == Class: opendkim
#
# === Examples
#
#  class { 'opendkim':}
#
# === Authors
#
# Vladimir Bykanov <vladimir@bykanov.ru>
#
# === Copyright
#
# Copyright 2015 Vladimir Bykanov
#
class opendkim (
    $autorestart          = 'Yes',
    $autorestart_rate     = '10/1h',
    $log_why              = 'Yes',
    $syslog               = 'Yes',
    $syslog_success       = 'Yes',
    $mode                 = 's',
    $canonicalization     = 'relaxed/simple',
    $external_ignore_list = 'refile:/etc/opendkim/TrustedHosts',
    $internal_hosts       = 'refile:/etc/opendkim/TrustedHosts',
    $keytable             = 'refile:/etc/opendkim/KeyTable',
    $signing_table        = 'refile:/etc/opendkim/SigningTable',
    $signature_algorithm  = 'rsa-sha256',
    $socket               = 'inet:8891@localhost',
    $pidfile              = '/var/run/opendkim/opendkim.pid',
    $umask                = '022',
    $userid               = 'opendkim:opendkim',
    $temporary_directory  = '/var/tmp',
    $package_name         = 'opendkim',
    $service_name         = 'opendkim',
    $pathconf             = '/etc/opendkim',
    $owner                = 'opendkim',
    $group                = 'opendkim',
) {

    package { $package_name:
        ensure => present,
    }

    case $::operatingsystem {
      /^(Debian|Ubuntu)$/: {
            package { 'opendkim-tools':
              ensure => present,
            }
            # Debian/Ubuntu doesn't ship this directory in its package
            file { $pathconf:
              ensure  => directory,
              owner   => 'root',
              group   => 'opendkim',
              mode    => '0755',
              require => Package[$package_name],
            }
            file { "${pathconf}/keys":
              ensure  => directory,
              owner   => 'opendkim',
              group   => 'opendkim',
              mode    => '0750',
              require => Package[$package_name],
            }
            file { "${pathconf}/KeyTable":
              ensure  => present,
              owner   => 'opendkim',
              group   => 'opendkim',
              mode    => '0640',
              require => Package[$package_name],
            }
            file { "${pathconf}/SigningTable":
              ensure  => present,
              owner   => 'opendkim',
              group   => 'opendkim',
              mode    => '0640',
              require => Package[$package_name],
            }
            file { "${pathconf}/TrustedHosts":
              ensure  => present,
              owner   => 'opendkim',
              group   => 'opendkim',
              mode    => '0644',
              require => Package[$package_name],
            }
      }
      default: {}
    }

    file {'/etc/opendkim.conf':
        ensure  => file,
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        content => template('opendkim/opendkim.conf'),
        notify  => Service[$service_name],
        require => Package[$package_name],
    }

    service { $service_name:
        ensure  => running,
        enable  => true,
        require => Package[$package_name],
    }
}