aboutsummaryrefslogtreecommitdiffstats
path: root/roles/mail/templates/dovecot/passwd.j2
blob: b62ba2e0500b6d9cedc3d6542f96608fb62cce7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
# /usr/local/etc/dovecot/passwd
# Dovecot authentication database in passwd-file format.
#
# Format:
# user:password:uid:gid:(gecos):home:(shell):extra_fields
#
# Aaron LI
#

{% set mydomain = mail.domains[0] %}
{% for domain in mail.domains %}
# [domain: {{ domain }}]
{% for user in mail.userdb %}
{% set name = user.name %}
# (user: {{ name }})
{{ name }}@{{ domain }}:{{ passdb[name].pass }}::::::user={{ name }}@{{ mydomain }}
{% for dev in user.devices|default([]) %}
{{ name }}@{{ domain }}@{{ dev }}:{{ passdb[name].devices[dev] }}::::::user={{ name }}@{{ mydomain }}
{% endfor %}{# devices #}
{% if user.name != "root" and "aliases" in user %}
# aliases
{% for alias in user.aliases|default([]) %}
{{ alias }}@{{ domain }}:{{ passdb[name].pass }}::::::user={{ name }}@{{ mydomain }}
{% for dev in user.devices|default([]) %}
{{ alias }}@{{ domain }}@{{ dev }}:{{ passdb[name].devices[dev] }}::::::user={{ name }}@{{ mydomain }}
{% endfor %}{# devices #}
{% endfor %}{# alias #}
{% endif %}{# alias #}
{% endfor %}{# user #}
{% endfor %}{# domain #}