[CalendarServer-changes] [14685] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 17 11:33:09 PDT 2015


Revision: 14685
          http://trac.calendarserver.org//changeset/14685
Author:   sagen at apple.com
Date:     2015-04-17 11:33:09 -0700 (Fri, 17 Apr 2015)
Log Message:
-----------
Post an alert if TLS Cert is missing

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tap/util.py
    CalendarServer/trunk/conf/caldavd-apple.plist
    CalendarServer/trunk/twistedcaldav/stdconfig.py

Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py	2015-04-17 18:32:48 UTC (rev 14684)
+++ CalendarServer/trunk/calendarserver/tap/util.py	2015-04-17 18:33:09 UTC (rev 14685)
@@ -1254,6 +1254,7 @@
                     cert=config.SSLCertificate
                 )
             )
+            postAlert("MissingCertificateAlert", ["path", config.SSLCertificate])
             return False, message
     else:
         return True, "TLS disabled"
@@ -1406,3 +1407,23 @@
                 return output.strip()
 
     return None
+
+
+def postAlert(alertType, args):
+    if (
+        config.AlertPostingProgram and
+        os.path.exists(config.AlertPostingProgram)
+    ):
+        try:
+            commandLine = [config.AlertPostingProgram, alertType]
+            commandLine.extend(args)
+            Popen(
+                commandLine,
+                stdout=PIPE,
+                stderr=PIPE,
+            ).communicate()
+        except Exception, e:
+            log.error(
+                "Could not post alert: {alertType} {args} ({error})",
+                alertType=alertType, args=args, error=e
+            )

Modified: CalendarServer/trunk/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-apple.plist	2015-04-17 18:32:48 UTC (rev 14684)
+++ CalendarServer/trunk/conf/caldavd-apple.plist	2015-04-17 18:33:09 UTC (rev 14685)
@@ -555,6 +555,13 @@
       <true/>
     </dict>
 
+    <!-- Alert-posting program
+      -->
+    <key>AlertPostingProgram</key>
+    <string>/Applications/Server.app/Contents/ServerRoot/Library/CalendarServer/bin/calendarserver_alert</string>
+
+    <!-- Includes of other plists
+      -->
     <key>Includes</key>
     <array>
         <string>/Library/Preferences/com.apple.servermgr_calendar.plist</string>

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2015-04-17 18:32:48 UTC (rev 14684)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2015-04-17 18:33:09 UTC (rev 14685)
@@ -1078,6 +1078,10 @@
     # respawning it.  Empty string to disable this feature.
     "ServiceDisablingProgram": "",
 
+    # Program to execute to post an alert to the administrator; for example in
+    # OS X we want to call calendarserver_alert <alert-type> <args>
+    "AlertPostingProgram": "",
+
     # These three keys are relative to ConfigRoot:
 
     # Config to read first and merge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150417/0ae658a4/attachment-0001.html>


More information about the calendarserver-changes mailing list