change manhole setup for client: create authorized_keys.8022 (or other portnum)
authorBrian Warner <warner@lothar.com>
Fri, 1 Dec 2006 02:34:25 +0000 (19:34 -0700)
committerBrian Warner <warner@lothar.com>
Fri, 1 Dec 2006 02:34:25 +0000 (19:34 -0700)
allmydata/client.py

index 78f7381b37828e0f10935ec8b13db50e1bb84ea7..909c55c2a19328ba63906dd0c68bbb72b26e831e 100644 (file)
@@ -15,7 +15,6 @@ class Storage(service.MultiService, Referenceable):
 
 class Client(service.MultiService, Referenceable):
     CERTFILE = "client.pem"
-    AUTHKEYSFILE = "authorized_keys"
 
     def __init__(self, queen_pburl):
         service.MultiService.__init__(self)
@@ -35,11 +34,14 @@ class Client(service.MultiService, Referenceable):
         s = Storage()
         s.setServiceParent(self)
 
-        if os.path.exists(self.AUTHKEYSFILE):
-            from allmydata import manhole
-            m = manhole.AuthorizedKeysManhole(8022, self.AUTHKEYSFILE)
-            m.setServiceParent(self)
-            log.msg("AuthorizedKeysManhole listening on 8022")
+        AUTHKEYSFILEBASE = "authorized_keys."
+        for f in os.listdir("."):
+            if f.startswith(AUTHKEYSFILEBASE):
+                portnum = int(f[len(AUTHKEYSFILEBASE):])
+                from allmydata import manhole
+                m = manhole.AuthorizedKeysManhole(portnum, f)
+                m.setServiceParent(self)
+                log.msg("AuthorizedKeysManhole listening on %d" % portnum)
 
     def _setup_tub(self, local_ip):
         portnum = 0