summaryrefslogtreecommitdiff
path: root/manifests/opendkim.pp
blob: 99e2295657860fb0bd1924ab0ca4810b3eb829d1 (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
# Recipe from https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-dkim-with-postfix-on-debian-wheezy
class mail::opendkim {
  include mail::opendkim::packages

  file { '/etc/default/opendkim':
    ensure => present,
    owner  => root,
    group  => root,
    mode   => '0644',
    source => "puppet:///modules/mail/opendkim/default",
    require => Package['opendkim'],
    notify  => Service['opendkim'],
  }

  file { '/etc/opendkim.conf':
    ensure => present,
    owner  => root,
    group  => root,
    mode   => '0644',
    source => [ "puppet:///modules/site_mail/opendkim/opendkim.conf",
                "puppet:///modules/mail/opendkim/opendkim.conf" ],
    require => Package['opendkim'],
    notify  => Service['opendkim'],
  }

  file { '/etc/opendkim':
    ensure => directory,
    owner  => root,
    group  => root,
    mode   => '0644',
    require => Package['opendkim'],
  }

  file { '/etc/opendkim/keys':
    ensure => directory,
    owner  => opendkim,
    group  => opendkim,
    mode   => '0750',
    require => File['/etc/opendkim'],
  }

  file { '/etc/opendkim/TrustedHosts':
    ensure => present,
    owner  => root,
    group  => root,
    mode   => '0644',
    source => [ "puppet:///modules/site_mail/opendkim/TrustedHosts",
                "puppet:///modules/mail/opendkim/TrustedHosts" ],
    require => File['/etc/opendkim'],
    notify  => Service['opendkim'],
  }

  file { '/etc/opendkim/KeyTable':
    ensure => present,
    owner  => root,
    group  => root,
    mode   => '0644',
    source => [ "puppet:///modules/site_mail/opendkim/KeyTable",
                "puppet:///modules/mail/opendkim/KeyTable" ],
    require => File['/etc/opendkim'],
    notify  => Service['opendkim'],
  }

  file { '/etc/opendkim/SigningTable':
    ensure => present,
    owner  => root,
    group  => root,
    mode   => '0644',
    source => [ "puppet:///modules/site_mail/opendkim/SigningTable",
                "puppet:///modules/mail/opendkim/SigningTable" ],
    require => File['/etc/opendkim'],
    notify  => Service['opendkim'],
  }

  service { 'opendkim' :
    ensure    => running,
    enable    => true,
    require   => [ Package['opendkim'],
                   File['/etc/default/opendkim', '/etc/opendkim.conf',
                        '/etc/opendkim/TrustedHosts', '/etc/opendkim/KeyTable', '/etc/opendkim/SigningTable' ] ],
  }

  postfix::config { "milter_protocol":       value => '2' }
  postfix::config { "milter_default_action": value => 'accept' }
  postfix::config { "smtpd_milters":         value => 'inet:localhost:12301' }
  postfix::config { "non_smtpd_milters":     value => 'inet:localhost:12301' }
}