postfix-vars, dkim-selector

This commit is contained in:
Denis Knauf 2020-11-08 00:02:54 +01:00
parent c5648aac36
commit 0c0c509f07
4 changed files with 22 additions and 26 deletions

View file

@ -74,6 +74,10 @@ Full qualified domain name of your mail server.
It is not possible to choose different for SMTP/Submission/IMAP/Sieve. It is not possible to choose different for SMTP/Submission/IMAP/Sieve.
But you can use CNAMEs/X509-Alt-names to define different. But you can use CNAMEs/X509-Alt-names to define different.
mail_dkim_selector::
For DKIM you need a selector, which will be used in DNS.
E.g. pick the current year.
mail_ldap_basedn:: mail_ldap_basedn::
LDAP-BaseDN. `cn=example,cn=net` LDAP-BaseDN. `cn=example,cn=net`
(default: value of ldap_basedn) (default: value of ldap_basedn)

View file

@ -9,6 +9,9 @@ mail_ldap_field_password: userPassword
mail_ldap_filter: '(&(objectClass=simpleSecurityObject)({{mail_ldap_field_user}}=%u))' mail_ldap_filter: '(&(objectClass=simpleSecurityObject)({{mail_ldap_field_user}}=%u))'
postfix_tls_policy: {} postfix_tls_policy: {}
postfix_myhostname: '{{mail_server_fqdn}}'
postfix_myorigin: '{{mail_server_fqdn}}'
postfix_mynetworks: '::1, 127.0.0.1'
dovecot_ldap_uris: "{{mail_ldap_uris}}" dovecot_ldap_uris: "{{mail_ldap_uris}}"
dovecot_ldap_ldaprc_path: /etc/ldap/ldap.conf dovecot_ldap_ldaprc_path: /etc/ldap/ldap.conf

View file

@ -60,7 +60,7 @@
- name: vmail-user for Mailboxes - name: vmail-user for Mailboxes
user: user:
name: vmail name: vmail
uid: 999 uid: '{{postfix_vmail_uid}}'
comment: Mailboxes comment: Mailboxes
group: vmail group: vmail
shell: /bin/false shell: /bin/false
@ -89,20 +89,12 @@
mode: 03700 mode: 03700
- name: '/var/mail domains' - name: '/var/mail domains'
file: file:
dest: '/var/mail/{{item.key}}' dest: '/var/mail/{{item}}'
group: vmail group: vmail
owner: vmail owner: vmail
state: directory state: directory
mode: 03700 mode: 03700
with_dict: '{{mail_domains}}' with_items: '{{mail_domains}}'
- name: opendkim.conf
copy:
src: opendkim.conf
dest: /etc
owner: root
group: root
mode: 0644
- name: /etc/mailname - name: /etc/mailname
copy: copy:
@ -123,17 +115,17 @@
insertafter: '^#{{item.key}}[ \t]' insertafter: '^#{{item.key}}[ \t]'
line: '{{item.key}} {{item.value}}' line: '{{item.key}} {{item.value}}'
with_dict: with_dict:
Domain: '{{mail_domain}}' Domain: '{{mail_server_fqdn}}'
KeyFile: '/etc/dkimkeys/{{dkim_selector}}.key' KeyFile: '/etc/dkimkeys/{{mail_dkim_selector}}.key'
Socket: local:/var/spool/postfix/milter/opendkim Socket: local:/var/spool/postfix/milter/opendkim
Selector: '{{dkim_selector}}' Selector: '{{mail_dkim_selector}}'
- name: 'DKIM-key' - name: 'DKIM-key'
shell: | shell: |
set -e set -e
f={{item|quote}} f={{item|quote}}
ulimit 0400 ulimit 0400
opendkim-genkey --bits 2048 --domain {{mail_domain|quote}} --restrict --selector "$f" opendkim-genkey --bits 2048 --domain {{mail_server_fqdn|quote}} --restrict --selector "$f"
chown opendkim:root "$f.private" "$f.txt" chown opendkim:root "$f.private" "$f.txt"
mv "$f.private" "$f.key" mv "$f.private" "$f.key"
mv "$f.txt" "$f.zone" mv "$f.txt" "$f.zone"
@ -169,20 +161,17 @@
mode: 0444 mode: 0444
with_fileglob: "systemd/default/*" with_fileglob: "systemd/default/*"
- include_tasks: - include_tasks: postfix.yml
name: postfix - include_tasks: dovecot.yml
- include_tasks: - include_tasks: tls.yml
name: dovecot
- include_tasks:
name: tls
- name: enabled services - name: enabled services
systemd: systemd:
name: '{{item}}' name: '{{item}}'
daemon-reload: true daemon-reload: true
enabled: true enabled: true
with-items: [dovecot, postfix, opendkim, opendmarc, postsrsd] with_items: [dovecot, postfix, opendkim, opendmarc, postsrsd]
- name: reload/restart services - name: reload/restart services
shell: 'systemctl reload-or-restart {{item|quote}}' shell: 'systemctl reload-or-restart {{item|quote}}'
with-items: [dovecot, postfix, opendkim, opendmarc, postsrsd] with_items: [dovecot, postfix, opendkim, opendmarc, postsrsd]

View file

@ -49,11 +49,11 @@
#tls_high_cipherlist: 'EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA256:EECDH:+CAMELLIA128:+AES128:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!IDEA:!ECDSA:kEDH:CAMELLIA128-SHA:AES128-SHA' #tls_high_cipherlist: 'EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA256:EECDH:+CAMELLIA128:+AES128:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!IDEA:!ECDSA:kEDH:CAMELLIA128-SHA:AES128-SHA'
smtpd_tls_exclude_ciphers: MD5, DES, eNULL, 3DES, EXP, RC4, DSS, PSK, SEED, IDEA, ECDSA, aNULL smtpd_tls_exclude_ciphers: MD5, DES, eNULL, 3DES, EXP, RC4, DSS, PSK, SEED, IDEA, ECDSA, aNULL
smtpd_tls_eecdh_grade: strong smtpd_tls_eecdh_grade: strong
myhostname: '{{mail_postfix_domain}}' myhostname: '{{postfix_myhostname}}'
myorigin: '{{mail_postfix_myorigin}}' myorigin: '{{postfix_myorigin}}'
mydestination: '' mydestination: ''
relayhost: '' relayhost: ''
mynetworks: '{{mynetworks}}' mynetworks: '{{postfix_mynetworks}}'
recipient_delimiter: '+' recipient_delimiter: '+'
inet_interfaces: 'all' inet_interfaces: 'all'
#inet_protocols: 'ipv4' #inet_protocols: 'ipv4'