[CalendarServer-changes] [8932] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 27 12:16:30 PDT 2012
Revision: 8932
http://trac.macosforge.org/projects/calendarserver/changeset/8932
Author: sagen at apple.com
Date: 2012-03-27 12:16:29 -0700 (Tue, 27 Mar 2012)
Log Message:
-----------
Add manhole access, remove APNS auth mechanism filtering
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/caldav.py
CalendarServer/trunk/calendarserver/tap/util.py
CalendarServer/trunk/twistedcaldav/stdconfig.py
Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py 2012-03-27 19:14:39 UTC (rev 8931)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py 2012-03-27 19:16:29 UTC (rev 8932)
@@ -50,6 +50,8 @@
from twisted.application.service import MultiService, IServiceMaker
from twisted.application.service import Service
+from twisted.conch.manhole_tap import makeService as manholeMakeService
+
import twext
from twext.web2.server import Site
from twext.python.log import Logger, LoggingMixIn
@@ -650,6 +652,25 @@
result = self.requestProcessingService(options, store)
if pool is not None:
pool.setServiceParent(result)
+
+ # Optionally enable Manhole access
+ if config.Manhole.Enabled:
+ portString = "tcp:%d:interface=127.0.0.1" % (config.Manhole.StartingPortNumber + int(config.LogID) + 1,)
+ manholeService = manholeMakeService({
+ "sshPort" : None,
+ "telnetPort" : portString,
+ "namespace" : {
+ "config" : config,
+ "service" : result,
+ "store" : store,
+ "directory" : result.rootResource.getDirectory(),
+ },
+ "passwd" : config.Manhole.PasswordFilePath,
+ })
+ manholeService.setServiceParent(result)
+ # Using print because logging isn't ready at this point
+ print "Manhole access enabled: %s" % (portString,)
+
return result
@@ -702,6 +723,7 @@
service = CalDAVService(logObserver)
rootResource = getRootResource(config, store, additional)
+ service.rootResource = rootResource
underlyingSite = Site(rootResource)
@@ -1116,6 +1138,22 @@
statsService.setName("stats")
statsService.setServiceParent(s)
+ # Optionally enable Manhole access
+ if config.Manhole.Enabled:
+ portString = "tcp:%d:interface=127.0.0.1" % (config.Manhole.StartingPortNumber,)
+ manholeService = manholeMakeService({
+ "sshPort" : None,
+ "telnetPort" : portString,
+ "namespace" : {
+ "config" : config,
+ "service" : s,
+ },
+ "passwd" : config.Manhole.PasswordFilePath,
+ })
+ manholeService.setServiceParent(s)
+ # Using print because logging isn't ready at this point
+ print "Manhole access enabled: %s" % (portString,)
+
# Finally, let's get the real show on the road. Create a service that
# will spawn all of our worker processes when started, and wrap that
# service in zero to two necessary layers before it's started: first,
Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py 2012-03-27 19:14:39 UTC (rev 8931)
+++ CalendarServer/trunk/calendarserver/tap/util.py 2012-03-27 19:16:29 UTC (rev 8932)
@@ -645,14 +645,10 @@
#
apnConfig = config.Notifications.Services["ApplePushNotifier"]
if apnConfig.Enabled:
- log.info("Setting up APNS resource at /%s with auth: %s" %
- (apnConfig["SubscriptionURL"], apnConfig["AuthMechanisms"]))
- resources.append((
- apnConfig["SubscriptionURL"],
- apnSubscriptionResourceClass,
- [],
- apnConfig["AuthMechanisms"]
- ))
+ log.info("Setting up APNS resource at /%s" %
+ (apnConfig["SubscriptionURL"],))
+ apnResource = apnSubscriptionResourceClass(root, newStore)
+ root.putChild(apnConfig["SubscriptionURL"], apnResource)
#
# Configure ancillary data
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2012-03-27 19:14:39 UTC (rev 8931)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2012-03-27 19:16:29 UTC (rev 8932)
@@ -696,7 +696,6 @@
"Service" : "calendarserver.push.applepush.ApplePushNotifierService",
"Enabled" : False,
"SubscriptionURL" : "apns",
- "AuthMechanisms" : [],
"DataHost" : "",
"ProviderHost" : "gateway.push.apple.com",
"ProviderPort" : 2195,
@@ -894,6 +893,12 @@
"UseExternalProxies" : False,
},
+ "Manhole": {
+ "Enabled": False,
+ "StartingPortNumber": 5000,
+ "PasswordFilePath": "",
+ },
+
"EnableKeepAlive": False,
"EnableResponseCache": True,
@@ -1289,17 +1294,6 @@
if service["DataHost"] == "":
service["DataHost"] = configDict.ServerHostName
- # Advertise Basic and/or Digest on subscription resource
- if not service["AuthMechanisms"]:
- authMechanisms = []
- if configDict.Authentication.Basic.Enabled:
- authMechanisms.append("basic")
- if configDict.Authentication.Digest.Enabled:
- authMechanisms.append("digest")
- if not authMechanisms:
- raise ConfigurationError("Must have either 'basic' or 'digest' enabled for Apple Push Notifications.")
- service["AuthMechanisms"] = authMechanisms
-
# Retrieve APN topics from certificates if not explicitly set
for protocol, accountName in (
("CalDAV", "apns:com.apple.calendar"),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120327/ab5e0bce/attachment-0001.html>
More information about the calendarserver-changes
mailing list