diff --git a/roles/mail/tasks/main.yml b/roles/mail/tasks/main.yml index 914cdc8..686e4ea 100644 --- a/roles/mail/tasks/main.yml +++ b/roles/mail/tasks/main.yml @@ -104,6 +104,10 @@ template: src=certs.j2 dest=/etc/acme/domains.d/{{ ansible_fqdn }}_mail.conf tags: mail +- name: Configure certificate manager for mailman + template: src=mailman/certs.j2 dest=/etc/acme/domains.d/{{ mailman_domain }}_mailman.conf + tags: mail + - name: Create razor directory structure command: razor-admin -create chdir=/var/lib/amavis creates=/var/lib/amavis/.razor become: yes diff --git a/roles/mail/templates/mailman/certs.j2 b/roles/mail/templates/mailman/certs.j2 new file mode 100644 index 0000000..532328a --- /dev/null +++ b/roles/mail/templates/mailman/certs.j2 @@ -0,0 +1,15 @@ +--- + +{{ mailman_domain }}: +- path: /etc/nginx/ssl/{{ mailman_domain }}.crt + user: nginx + group: nginx + perm: '400' + format: crt + notify: 'service nginx reload' +- path: /etc/nginx/ssl/{{ mailman_domain }}.key + user: nginx + group: nginx + perm: '400' + format: key + notify: 'service nginx reload' diff --git a/roles/mail/templates/mailman/mm_cfg.py.j2 b/roles/mail/templates/mailman/mm_cfg.py.j2 index aebce99..2d46b6f 100644 --- a/roles/mail/templates/mailman/mm_cfg.py.j2 +++ b/roles/mail/templates/mailman/mm_cfg.py.j2 @@ -58,7 +58,7 @@ MAILMAN_SITE_LIST = 'mailman' # If you change these, you have to configure your http server # accordingly (Alias and ScriptAlias directives in most httpds) #DEFAULT_URL_PATTERN = 'http://%s/cgi-bin/mailman/' -DEFAULT_URL_PATTERN = 'http://%s/' +DEFAULT_URL_PATTERN = 'https://%s/' IMAGE_LOGOS = '/images/mailman/' #------------------------------------------------------------- diff --git a/roles/mail/templates/nginx/vhost.j2 b/roles/mail/templates/nginx/vhost.j2 index aa0b445..b74f8b7 100644 --- a/roles/mail/templates/nginx/vhost.j2 +++ b/roles/mail/templates/nginx/vhost.j2 @@ -1,13 +1,20 @@ server { listen 80; + listen [::]:80; + listen 443 ssl http2; + listen [::]:443 ssl http2; + + ssl_certificate /etc/nginx/ssl/{{ mailman_domain }}.crt; + ssl_certificate_key /etc/nginx/ssl/{{ mailman_domain }}.key; + server_name {{ mailman_domain }}; - root /usr/lib/cgi-bin/mailman/; location = / { rewrite ^ /listinfo permanent; } location / { + root /usr/lib/cgi-bin/mailman/; fastcgi_split_path_info (^/[^/]*)(.*)$; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;