3 commits - bin/kolab_smtp_access_policy.py pykolab/logger.py share/templates

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Mon May 28 14:53:39 CEST 2012


 bin/kolab_smtp_access_policy.py |   12 ++++++++++++
 pykolab/logger.py               |   26 ++++++++++++++++++++++++++
 share/templates/cyrus.conf.tpl  |   12 +++++++++++-
 3 files changed, 49 insertions(+), 1 deletion(-)

New commits:
commit 70851f82d1d67336cde884569d37bc484361e53f
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Mon May 28 14:11:06 2012 +0200

    Introduce a timeout for requests that end prematurely and never reach the data protocol state (#780)

diff --git a/bin/kolab_smtp_access_policy.py b/bin/kolab_smtp_access_policy.py
index bc53278..ed1ce21 100755
--- a/bin/kolab_smtp_access_policy.py
+++ b/bin/kolab_smtp_access_policy.py
@@ -1222,12 +1222,18 @@ def read_request_input():
         containing the request.
     """
 
+    start_time = time.time()
+
     log.debug(_("Starting to loop for new request"))
 
     policy_request = {}
 
     end_of_request = False
     while not end_of_request:
+        if (time.time()-start_time) >= conf.timeout:
+            log.warning(_("Timeout for policy request reading exceeded"))
+            sys.exit(1)
+
         request_line = sys.stdin.readline()
         if request_line.strip() == '':
             if policy_request.has_key('request'):
@@ -1268,6 +1274,12 @@ if __name__ == "__main__":
             _("Access Policy Options")
         )
 
+    access_policy_group.add_option(  "--timeout",
+                            dest    = "timeout",
+                            action  = "store",
+                            default = 10,
+                            help    = _("SMTP Policy request timeout."))
+
     access_policy_group.add_option(  "--verify-recipient",
                             dest    = "verify_recipient",
                             action  = "store_true",


commit 3b3d2b56a880e9ce08a3bb1279860d4dc6eed069
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri May 25 16:37:54 2012 +0100

    Make sure squatter runs regularly (#801)

diff --git a/share/templates/cyrus.conf.tpl b/share/templates/cyrus.conf.tpl
index 9d6ac0f..056c210 100644
--- a/share/templates/cyrus.conf.tpl
+++ b/share/templates/cyrus.conf.tpl
@@ -37,8 +37,18 @@ EVENTS {
 
     # this is only necessary if using duplicate delivery suppression,
     # Sieve or NNTP
-    delprune	cmd="cyr_expire -E 3" at=0400
+    duplicate_prune cmd="cyr_expire -E 3" at=0400
+
+    # Expire data older then 69 days. Two full months of 31 days
+    # each includes two full backup cycles, plus 1 week margin
+    # because we run our full backups on the first sat/sun night
+    # of each month.
+    delete_prune cmd="cyr_expire -E 4 -D 69" at=0430
+    expunge_prune cmd="cyr_expire -E 4 -X 69" at=0445
 
     # this is only necessary if caching TLS sessions
     tlsprune	cmd="tls_prune" at=0400
+
+    # Create search indexes regularly
+    squatter    cmd="squatter -s -i" at=0530
 }


commit 3c189aa376e98790ab006d16f5b61b82059ef3ad
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri May 25 08:29:13 2012 +0100

    Make sure our log file has the correct owner, group and read/write permissions

diff --git a/pykolab/logger.py b/pykolab/logger.py
index 2101866..94a84fb 100644
--- a/pykolab/logger.py
+++ b/pykolab/logger.py
@@ -17,9 +17,11 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 
+import grp
 import logging
 import logging.handlers
 import os
+import pwd
 import sys
 import time
 
@@ -82,6 +84,30 @@ class Logger(logging.Logger):
         else:
             self.logfile = '/var/log/kolab/pykolab.log'
 
+        # Make sure the log file exists
+        fhandle = file(self.logfile, 'a')
+        try:
+            os.utime(self.logfile, None)
+        finally:
+            fhandle.close()
+
+        # Make sure (read: attempt to change) the permissions
+        (ruid, euid, suid) = os.getresuid()
+        (rgid, egid, sgid) = os.getresgid()
+        if ruid == 0 or rgid == 0:
+            try:
+                os.chown(
+                        self.logfile,
+                        pwd.getpwnam('kolab')[2],
+                        grp.getgrnam('kolab-n')[2]
+                    )
+                os.chmod(self.logfile, 0660)
+            except:
+                print >> sys.stderr, \
+                        _("Could not change the ownership of log file %s") % (
+                                self.logfile
+                            )
+
         try:
             filelog_handler = logging.FileHandler(filename=self.logfile)
             filelog_handler.setFormatter(plaintextformatter)





More information about the commits mailing list