Serving XML-RPC over HTTPS with Python
We've been talking about how to manage pygr resources remotely via the existing XML-RPC interface, and for that HTTPS is a requirement. I offered to track down the code necessary for running an XML-RPC server over HTTPS. Here's what I found:
It turns out that while the Python stdlib supports HTTPS client
connections (connecting to https:// URLs), it does not directly support
HTTPS serving. To do that, you need to use pyOpenSSL. However, once
that's installed it's a breeze: it's as simple as this,
server = SecureXMLRPCServer(server_address, KEYFILE, CERTFILE)
You can download the SecureXMLRPCServer code and an example here:
http://iorich.caltech.edu/~t/transfer/xmlrpc-https.tar.gz
To run it just install pyOpenSSL ('python-openssl' under Debian),
and then execute 'python serve-ssl.py' in one shell and 'python
test-conn-ssl.py' in another.
Thanks to Laszlo Nagy for his Python Cookbook recipe which only needed a bit of fixing (for Python 2.5) and refactoring (for reusability).
The example .tar.gz above contains a private key and certification so that the code Just Works.
--titus
p.s. Ping me at titus@idyll.org if the .tar.gz file isn't accessible and I'll repost it.
FOAF updates: Trust rankings are now exported, making the data available to other users and websites. An external FOAF URI has been added, allowing users to link to an additional FOAF file.
Keep up with the latest Advogato features by reading the Advogato status blog.
If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!