summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-08 13:04:00 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-08 13:04:57 +0100
commit75fc437a35647c3945999e3781b7aca991766e7c (patch)
tree66733e3a2a62d9c08215e6f3e3a457059d85d466 /pykolab
parentdf3a212a99ae0e4b250519f9e4fc274e772699bc (diff)
downloadpykolab-75fc437a35647c3945999e3781b7aca991766e7c.tar.gz
Add amavisd configuration to setup_mta
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_mta.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index c305267..ebcca2f 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -249,7 +249,37 @@ result_attribute = mail
log.error(_("Could not write out Postfix configuration file /etc/postfix/master.cf"))
return
- subprocess.call(['/etc/pki/tls/certs/make-dummy-cert', '/etc/pki/tls/private/localhost.pem'])
+ amavisd_settings = {
+ 'ldap_server': 'localhost',
+ 'ldap_bind_dn': conf.get('ldap', 'service_bind_dn'),
+ 'ldap_bind_pw': conf.get('ldap', 'service_bind_pw'),
+ 'primary_domain': conf.get('kolab', 'primary_domain'),
+ 'ldap_filter': "(|(mail=%m)(alias=%m))",
+ 'ldap_base_dn': conf.get('ldap', 'base_dn'),
+ }
+
+ template_file = None
+
+ if os.path.isfile('/etc/kolab/templates/amavisd.conf.tpl'):
+ template_file = '/etc/kolab/templates/amavisd.conf.tpl'
+ elif os.path.isfile('/usr/share/kolab/templates/amavisd.conf.tpl'):
+ template_file = '/usr/share/kolab/templates/amavisd.conf.tpl'
+ elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'amavisd.conf.tpl'))):
+ template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'amavisd.conf.tpl'))
+
+ if not template_file == None:
+ fp = open(template_file, 'r')
+ template_definition = fp.read()
+ fp.close()
+
+ t = Template(template_definition, searchList=[amavisd_settings])
+ fp = open('/etc/amavisd/amavisd.conf', 'w')
+ fp.write(t.__str__())
+ fp.close()
+
+ else:
+ log.error(_("Could not write out Amavis configuration file /etc/amavisd/amavisd.conf"))
+ return
if os.path.isfile('/bin/systemctl'):
subprocess.call(['systemctl', 'restart', 'postfix.service'])