summaryrefslogtreecommitdiff
path: root/puppet/modules/opendkim/manifests/init.pp
blob: 9e67569e985b2f2f011a600d1a6aacf721c01f32 (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
# configure opendkim service (#5924)
class opendkim {

  $domain_hash = hiera('domain')
  $domain      = $domain_hash['full_suffix']
  $dkim        = hiera('dkim')
  $selector    = $dkim['dkim_selector']

  include site_config::x509::dkim::key
  $dkim_key    = "${x509::variables::keys}/dkim.key"

  ensure_packages(['opendkim', 'libopendkim7', 'libvbr2'])

  # postfix user needs to be in the opendkim group
  # in order to access the opendkim socket located at:
  # local:/var/run/opendkim/opendkim.sock
  user { 'postfix':
    groups => 'opendkim';
  }

  service { 'opendkim':
    ensure     => running,
    enable     => true,
    hasstatus  => true,
    hasrestart => true,
    require    => Class['Site_config::X509::Dkim::Key'],
    subscribe  => File[$dkim_key];
  }

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