[enh] Add SNI support to postfix and dovecot

This commit is contained in:
Tagadda 2022-01-19 20:10:28 +00:00
parent 140e50253f
commit 9ef3a1bfff
5 changed files with 16 additions and 2 deletions

View file

@ -21,6 +21,11 @@ ssl = required
ssl_cert = </etc/yunohost/certs/{{ main_domain }}/crt.pem
ssl_key = </etc/yunohost/certs/{{ main_domain }}/key.pem
{% for domain in domain_list.split() %}{% if domain != main_domain %}
local_name {{ domain }} {
ssl_cert = </etc/yunohost/certs/{{ domain }}/crt.pem
ssl_key = </etc/yunohost/certs/{{ domain }}/key.pem
}{% endif %}{% endfor %}
# curl https://ssl-config.mozilla.org/ffdhe2048.txt > /path/to/dhparam
ssl_dh = </usr/share/yunohost/ffdhe2048.pem

View file

@ -23,8 +23,11 @@ smtpd_use_tls = yes
smtpd_tls_security_level = may
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/yunohost/certs/{{ main_domain }}/crt.pem
smtpd_tls_key_file = /etc/yunohost/certs/{{ main_domain }}/key.pem
smtpd_tls_chain_files =
/etc/yunohost/certs/{{ main_domain }}/key.pem,
/etc/yunohost/certs/{{ main_domain }}/crt.pem
tls_server_chain_sni_maps = hash:/etc/postfix/sni
{% if compatibility == "intermediate" %}
# generated 2020-08-18, Mozilla Guideline v5.6, Postfix 3.4.14, OpenSSL 1.1.1d, intermediate configuration

2
conf/postfix/sni Normal file
View file

@ -0,0 +1,2 @@
{% for domain in domain_list.split() %}{{ domain }} /etc/yunohost/certs/{{ domain }}/key.pem /etc/yunohost/certs/{{ domain }}/crt.pem
{% endfor %}

View file

@ -46,6 +46,7 @@ do_pre_regen() {
export main_domain
export domain_list="$YNH_DOMAINS"
ynh_render_template "main.cf" "${postfix_dir}/main.cf"
ynh_render_template "sni" "${postfix_dir}/sni"
cat postsrsd \
| sed "s/{{ main_domain }}/${main_domain}/g" \
@ -73,6 +74,8 @@ do_post_regen() {
postmap /etc/postfix/sasl_passwd
fi
postmap -F hash:/etc/postfix/sni
[[ -z "$regen_conf_files" ]] \
|| { systemctl restart postfix && systemctl restart postsrsd; }

View file

@ -18,6 +18,7 @@ do_pre_regen() {
export pop3_enabled="$(yunohost settings get 'pop3.enabled')"
export main_domain=$(cat /etc/yunohost/current_host)
export domain_list="$YNH_DOMAINS"
ynh_render_template "dovecot.conf" "${dovecot_dir}/dovecot.conf"