summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-01-19 12:05:46 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-01-19 12:05:46 +0100
commita795db5c2d1fcf0f052f2c3c750daec6c2ac4bfe (patch)
tree73209e426fe9625fcbaf344dd90ce11a52c1b5c1
parent326886c3923f71e6495a07c0d439553d41488bf4 (diff)
downloadpykolab-a795db5c2d1fcf0f052f2c3c750daec6c2ac4bfe.tar.gz
Swap default IMAP interface from Cyrus IMAP to Guam
-rw-r--r--pykolab/Makefile.am1
-rw-r--r--pykolab/setup/setup_guam.py64
-rw-r--r--share/templates/cyrus.conf.tpl25
-rw-r--r--share/templates/guam.sys.config.tpl78
4 files changed, 150 insertions, 18 deletions
diff --git a/pykolab/Makefile.am b/pykolab/Makefile.am
index 97caa5b..95d0e08 100644
--- a/pykolab/Makefile.am
+++ b/pykolab/Makefile.am
@@ -71,6 +71,7 @@ pykolab_setupdir = $(pythondir)/$(PACKAGE)/setup
pykolab_setup_PYTHON = \
setup/components.py \
setup/setup_freebusy.py \
+ setup/setup_guam.py \
setup/setup_imap.py \
setup/setup_kolabd.py \
setup/setup_ldap.py \
diff --git a/pykolab/setup/setup_guam.py b/pykolab/setup/setup_guam.py
new file mode 100644
index 0000000..6a23527
--- /dev/null
+++ b/pykolab/setup/setup_guam.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+# Copyright 2010-2016 Kolab Systems AG (http://www.kolabsys.com)
+#
+# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import os
+import shutil
+import subprocess
+import sys
+import time
+
+import components
+
+import pykolab
+
+from pykolab import utils
+from pykolab.constants import *
+from pykolab.translate import _
+
+log = pykolab.getLogger('pykolab.setup')
+conf = pykolab.getConf()
+
+def __init__():
+ components.register('guam', execute, description=description())
+
+def description():
+ return _("Setup Guam.")
+
+def execute(*args, **kw):
+ if not os.path.isfile('/etc/guam/sys.config'):
+ log.error(_("Guam is not installed on this system"))
+ return
+
+ if os.path.isfile('/etc/kolab/templates/guam.sys.config.tpl'):
+ template = '/etc/kolab/templates/guam.sys.config.tpl'
+ else:
+ template = '/usr/share/kolab/templates/guam.sys.config.tpl'
+
+ shutil.copyfile(template, '/etc/guam/sys.config')
+
+ if os.path.isfile('/bin/systemctl'):
+ subprocess.call(['/bin/systemctl', 'restart', 'guam'])
+ else:
+ log.error(_("Could not start the guam service."))
+
+ if os.path.isfile('/bin/systemctl'):
+ subprocess.call(['/bin/systemctl', 'enable', 'guam'])
+ else:
+ log.error(_("Could not configure the guam service to start on boot"))
+
diff --git a/share/templates/cyrus.conf.tpl b/share/templates/cyrus.conf.tpl
index 9a4a17a..3118aab 100644
--- a/share/templates/cyrus.conf.tpl
+++ b/share/templates/cyrus.conf.tpl
@@ -2,33 +2,22 @@
START {
# do not delete this entry!
- recover cmd="ctl_cyrusdb -r"
+ recover cmd="ctl_cyrusdb -r"
- # this is only necessary if using idled for IMAP IDLE
- idled cmd="idled"
+ idled cmd="idled"
}
# UNIX sockets start with a slash and are put into /var/lib/imap/sockets
SERVICES {
- # add or remove based on preferences
- imap cmd="imapd" listen="imap" prefork=5
- imaps cmd="imapd -s" listen="imaps" prefork=1
- pop3 cmd="pop3d" listen="pop3" prefork=3
- pop3s cmd="pop3d -s" listen="pop3s" prefork=1
- sieve cmd="timsieved" listen="sieve" prefork=0
+ imaps cmd="imapd -s" listen="127.0.0.1:9993" prefork=5
- ptloader cmd="ptloader" listen="/var/lib/imap/ptclient/ptsock" prefork=0
+ sieve cmd="timsieved" listen="sieve" prefork=0
- # these are only necessary if receiving/exporting usenet via NNTP
- #nntp cmd="nntpd" listen="nntp" prefork=3
- #nntps cmd="nntpd -s" listen="nntps" prefork=1
+ ptloader cmd="ptloader" listen="/var/lib/imap/ptclient/ptsock" prefork=0
- # at least one LMTP is required for delivery
- #lmtp cmd="lmtpd" listen="lmtp" prefork=0
- lmtpunix cmd="lmtpd" listen="/var/lib/imap/socket/lmtp" prefork=1
+ lmtpunix cmd="lmtpd" listen="/var/lib/imap/socket/lmtp" prefork=1
- # this is only necessary if using notifications
- notify cmd="notifyd" listen="/var/lib/imap/socket/notify" proto="udp" prefork=1
+ notify cmd="notifyd" listen="/var/lib/imap/socket/notify" proto="udp" prefork=1
}
EVENTS {
diff --git a/share/templates/guam.sys.config.tpl b/share/templates/guam.sys.config.tpl
new file mode 100644
index 0000000..2ad9456
--- /dev/null
+++ b/share/templates/guam.sys.config.tpl
@@ -0,0 +1,78 @@
+%% Example configuration for Guam.
+[
+ {
+ kolab_guam, [
+ {
+ imap_servers, [
+ {
+ imaps, [
+ { host, "127.0.0.1" },
+ { port, 9993 },
+ { tls, true }
+ ]
+ }
+ ]
+ },
+ {
+ listeners, [
+ {
+ imap, [
+ { port, 143 },
+ { imap_server, imap },
+ {
+ rules, [
+ { filter_groupware, [] }
+ ]
+ },
+ {
+ tls_config, [
+ { certfile, "/etc/pki/cyrus-imapd/cyrus-imapd.pem" }
+ ]
+ }
+ ]
+ },
+ {
+ imaps, [
+ { port, 993 },
+ { implicit_tls, true },
+ { imap_server, imaps },
+ {
+ rules, [
+ { filter_groupware, [] }
+ ]
+ },
+ {
+ tls_config, [
+ { certfile, "/etc/pki/cyrus-imapd/cyrus-imapd.pem" }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+
+ {
+ lager, [
+ {
+ handlers, [
+ { lager_console_backend, warning },
+ { lager_file_backend, [ { file, "log/error.log"}, { level, error } ] },
+ { lager_file_backend, [ { file, "log/console.log"}, { level, info } ] }
+ ]
+ }
+ ]
+ },
+
+ %% SASL config
+ {
+ sasl, [
+ { sasl_error_logger, { file, "log/sasl-error.log" } },
+ { errlog_type, error },
+ { error_logger_mf_dir, "log/sasl" }, % Log directory
+ { error_logger_mf_maxbytes, 10485760 }, % 10 MB max file size
+ { error_logger_mf_maxfiles, 5 } % 5 files max
+ ]
+ }
+].