tabs to two spaces

master
Denis Knauf 2020-11-07 23:23:20 +01:00
parent f116b740e1
commit f99e0d08b0
3 changed files with 292 additions and 292 deletions

View File

@ -2,147 +2,147 @@
# vim: set et sw=2 ts=2 sts=2:
- name: dovecot-service.conf set file limit
copy:
dest: /etc/systemd/system/dovecot.service.d/service.conf
content: |
[Service]
LimitNOFILE=16384
copy:
dest: /etc/systemd/system/dovecot.service.d/service.conf
content: |
[Service]
LimitNOFILE=16384
- name: dovecot-configs
copy:
src: "{{item}}"
dest: /etc/dovecot
owner: root
group: dovecot
mode: 0444
with_fileglob:
- "dovecot/*"
copy:
src: "{{item}}"
dest: /etc/dovecot
owner: root
group: dovecot
mode: 0444
with_fileglob:
- "dovecot/*"
- name: dovecot-configs in conf.d
copy:
src: "{{item}}"
dest: /etc/dovecot/conf.d
owner: root
group: dovecot
mode: 0444
with_fileglob:
- "dovecot/conf.d/*"
copy:
src: "{{item}}"
dest: /etc/dovecot/conf.d
owner: root
group: dovecot
mode: 0444
with_fileglob:
- "dovecot/conf.d/*"
- name: 'deactivate auth-system'
lineinfile:
path: /etc/dovecot/conf.d/10-auth.conf
line: "#!include auth-system.conf.ext"
regexp: "^#?!include auth-system\\.conf\\.ext"
lineinfile:
path: /etc/dovecot/conf.d/10-auth.conf
line: "#!include auth-system.conf.ext"
regexp: "^#?!include auth-system\\.conf\\.ext"
- name: 'activate auth-ldap,-passwdfile'
lineinfile:
path: /etc/dovecot/conf.d/10-auth.conf
line: "!include {{item}}.conf.ext"
regexp: "^#?!include {{item}}.conf.ext"
with_items:
- auth-ldap
- auth-passwdfile
lineinfile:
path: /etc/dovecot/conf.d/10-auth.conf
line: "!include {{item}}.conf.ext"
regexp: "^#?!include {{item}}.conf.ext"
with_items:
- auth-ldap
- auth-passwdfile
- name: 'dovecot: 10-ssl.conf'
lineinfile:
path: /etc/dovecot/conf.d/10-ssl.conf
insertafter: "^#{{item.key}} *= *"
regexp: "^{{item.key}} *= *"
line: "{{item.key}} = {{item.value}}"
with_dict:
ssl: required
ssl_key: "</etc/dovecot/tls/{{mail_server_fqdn}}.key"
ssl_cert: "</etc/dovecot/tls/{{mail_server_fqdn}}.crt"
lineinfile:
path: /etc/dovecot/conf.d/10-ssl.conf
insertafter: "^#{{item.key}} *= *"
regexp: "^{{item.key}} *= *"
line: "{{item.key}} = {{item.value}}"
with_dict:
ssl: required
ssl_key: "</etc/dovecot/tls/{{mail_server_fqdn}}.key"
ssl_cert: "</etc/dovecot/tls/{{mail_server_fqdn}}.crt"
ssl_min_protocol: 'TLSv1.2'
#ssl_cipher_list: 'EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA256:EECDH:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!IDEA:!ECDSA:kEDH:CAMELLIA128-SHA:AES128-SHA'
ssl_cipher_list: ALL:!kRSA:!SRP:!kDHd:!DSS:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4:!ADH:!LOW@STRENGTH
ssl_prefer_server_ciphers: 'yes'
ssl_dh_parameters_length: 2048
ssl_prefer_server_ciphers: 'yes'
ssl_dh_parameters_length: 2048
- name: 'dovecot: 20-lmtp.conf'
lineinfile:
path: /etc/dovecot/conf.d/20-lmtp.conf
insertafter: "^[ \t]*#{{item.key}} *= *"
regexp: "^[ \t]*{{item.key}} *= *"
line: " {{item.key}} = {{item.value}}"
with_dict:
mail_plugins: '$mail_plugins quota sieve'
lineinfile:
path: /etc/dovecot/conf.d/20-lmtp.conf
insertafter: "^[ \t]*#{{item.key}} *= *"
regexp: "^[ \t]*{{item.key}} *= *"
line: " {{item.key}} = {{item.value}}"
with_dict:
mail_plugins: '$mail_plugins quota sieve'
- name: 'dovecot: 20-imap.conf: activated plugins'
lineinfile:
path: /etc/dovecot/conf.d/20-imap.conf
insertafter: "^[\t ]*#{{item.key}} *= *"
regexp: "^[\t ]*{{item.key}} *= *"
line: " {{item.key}} = {{item.value}}"
with_dict:
mail_plugins: '$mail_plugins imap_sieve imap_acl'
lineinfile:
path: /etc/dovecot/conf.d/20-imap.conf
insertafter: "^[\t ]*#{{item.key}} *= *"
regexp: "^[\t ]*{{item.key}} *= *"
line: " {{item.key}} = {{item.value}}"
with_dict:
mail_plugins: '$mail_plugins imap_sieve imap_acl'
- name: 'dovecot: 90-acl.conf: shared-mailboxes-dict'
lineinfile:
path: /etc/dovecot/conf.d/90-acl.conf
insertafter: "^[\t ]*#{{item.key}} *= *"
regexp: "^[\t ]*{{item.key}} *= *"
line: " {{item.key}} = {{item.value}}"
with_dict:
acl_shared_dict: 'file:/var/mail/%Ld/shared-mailboxes.db'
lineinfile:
path: /etc/dovecot/conf.d/90-acl.conf
insertafter: "^[\t ]*#{{item.key}} *= *"
regexp: "^[\t ]*{{item.key}} *= *"
line: " {{item.key}} = {{item.value}}"
with_dict:
acl_shared_dict: 'file:/var/mail/%Ld/shared-mailboxes.db'
- name: 'dovecot: auth-ldap.conf.ext'
lineinfile:
path: /etc/dovecot/conf.d/auth-ldap.conf.ext
insertafter: "^[\t ]*#{{item.key}} *= *"
regexp: "^[\t ]*{{item.key}} *= *"
line: " {{item.key}} = {{item.value}}"
with_dict:
default_fields: 'home=/var/mail/%Ld/%Ln'
lineinfile:
path: /etc/dovecot/conf.d/auth-ldap.conf.ext
insertafter: "^[\t ]*#{{item.key}} *= *"
regexp: "^[\t ]*{{item.key}} *= *"
line: " {{item.key}} = {{item.value}}"
with_dict:
default_fields: 'home=/var/mail/%Ld/%Ln'
- name: 'dovecot: 90-sieve.conf'
lineinfile:
path: /etc/dovecot/conf.d/90-sieve.conf
insertafter: "^[\t ]*#{{item.key}} *= *"
regexp: "^[\t ]*{{item.key}} *= *"
line: " {{item.key}} = {{item.value}}"
with_dict:
sieve: 'file:/var/mail/%Ld/%Ln/sieve;active=/var/mail/%Ld/%Ln/active.sieve'
sieve_extensions: '+editheader +vnd.dovecot.debug +vnd.dovecot.pipe'
sieve_max_redirects: 25
sieve_max_actions: 64
lineinfile:
path: /etc/dovecot/conf.d/90-sieve.conf
insertafter: "^[\t ]*#{{item.key}} *= *"
regexp: "^[\t ]*{{item.key}} *= *"
line: " {{item.key}} = {{item.value}}"
with_dict:
sieve: 'file:/var/mail/%Ld/%Ln/sieve;active=/var/mail/%Ld/%Ln/active.sieve'
sieve_extensions: '+editheader +vnd.dovecot.debug +vnd.dovecot.pipe'
sieve_max_redirects: 25
sieve_max_actions: 64
- name: 'dovecot: dovecot-ldap.conf.ext'
lineinfile:
path: /etc/dovecot/dovecot-ldap.conf.ext
insertafter: "^#{{item.key}} *= *"
regexp: "^{{item.key}} *= *"
line: "{{item.key}} = {{item.value}}"
with_dict:
uris: '{{dovecot_ldap_utis}}'
ldaprc_path: '{{dovecot_ldap_ldaprc_path}}'
auth_bind: 'yes'
ldap_version: 3
base: '{{dovecot_ldap_base}}'
scope: '{{dovecot_ldap_scope}}'
user_filter: '{{dovecot_ldap_user_filter}}'
user_attrs: '{{dovecot_ldap_user_attrs}}'
pass_filter: '{{dovecot_ldap_pass_filter}}'
pass_attrs: '{{dovecot_ldap_pass_attrs}}'
iterate_attrs: '{{dovecot_ldap_iterate_attrs}}'
iterate_filter: '{{dovecot_ldap_iterate_filter}}'
lineinfile:
path: /etc/dovecot/dovecot-ldap.conf.ext
insertafter: "^#{{item.key}} *= *"
regexp: "^{{item.key}} *= *"
line: "{{item.key}} = {{item.value}}"
with_dict:
uris: '{{dovecot_ldap_utis}}'
ldaprc_path: '{{dovecot_ldap_ldaprc_path}}'
auth_bind: 'yes'
ldap_version: 3
base: '{{dovecot_ldap_base}}'
scope: '{{dovecot_ldap_scope}}'
user_filter: '{{dovecot_ldap_user_filter}}'
user_attrs: '{{dovecot_ldap_user_attrs}}'
pass_filter: '{{dovecot_ldap_pass_filter}}'
pass_attrs: '{{dovecot_ldap_pass_attrs}}'
iterate_attrs: '{{dovecot_ldap_iterate_attrs}}'
iterate_filter: '{{dovecot_ldap_iterate_filter}}'
- name: dummy files if needed
copy:
dest: '{{item.key}}'
content: '{{item.value}}'
force: no
with_dict:
"/etc/dovecot/users": ''
copy:
dest: '{{item.key}}'
content: '{{item.value}}'
force: no
with_dict:
"/etc/dovecot/users": ''
- name: 'dovecot: special users'
lineinfile:
path: /etc/dovecot/users
line: '{{item}}::::::::'
regexp: '{{item|regex_escape()}}'
lineinfile:
path: /etc/dovecot/users
line: '{{item}}::::::::'
regexp: '{{item|regex_escape()}}'
with_items: '{{dovecot_special_users}}'
- name: 'install sieve-scripts (templates)'
shell: 'doveadm sieve put -u {{item.user|quote}} -a {{item.name|default("main")|quote}}'
args:
stdin_add_newline: false
stdin: '{{lookup("file", item.file)|quote}}'
with_items: '{{mail_sieve_scripts}}'
shell: 'doveadm sieve put -u {{item.user|quote}} -a {{item.name|default("main")|quote}}'
args:
stdin_add_newline: false
stdin: '{{lookup("file", item.file)|quote}}'
with_items: '{{mail_sieve_scripts}}'
- name: 'install sieve-scripts (templates)'
shell: 'doveadm sieve put -u {{item.user|quote}} -a {{item.name|default("main")|quote}}'
args:
stdin_add_newline: false
stdin: '{{lookup("template", item.file)|quote}}'
with_items: '{{mail_sieve_scripts_templates}}'
shell: 'doveadm sieve put -u {{item.user|quote}} -a {{item.name|default("main")|quote}}'
args:
stdin_add_newline: false
stdin: '{{lookup("template", item.file)|quote}}'
with_items: '{{mail_sieve_scripts_templates}}'

View File

@ -2,185 +2,185 @@
# vim: set et sw=2 ts=2 sts=2:
- name: install gnutls, postfix & dovecot
apt:
name:
# TLS
- gnutls-bin
apt:
name:
# TLS
- gnutls-bin
# ansible
- python-pip
- python-openssl
# ansible
- python-pip
- python-openssl
#- libpam-ldapd
#- libpam-ldapd
# postfix
- postfix
- postfix-pcre
- postfix-cdb
- postfix-lmdb
# postfix
- postfix
- postfix-pcre
- postfix-cdb
- postfix-lmdb
# milter
- opendkim
- opendkim-tools
- opendmarc
- postfix-policyd-spf-python
# for rewriting sender (tries to fix forwarding+SPF-problem)
- postsrsd
# milter
- opendkim
- opendkim-tools
- opendmarc
- postfix-policyd-spf-python
# for rewriting sender (tries to fix forwarding+SPF-problem)
- postsrsd
# imap
- dovecot-core
- dovecot-imapd
- dovecot-managesieved
- dovecot-ldap
- dovecot-gssapi
- dovecot-lmtpd
# imap
- dovecot-core
- dovecot-imapd
- dovecot-managesieved
- dovecot-ldap
- dovecot-gssapi
- dovecot-lmtpd
- name: 'directory-structures (/etc/postfix-&/etc/dovecot&...)'
file:
dest: "{{item}}"
owner: root
group: root
mode: 0755
state: directory
with_items:
- /etc/postfix
- /etc/dovecot
- /etc/dovecot/conf.d
- /etc/dkimkeys
- /etc/systemd/system/dovecot.service.d
file:
dest: "{{item}}"
owner: root
group: root
mode: 0755
state: directory
with_items:
- /etc/postfix
- /etc/dovecot
- /etc/dovecot/conf.d
- /etc/dkimkeys
- /etc/systemd/system/dovecot.service.d
- name: Groups
group:
name: "{{item}}"
system: yes
with_items:
- vmail
- milter
group:
name: "{{item}}"
system: yes
with_items:
- vmail
- milter
- name: vmail-user for Mailboxes
user:
name: vmail
uid: 999
comment: Mailboxes
group: vmail
shell: /bin/false
createhome: no
home: /var/mail/vmail
move_home: no
skeleton: no
system: yes
user:
name: vmail
uid: 999
comment: Mailboxes
group: vmail
shell: /bin/false
createhome: no
home: /var/mail/vmail
move_home: no
skeleton: no
system: yes
- name: add milter-group-members
user:
name: "{{item}}"
append: yes
groups: milter
with_items:
- opendkim
- opendmarc
- postfix
user:
name: "{{item}}"
append: yes
groups: milter
with_items:
- opendkim
- opendmarc
- postfix
- name: '/var/mail'
file:
dest: /var/mail
group: vmail
owner: vmail
state: directory
mode: 03700
file:
dest: /var/mail
group: vmail
owner: vmail
state: directory
mode: 03700
- name: '/var/mail domains'
file:
dest: '/var/mail/{{item.key}}'
group: vmail
owner: vmail
state: directory
mode: 03700
with_dict: '{{mail_domains}}'
file:
dest: '/var/mail/{{item.key}}'
group: vmail
owner: vmail
state: directory
mode: 03700
with_dict: '{{mail_domains}}'
- name: opendkim.conf
copy:
src: opendkim.conf
dest: /etc
owner: root
group: root
mode: 0644
copy:
src: opendkim.conf
dest: /etc
owner: root
group: root
mode: 0644
- name: /etc/mailname
copy:
dest: /etc/mailname
content: "{{mail_server_fqdn}}"
copy:
dest: /etc/mailname
content: "{{mail_server_fqdn}}"
- file:
dest: /var/spool/postfix/milter
owner: postfix
group: milter
mode: 0570
state: directory
dest: /var/spool/postfix/milter
owner: postfix
group: milter
mode: 0570
state: directory
- name: 'opendkim: config'
lineinfile:
path: /etc/opendkim.conf
regexp: '^{{item.key}}[ \t]'
insertafter: '^#{{item.key}}[ \t]'
line: '{{item.key}} {{item.value}}'
with_dict:
Domain: '{{mail_domain}}'
KeyFile: '/etc/dkimkeys/{{dkim_selector}}.key'
Socket: local:/var/spool/postfix/milter/opendkim
Selector: '{{dkim_selector}}'
lineinfile:
path: /etc/opendkim.conf
regexp: '^{{item.key}}[ \t]'
insertafter: '^#{{item.key}}[ \t]'
line: '{{item.key}} {{item.value}}'
with_dict:
Domain: '{{mail_domain}}'
KeyFile: '/etc/dkimkeys/{{dkim_selector}}.key'
Socket: local:/var/spool/postfix/milter/opendkim
Selector: '{{dkim_selector}}'
- name: 'DKIM-key'
shell: |
set -e
f={{item|quote}}
ulimit 0400
opendkim-genkey --bits 2048 --domain {{mail_domain|quote}} --restrict --selector "$f"
chown opendkim:root "$f.private" "$f.txt"
mv "$f.private" "$f.key"
mv "$f.txt" "$f.zone"
args:
chdir: /etc/dkimkeys
creates: "{{item}}.key"
with_items:
- "{{mail_dkim_selector}}"
shell: |
set -e
f={{item|quote}}
ulimit 0400
opendkim-genkey --bits 2048 --domain {{mail_domain|quote}} --restrict --selector "$f"
chown opendkim:root "$f.private" "$f.txt"
mv "$f.private" "$f.key"
mv "$f.txt" "$f.zone"
args:
chdir: /etc/dkimkeys
creates: "{{item}}.key"
with_items:
- "{{mail_dkim_selector}}"
- name: 'opendmarc: config'
lineinfile:
path: /etc/opendmarc.conf
regexp: '^{{item.key}}[ \t]'
insertafter: '^#{{item.key}}[ \t]'
line: '{{item.key}} {{item.value}}'
with_dict:
Socket: local:/var/spool/postfix/milter/opendmarc
lineinfile:
path: /etc/opendmarc.conf
regexp: '^{{item.key}}[ \t]'
insertafter: '^#{{item.key}}[ \t]'
line: '{{item.key}} {{item.value}}'
with_dict:
Socket: local:/var/spool/postfix/milter/opendmarc
- name: copy systemd-services
copy:
src: "{{item}}"
dest: /etc/systemd/system
owner: root
group: root
mode: 0444
with_fileglob: "systemd/system/*"
copy:
src: "{{item}}"
dest: /etc/systemd/system
owner: root
group: root
mode: 0444
with_fileglob: "systemd/system/*"
- name: copy service-configs
copy:
src: "{{item}}"
dest: /etc/default
owner: root
group: root
mode: 0444
with_fileglob: "systemd/default/*"
copy:
src: "{{item}}"
dest: /etc/default
owner: root
group: root
mode: 0444
with_fileglob: "systemd/default/*"
- include_task:
name: postfix
name: postfix
- include_task:
name: dovecot
name: dovecot
- name: enabled services
systemd:
name: '{{item}}'
daemon-reload: true
enabled: true
with-items: [dovecot, postfix, opendkim, opendmarc, postsrsd]
systemd:
name: '{{item}}'
daemon-reload: true
enabled: true
with-items: [dovecot, postfix, opendkim, opendmarc, postsrsd]
- name: reload/restart services
shell: 'systemctl reload-or-restart {{item|quote}}'
with-items: [dovecot, postfix, opendkim, opendmarc, postsrsd]
shell: 'systemctl reload-or-restart {{item|quote}}'
with-items: [dovecot, postfix, opendkim, opendmarc, postsrsd]

View File

@ -2,14 +2,14 @@
# vim: set et sw=2 ts=2 sts=2:
- name: postfix-configs
copy:
src: "{{item}}"
dest: /etc/postfix
owner: root
group: root
mode: 0444
with_fileglob:
- "postfix/*"
copy:
src: "{{item}}"
dest: /etc/postfix
owner: root
group: root
mode: 0444
with_fileglob:
- "postfix/*"
- name: 'postfix: main.cf'
lineinfile:
@ -112,31 +112,31 @@
non_smtpd_milters: 'unix:milter/opendkim'
- name: mailinglists-aliases
template:
src: mailinglist-aliases.j2
dest: /etc/postfix/mailinglists
mode: 0444
owner: root
group: root
template:
src: mailinglist-aliases.j2
dest: /etc/postfix/mailinglists
mode: 0444
owner: root
group: root
- name: dummy files if needed
copy:
dest: '{{item.key}}'
content: '{{item.value}}'
force: no
with_dict: '{{postfix_default_file_content}}'
copy:
dest: '{{item.key}}'
content: '{{item.value}}'
force: no
with_dict: '{{postfix_default_file_content}}'
- name: force TLS for these
lineinfile:
path: /etc/postfix/tls_policy
regexp: '^{{key}}[ \t]'
line: '{{key}} {{value}}'
with_dict: '{{postfix_tls_policy}}'
lineinfile:
path: /etc/postfix/tls_policy
regexp: '^{{key}}[ \t]'
line: '{{key}} {{value}}'
with_dict: '{{postfix_tls_policy}}'
- name: prepare aliases-lookup-tables
command: newaliases
command: newaliases
- name: prepare lookup-tables
shell: 'postmap {{item|quote}}'
args:
chdir: /etc/postfix
with_items: '{{postfix_postmap}}'
shell: 'postmap {{item|quote}}'
args:
chdir: /etc/postfix
with_items: '{{postfix_postmap}}'