extras-buildsys/client CONFIG.py,1.1,1.2 buildclient.py,1.2,1.3

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Thu Jun 9 01:57:37 UTC 2005


Author: dcbw

Update of /cvs/fedora/extras-buildsys/client
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15057/client

Modified Files:
	CONFIG.py buildclient.py 
Log Message:
2005-06-08  Dan Williams <dcbw at redhat.com>

    * Convert all client/server communication to SSL.  You will now need certificates
      (see the README file for how to set them all up) to get them to talk to each
      other.  Now requires m2crypto module as well.




Index: CONFIG.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/client/CONFIG.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CONFIG.py	7 Jun 2005 12:10:22 -0000	1.1
+++ CONFIG.py	9 Jun 2005 01:57:35 -0000	1.2
@@ -5,6 +5,12 @@
 config_opts['distro_name'] = "fedora"
 config_opts['repo_name'] = "core"
 
+# SSL Certs and keys
+# MUST be full path to cert
+config_opts['client_cert'] = "/work/fedora-cvs/extras-buildsys/client/certs/client_cert.pem"
+config_opts['client_key'] = "/work/fedora-cvs/extras-buildsys/client/certs/client_key.pem"
+config_opts['ca_cert'] = "/work/fedora-cvs/extras-buildsys/client/certs/ca_cert.pem"
+
 # Where to keep SRPMs to build and the finished products
 # and logs.
 # WARNING: this directory is world-readable via HTTP!


Index: buildclient.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/client/buildclient.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- buildclient.py	8 Jun 2005 15:55:51 -0000	1.2
+++ buildclient.py	9 Jun 2005 01:57:35 -0000	1.3
@@ -30,8 +30,9 @@
 import time
 import urllib
 import CONFIG
-import FileServer
+import SimpleHTTPSServer
 import FileDownloader
+import SimpleSSLXMLRPCServer
 
 DEBUG = False
 def debugprint(stuff=''):
@@ -42,6 +43,9 @@
     print stuff
 
 g_our_hostname = None
+client_cert = CONFIG.get('client_cert')
+client_key = CONFIG.get('client_key')
+ca_cert = CONFIG.get('ca_cert')
 
 
 def get_url_for_file(file_path):
@@ -51,7 +55,7 @@
     if not file_path.startswith(CONFIG.get("client_work_dir")):
         return None
     file_part = file_path[len(CONFIG.get("client_work_dir")) + 1:]
-    full_url = "http://" + g_our_hostname + ":8889/" + file_part
+    full_url = "https://" + g_our_hostname + ":8889/" + file_part
     return urllib.quote(full_url)
 
 
@@ -89,7 +93,8 @@
     def _download_srpm(self):
         self._status = 'downloading'
         target_dir = os.path.dirname(self._srpm_path)
-        dl_thread = FileDownloader.FileDownloader(self.dl_callback, self._srpm_url, self._srpm_url, target_dir, ['.src.rpm'])
+        dl_thread = FileDownloader.FileDownloader(self.dl_callback, self._srpm_url, self._srpm_url,
+                        target_dir, ['.src.rpm'], client_cert, client_key, ca_cert)
         dl_thread.start()
 
     def dl_callback(self, status, cb_data):
@@ -300,13 +305,6 @@
     def supported_arches(self):
         return self.localarches
 
-class MyXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer):
-    """ XMLRPC server subclass that turns on SO_REUSEADDR """
-
-    def __init__(self, address):
-        self.allow_reuse_address = 1
-        SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(self, addr=address, logRequests=False)
-
 
 if __name__ == '__main__':
     if len(sys.argv) < 3:
@@ -331,13 +329,15 @@
 
     print "Binding to address '%s' with arches: [%s]" % (g_our_hostname, string.join(localarches))
 
-    xmlserver = MyXMLRPCServer((g_our_hostname, 8888))
+    xmlserver = SimpleSSLXMLRPCServer.SimpleSSLXMLRPCServer(client_cert, client_key,
+            ca_cert, (g_our_hostname, 8888))
     bcs = XMLRPCBuildClientServer(localarches)
     xmlserver.register_instance(bcs)
 
     # Start up the HTTP server thread which the build server
     # pulls completed RPMs from
-    http_server = FileServer.FileServer((g_our_hostname, 8889), CONFIG.get('client_work_dir'))
+    http_server = SimpleHTTPSServer.SimpleHTTPSServer(client_cert, client_key, ca_cert,
+            (g_our_hostname, 8889), CONFIG.get('client_work_dir'))
     http_server.start()
 
     last_time = time.time()




More information about the fedora-extras-commits mailing list