summaryrefslogtreecommitdiff
path: root/manifests/autossh/mail.pp
blob: 287502523e02717c89558e1c10bfd642789586c3 (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
define tunnel::autossh::mail($sshport = '22') {
  package { "nullmailer":
    ensure => installed,
  }

  service { "nullmailer":
    ensure  => 'running',
    require => Package['nullmailer'],
  }

  file { "/etc/mailname":
    ensure  => present,
    owner   => root,
    group   => root,
    mode    => 0644,
    content => "${::fqdn}\n",
    notify  => Service["nullmailer"],
  }

  file { "/etc/nullmailer":
    ensure => directory,
    owner   => root,
    group   => root,
    mode   => 0755,
  }

  file { "/etc/nullmailer/remotes":
    ensure  => present,
    owner   => root,
    group   => root,
    mode    => 0644,
    content => "localhost smtp --port=2525\n",
    notify  => Service["nullmailer"],
    require => File["/etc/nullmailer"],
  }

  file { "/etc/nullmailer/adminaddr":
    ensure  => present,
    owner   => root,
    group   => root,
    mode    => 0644,
    content => "$root_mail_recipient\n",
    require => File["/etc/nullmailer"],
  }

  tunnel::autossh::instance{ "smtp":
    host      => "${name}.${::domain}",
    sshport   => "${sshport}",
    localport => '2525',
    hostport  => '25',
  }
}