[CalendarServer-changes] [14204] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 8 14:34:50 PST 2014


Revision: 14204
          http://trac.calendarserver.org//changeset/14204
Author:   sagen at apple.com
Date:     2014-12-08 14:34:50 -0800 (Mon, 08 Dec 2014)
Log Message:
-----------
Allow manhole on dps server process

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/stdconfig.py
    CalendarServer/trunk/txdav/dps/server.py

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2014-12-08 22:08:17 UTC (rev 14203)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2014-12-08 22:34:50 UTC (rev 14204)
@@ -1021,6 +1021,7 @@
     "Manhole": {
         "Enabled": False,
         "StartingPortNumber": 5000,
+        "DPSPortNumber": 4999,
         "PasswordFilePath": "",
     },
 

Modified: CalendarServer/trunk/txdav/dps/server.py
===================================================================
--- CalendarServer/trunk/txdav/dps/server.py	2014-12-08 22:08:17 UTC (rev 14203)
+++ CalendarServer/trunk/txdav/dps/server.py	2014-12-08 22:34:50 UTC (rev 14204)
@@ -22,6 +22,7 @@
 from twext.python.log import Logger
 from twext.who.expression import MatchType, MatchFlags, Operand
 from twisted.application import service
+from twisted.application.service import MultiService
 from twisted.application.strports import service as strPortsService
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.internet.protocol import Factory
@@ -41,7 +42,7 @@
     WikiAccessForUIDCommand, ContinuationCommand,
     ExternalDelegatesCommand, StatsCommand, ExpandedMemberUIDsCommand,
     AddMembersCommand, RemoveMembersCommand,
-    UpdateRecordsCommand, FlushCommand, # RemoveRecordsCommand,
+    UpdateRecordsCommand, FlushCommand,  # RemoveRecordsCommand,
 )
 from txdav.who.wiki import WikiAccessLevel
 from zope.interface import implementer
@@ -820,9 +821,44 @@
 
         log.info("Created directory service")
 
-        return strPortsService(
+        dpsService = strPortsService(
             "unix:{path}:mode=660".format(
                 path=config.DirectoryProxy.SocketPath
             ),
             DirectoryProxyAMPFactory(store.directoryService())
         )
+
+        if config.Manhole.Enabled:
+            multiService = MultiService()
+            dpsService.setServiceParent(multiService)
+            try:
+                from twisted.conch.manhole_tap import (
+                    makeService as manholeMakeService
+                )
+                portString = "tcp:{:d}:interface=127.0.0.1".format(
+                    config.Manhole.DPSPortNumber
+                )
+                manholeService = manholeMakeService({
+                    "sshPort": None,
+                    "telnetPort": portString,
+                    "namespace": {
+                        "config": config,
+                        "service": dpsService,
+                        "store": store,
+                        "directory": store.directoryService(),
+                    },
+                    "passwd": config.Manhole.PasswordFilePath,
+                })
+                manholeService.setServiceParent(multiService)
+                # Using print(because logging isn't ready at this point)
+                print("Manhole access enabled:", portString)
+
+            except ImportError:
+                print(
+                    "Manhole access could not enabled because "
+                    "manhole_tap could not be imported"
+                )
+
+            return multiService
+        else:
+            return dpsService
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20141208/ae81a2d3/attachment-0001.html>


More information about the calendarserver-changes mailing list