Skip to content

Commit 5cce045

Browse files
authored
Tls for postfix pr 2.x (#1493)
* Some Apache docs updates. * Sorting TLS for SMTP in Postfix config. * Left bad domain in example cert paths.
1 parent a673e27 commit 5cce045

File tree

7 files changed

+54
-12
lines changed

7 files changed

+54
-12
lines changed

docs/roles/debian/apache.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,18 @@ apache:
5555
handling: selfsigned
5656
# Sample LetsEncrypt config, because include_role will not merge defaults these all need providing:
5757
# handling: letsencrypt
58-
# http_01_port: 5000
58+
# http_01_port: 80
5959
# autorenew: true
6060
# email: sysadm@codeenigma.com
61-
# services: []
61+
# services:
62+
# - apache2
6263
# web_server: standalone
6364
# certbot_register_command: "/usr/bin/certbot certonly --agree-tos --preferred-challenges http -n"
6465
# certbot_renew_command: "/usr/bin/certbot certonly --agree-tos --force-renew"
6566
# reload_command: restart
6667
# reload:
67-
# - apache
68+
# - apache2
69+
# on_calendar: "Mon *-*-* 04:00:00"
6870
is_default: true
6971
basic_auth:
7072
auth_enabled: false

docs/roles/debian/postfix.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Postfix
2-
Installs and configures Postfix for sending mail. Mail sending is disabled by default.
2+
Installs and configures Postfix for sending mail. Mail sending is disabled by default using transport maps.
3+
4+
Full TLS SMTP support is optional by enabling SSL.
35

46
<!--TOC-->
57
<!--ENDTOC-->
@@ -36,6 +38,13 @@ postfix:
3638
aliases: []
3739
#- user: root
3840
# alias: admin@example.com
41+
# Basic optional SSL handling - does not currently use the SSL role, as it is likely being handled elsewhere
42+
ssl:
43+
enabled: false
44+
smtp_tls_cert_file: "" # full path to certificate, e.g. /etc/letsencrypt/live/acme.com/fullchain.pem
45+
smtp_tls_key_file: "" # full path to key, e.g. /etc/letsencrypt/live/acme.com/privkey.pem
46+
smtp_tls_CApath: /etc/ssl/certs
47+
smtp_tls_CAfile: /etc/ssl/certs/ca-certificates.crt
3948

4049
```
4150

roles/debian/apache/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,18 @@ apache:
5555
handling: selfsigned
5656
# Sample LetsEncrypt config, because include_role will not merge defaults these all need providing:
5757
# handling: letsencrypt
58-
# http_01_port: 5000
58+
# http_01_port: 80
5959
# autorenew: true
6060
# email: sysadm@codeenigma.com
61-
# services: []
61+
# services:
62+
# - apache2
6263
# web_server: standalone
6364
# certbot_register_command: "/usr/bin/certbot certonly --agree-tos --preferred-challenges http -n"
6465
# certbot_renew_command: "/usr/bin/certbot certonly --agree-tos --force-renew"
6566
# reload_command: restart
6667
# reload:
67-
# - apache
68+
# - apache2
69+
# on_calendar: "Mon *-*-* 04:00:00"
6870
is_default: true
6971
basic_auth:
7072
auth_enabled: false

roles/debian/apache/defaults/main.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,18 @@ apache:
4545
handling: selfsigned
4646
# Sample LetsEncrypt config, because include_role will not merge defaults these all need providing:
4747
# handling: letsencrypt
48-
# http_01_port: 5000
48+
# http_01_port: 80
4949
# autorenew: true
5050
# email: sysadm@codeenigma.com
51-
# services: []
51+
# services:
52+
# - apache2
5253
# web_server: standalone
5354
# certbot_register_command: "/usr/bin/certbot certonly --agree-tos --preferred-challenges http -n"
5455
# certbot_renew_command: "/usr/bin/certbot certonly --agree-tos --force-renew"
5556
# reload_command: restart
5657
# reload:
57-
# - apache
58+
# - apache2
59+
# on_calendar: "Mon *-*-* 04:00:00"
5860
is_default: true
5961
basic_auth:
6062
auth_enabled: false

roles/debian/postfix/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Postfix
2-
Installs and configures Postfix for sending mail. Mail sending is disabled by default.
2+
Installs and configures Postfix for sending mail. Mail sending is disabled by default using transport maps.
3+
4+
Full TLS SMTP support is optional by enabling SSL.
35

46
<!--TOC-->
57
<!--ENDTOC-->
@@ -36,6 +38,13 @@ postfix:
3638
aliases: []
3739
#- user: root
3840
# alias: admin@example.com
41+
# Basic optional SSL handling - does not currently use the SSL role, as it is likely being handled elsewhere
42+
ssl:
43+
enabled: false
44+
smtp_tls_cert_file: "" # full path to certificate, e.g. /etc/letsencrypt/live/acme.com/fullchain.pem
45+
smtp_tls_key_file: "" # full path to key, e.g. /etc/letsencrypt/live/acme.com/privkey.pem
46+
smtp_tls_CApath: /etc/ssl/certs
47+
smtp_tls_CAfile: /etc/ssl/certs/ca-certificates.crt
3948

4049
```
4150

roles/debian/postfix/defaults/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,10 @@ postfix:
2727
aliases: []
2828
#- user: root
2929
# alias: admin@example.com
30+
# Basic optional SSL handling - does not currently use the SSL role, as it is likely being handled elsewhere
31+
ssl:
32+
enabled: false
33+
smtp_tls_cert_file: "" # full path to certificate, e.g. /etc/letsencrypt/live/acme.com/fullchain.pem
34+
smtp_tls_key_file: "" # full path to key, e.g. /etc/letsencrypt/live/acme.com/privkey.pem
35+
smtp_tls_CApath: /etc/ssl/certs
36+
smtp_tls_CAfile: /etc/ssl/certs/ca-certificates.crt

roles/debian/postfix/templates/main.cf.j2

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,20 @@ non_smtpd_milters = inet:localhost:8891
3737
smtp_sasl_auth_enable = yes
3838
smtp_sasl_security_options = noanonymous
3939
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
40+
{% endif %}
41+
{% if postfix.use_ses or postfix.ssl.enabled %}
4042
smtp_use_tls = yes
4143
smtp_tls_note_starttls_offer = yes
42-
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
44+
smtp_tls_CApath = {{ postix.ssl.smtp_tls_CApath }}
45+
smtp_tls_CAfile = {{ postix.ssl.smtp_tls_CAfile }}
46+
{% endif %}
47+
{% if postfix.ssl.enabled %}
48+
smtp_tls_cert_file = {{ postix.ssl.smtp_tls_cert_file }}
49+
smtp_tls_key_file = {{ postix.ssl.smtp_tls_key_file }}
50+
smtpd_tls_cert_file = {{ postix.ssl.smtp_tls_cert_file }}
51+
smtpd_tls_key_file = {{ postix.ssl.smtp_tls_key_file }}
52+
smtpd_tls_CApath = {{ postix.ssl.smtp_tls_CApath }}
53+
smtpd_tls_CAfile = {{ postix.ssl.smtp_tls_CAfile }}
4354
{% endif %}
4455
{% if (is_local is defined) and is_local %}
4556
# Force all mail to ce-dev user.

0 commit comments

Comments
 (0)