summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-04-14 13:17:21 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-04-14 13:17:21 +0200
commit207b26fe0ccde43572ab53b0f139b90dab759d5a (patch)
tree424a1d21a286534bd6d2fa9985bf0f5355f4f921 /pykolab
parent2f989a0b931b78cb0a4e5696d1b8393c32012778 (diff)
downloadpykolab-207b26fe0ccde43572ab53b0f139b90dab759d5a.tar.gz
Enable delivery to shared folders
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_mta.py37
1 files changed, 34 insertions, 3 deletions
diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 35df4fb..d50217f 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -52,6 +52,8 @@ def execute(*args, **kw):
resource_filter = conf.get('ldap', 'resource_filter')
+ sharedfolder_filter = conf.get('ldap', 'sharedfolder_filter')
+
server_host = utils.parse_ldap_uri(conf.get('ldap', 'ldap_uri'))[1]
files = {
@@ -67,7 +69,7 @@ domain = ldap:/etc/postfix/ldap/mydestination.cf
bind_dn = %(service_bind_dn)s
bind_pw = %(service_bind_pw)s
-query_filter = (&(|(mail=%%s)(alias=%%s))(|%(kolab_user_filter)s%(kolab_group_filter)s%(resource_filter)s))
+query_filter = (&(|(mail=%%s)(alias=%%s))(|%(kolab_user_filter)s%(kolab_group_filter)s%(resource_filter)s%(sharedfolder_filter)s))
result_attribute = mail
""" % {
"base_dn": conf.get('ldap', 'base_dn'),
@@ -77,6 +79,7 @@ result_attribute = mail
"kolab_user_filter": user_filter,
"kolab_group_filter": group_filter,
"resource_filter": resource_filter,
+ "sharedfolder_filter": sharedfolder_filter,
},
"/etc/postfix/ldap/mydestination.cf": """
server_host = %(server_host)s
@@ -189,6 +192,27 @@ result_attribute = mail
"service_bind_dn": conf.get('ldap', 'service_bind_dn'),
"service_bind_pw": conf.get('ldap', 'service_bind_pw'),
},
+ "/etc/postfix/ldap/virtual_alias_maps_sharedfolders.cf": """
+server_host = %(server_host)s
+server_port = 389
+version = 3
+search_base = %(base_dn)s
+scope = sub
+
+domain = ldap:/etc/postfix/ldap/mydestination.cf
+
+bind_dn = %(service_bind_dn)s
+bind_pw = %(service_bind_pw)s
+
+query_filter = (&(|(mail=%%s)(alias=%%s))(objectclass=kolabsharedfolder))
+result_attribute = kolabtargetfolder
+result_format = shared+%%s
+""" % {
+ "base_dn": conf.get('ldap', 'base_dn'),
+ "server_host": server_host,
+ "service_bind_dn": conf.get('ldap', 'service_bind_dn'),
+ "service_bind_pw": conf.get('ldap', 'service_bind_pw'),
+ },
}
if not os.path.isdir('/etc/postfix/ldap'):
@@ -199,12 +223,19 @@ result_attribute = mail
fp.write(files[filename])
fp.close()
+ fp = open('/etc/postfix/transport', 'a')
+ fp.write("\n# Shared Folder Delivery for %(domain)s:\nshared@%(domain)s\t\tlmtp:unix:/var/lib/imap/socket/lmtp\n" % {'domain': conf.get('kolab', 'primary_domain')})
+ fp.close()
+
+ subprocess.call(["postmap", "/etc/postfix/transport"])
+
postfix_main_settings = {
"inet_interfaces": "all",
+ "recipient_delimiter": "+",
"local_recipient_maps": "ldap:/etc/postfix/ldap/local_recipient_maps.cf",
"mydestination": "ldap:/etc/postfix/ldap/mydestination.cf",
- "transport_maps": "ldap:/etc/postfix/ldap/transport_maps.cf",
- "virtual_alias_maps": "$alias_maps, ldap:/etc/postfix/ldap/virtual_alias_maps.cf, ldap:/etc/postfix/ldap/mailenabled_distgroups.cf, ldap:/etc/postfix/ldap/mailenabled_dynamic_distgroups.cf",
+ "transport_maps": "ldap:/etc/postfix/ldap/transport_maps.cf, hash:/etc/postfix/transport",
+ "virtual_alias_maps": "$alias_maps, ldap:/etc/postfix/ldap/virtual_alias_maps.cf, ldap:/etc/postfix/ldap/virtual_alias_maps_sharedfolders.cf, ldap:/etc/postfix/ldap/mailenabled_distgroups.cf, ldap:/etc/postfix/ldap/mailenabled_dynamic_distgroups.cf",
"smtpd_tls_auth_only": "yes",
"smtpd_sasl_auth_enable": "yes",
"smtpd_sender_login_maps": "$relay_recipient_maps",