fix multidomain config

This commit is contained in:
Antonio J. Delgado 2024-04-03 23:58:26 +03:00
parent 8e11f67af4
commit 05541ff0bb
3 changed files with 41 additions and 25 deletions

View file

@ -57,29 +57,45 @@
backup: true backup: true
notify: Restart OpenDKIM service notify: Restart OpenDKIM service
# - name: Configure OpenDKIM domains - name: Configure OpenDKIM key table
# lineinfile: lineinfile:
# path: /etc/opendkim.conf path: /etc/opendkim.conf
# regexp: '^Domain ' regexp: '^KeyTable '
# line: "Domain {{ mail_domains|join(',') }}" line: "KeyTable /etc/opendkim/keytable"
# backup: true backup: true
# notify: Restart OpenDKIM service notify: Restart OpenDKIM service
# - name: Configure OpenDKIM key file - name: Configure OpenDKIM signing table
# lineinfile: lineinfile:
# path: /etc/opendkim.conf path: /etc/opendkim.conf
# regexp: '^KeyFile ' regexp: '^SigningTable '
# line: "KeyFile /etc/dkimkeys/{{ mail_domains[0] }}.private" line: "SigningTable /etc/opendkim/signingtable"
# backup: true backup: true
# notify: Restart OpenDKIM service notify: Restart OpenDKIM service
# - name: Configure OpenDKIM selector - name: Configure OpenDKIM InternalHosts
# lineinfile: lineinfile:
# path: /etc/opendkim.conf path: /etc/opendkim.conf
# regexp: '^Selector ' regexp: '^InternalHosts '
# line: 'Selector ""' line: 'InternalHosts /etc/opendkim/TrustedHosts'
# backup: true backup: true
# notify: Restart OpenDKIM service notify: Restart OpenDKIM service
- name: Configure OpenDKIM ExternalIgnoreList
lineinfile:
path: /etc/opendkim.conf
regexp: '^ExternalIgnoreList '
line: 'ExternalIgnoreList /etc/opendkim/TrustedHosts'
backup: true
notify: Restart OpenDKIM service
- name: Configure OpenDKIM SubDomains
lineinfile:
path: /etc/opendkim.conf
regexp: '^SubDomains '
line: 'SubDomains yes'
backup: true
notify: Restart OpenDKIM service
- name: Ensure opendkim folder exists - name: Ensure opendkim folder exists
file: file:
@ -123,7 +139,7 @@
lineinfile: lineinfile:
path: /etc/postfix/main.cf path: /etc/postfix/main.cf
regexp: '^milter_default_action ' regexp: '^milter_default_action '
line: 'milter_default_action = accept' line: 'milter_default_action = accept'
backup: yes backup: yes
notify: notify:
- Reload postfix - Reload postfix
@ -132,7 +148,7 @@
lineinfile: lineinfile:
path: /etc/postfix/main.cf path: /etc/postfix/main.cf
regexp: '^milter_protocol ' regexp: '^milter_protocol '
line: 'milter_protocol = 2' line: 'milter_protocol = 6'
backup: yes backup: yes
notify: notify:
- Reload postfix - Reload postfix

View file

@ -1,3 +1,3 @@
{% for domain in mail_domains %} {% for domain in mail_domains %}
{{ dkim_selector }}._domainkey.{{ domain }} {{ domain }}:selector:/etc/opendkim/{{ domain }}.private {{ dkim_selector }}._domainkey.{{ domain }} {{ domain }}:default:/etc/opendkim/{{ domain }}.private
{% endfor %} {% endfor %}

View file

@ -1,3 +1,3 @@
{% for domain in mail_domains %} {% for domain in mail_domains %}
*@{{ domain }} {{ dkim_selector }}._domainkey.{{ domain }} *@{{ domain }} {{ dkim_selector }}._domainkey.{{ domain }}
{% endfor %} {% endfor %}