summaryrefslogtreecommitdiff
path: root/manifests/tls/hardened.pp
blob: cf7d1dd1dca1f4a3ea1dedc21d7ca861828d5f7f (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
class mail::tls::hardened inherits mail::tls {
  # Hardened config
  postfix::config { "smtpd_tls_ciphers":                value => 'high' }
  postfix::config { "smtp_tls_protocols":               value => '!SSLv2, !SSLv3' }
  postfix::config { "smtp_tls_mandatory_protocols":     value => '!SSLv2, !SSLv3' }
  postfix::config { "smtp_tls_note_starttls_offer":     value => 'yes' }
  postfix::config { "smtpd_tls_received_header":        value => 'yes' }
  postfix::config { "smtpd_tls_protocols":              value => '!SSLv2, !SSLv3' }
  postfix::config { "smtpd_tls_mandatory_protocols":    value => '!SSLv2, !SSLv3' }
  postfix::config { "smtpd_tls_session_cache_database": value => 'btree:${data_directory}/smtpd_scache' }
  postfix::config { "smtp_tls_session_cache_database":  value => 'btree:${data_directory}/smtp_scache' }
  postfix::config { "tls_ssl_options":                  value => 'no_compression' }
  postfix::config { "smtpd_tls_loglevel":               value => '1' }

  # DH parameters
  postfix::config { "smtpd_tls_eecdh_grade": value => 'strong' }

  #postfix::config { "smtpd_tls_dh1024_param_file":
  #  value   => '/etc/ssl/dhparams/dhparams_1024.pem',
  #  require => Exec['openssl-postfix-gendh-1024'],
  #}

  # See https://leap.se/code/issues/4012
  #     https://drownattack.com/postfix.html
  postfix::config { "smtpd_tls_dh1024_param_file":
    value   => '/etc/ssl/dhparams/dhparams_2048.pem',
    require => Exec['openssl-postfix-gendh-2048'],
  }

  # Old file locations
  file { [ '/etc/postfix/dh_512.pem', '/etc/postfix/dh_1024.pem' ]:
    ensure => absent,
  }

  postfix::config { "smtpd_tls_dh512_param_file":
    value   => '/etc/ssl/dhparams/dhparams_512.pem',
    require => Exec['openssl-postfix-gendh-512'],
  }

  ssl::dhparams { 'openssl-postfix-gendh-512':
    prefix => 'dh',
    size   => '512',
    folder => '/etc/postfix',
  }

  ssl::dhparams { 'openssl-postfix-gendh-1024':
    prefix => 'dh',
    size   => '1024',
    folder => '/etc/postfix',
  }

  ssl::dhparams { 'openssl-postfix-gendh-2048':
    prefix => 'dh',
    size   => '2048',
    folder => '/etc/postfix',
  }

  postfix::config { "smtpd_tls_exclude_ciphers":
    value => 'aNULL, MD5, DES, 3DES, DES-CBC3-SHA, RC4-SHA, AES256-SHA, AES128-SHA',
  }
}