Add basic LDAP config for recipients and senders
This commit is contained in:
parent
660b1900c8
commit
782a07a450
5 changed files with 46 additions and 12 deletions
|
|
@ -15,5 +15,9 @@ postfix:
|
||||||
virtual_mailbox_domains: []
|
virtual_mailbox_domains: []
|
||||||
mynetworks: []
|
mynetworks: []
|
||||||
mydestination: []
|
mydestination: []
|
||||||
|
ldap:
|
||||||
|
enable: false
|
||||||
|
server_host: ldap.example.com
|
||||||
|
search_base: "dc=example,dc=com"
|
||||||
|
|
||||||
postfixmaps: []
|
postfixmaps: []
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
- name: install postfix
|
- name: install postfix
|
||||||
apt:
|
apt:
|
||||||
pkg: postfix
|
pkg:
|
||||||
|
- postfix
|
||||||
|
- postfix-ldap
|
||||||
|
|
||||||
- name: remove exim4 package
|
- name: remove exim4 package
|
||||||
apt:
|
apt:
|
||||||
name: exim4
|
name: exim4
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: copy main.cf
|
- name: copy postfix config
|
||||||
template:
|
template:
|
||||||
src: main.cf.j2
|
src: "{{ item.src }}"
|
||||||
dest: /etc/postfix/main.cf
|
dest: "{{ item.dest }}"
|
||||||
notify:
|
with_items:
|
||||||
- restart postfix
|
- { src: "main.cf.j2", dest: "/etc/postfix/main.cf" }
|
||||||
|
- { src: "master.cf.j2", dest: "/etc/postfix/master.cf" }
|
||||||
- name: copy master.cf
|
- { src: "virtual-senders.cf.j2", dest: "/etc/postfix/virtual-senders.cf" }
|
||||||
template:
|
- { src: "virtual-recipients.cf.j2", dest: "/etc/postfix/virtual-recipients.cf" }
|
||||||
src: master.cf.j2
|
|
||||||
dest: /etc/postfix/master.cf
|
|
||||||
notify:
|
notify:
|
||||||
- restart postfix
|
- restart postfix
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,13 @@ dovecot_destination_recipient_limit = 1
|
||||||
virtual_transport = dovecot
|
virtual_transport = dovecot
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if postfix.ldap.enable %}
|
||||||
|
# LDAP config
|
||||||
|
smtpd_sender_login_maps = proxy:ldap:/etc/postfix/virtual-senders.cf
|
||||||
|
virtual_mailbox_maps = proxy:ldap:/etc/postfix/virtual-recipients.cf
|
||||||
|
local_recipient_maps = $virtual_mailbox_maps
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# opendkim
|
# opendkim
|
||||||
|
|
||||||
{% if postfix.enable_opendkim %}
|
{% if postfix.enable_opendkim %}
|
||||||
|
|
|
||||||
12
templates/virtual-recipients.cf.j2
Normal file
12
templates/virtual-recipients.cf.j2
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{% if postfix.ldap.enable %}
|
||||||
|
bind = yes
|
||||||
|
# bind_dn =
|
||||||
|
# bind_pw =
|
||||||
|
server_host = {{ postfix.ldap.server_host }}
|
||||||
|
search_base = {{ postfix.ldap.recipients.search_base }}
|
||||||
|
query_filter = {{ postfix.ldap.recipients.query_filter }}
|
||||||
|
result_attribute = cn
|
||||||
|
result_format =%s
|
||||||
|
{% else %}
|
||||||
|
# LDAP is not configured for this server.
|
||||||
|
{% endif %}
|
||||||
11
templates/virtual-senders.cf.j2
Normal file
11
templates/virtual-senders.cf.j2
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{% if postfix.ldap.enable %}
|
||||||
|
bind = yes
|
||||||
|
# bind_dn =
|
||||||
|
# bind_pw =
|
||||||
|
server_host = {{ postfix.ldap.server_host }}
|
||||||
|
search_base = {{ postfix.ldap.senders.search_base }}
|
||||||
|
query_filter = {{ postfix.ldap.senders.query_filter }}
|
||||||
|
result_attribute = cn
|
||||||
|
{% else %}
|
||||||
|
# LDAP is not configured for this server.
|
||||||
|
{% endif %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue