Friday, February 4, 2011

Enabling SSL with Python on Cygwin (secures Google App Engine's appcfg.py tool)

I prefer to run the dev_appserver through Cygwin, which works great, but appcfg complains:
WARNING appengine_rpc.py:399 ssl module not found. Without the ssl module, the identity of the remote host cannot be verified, and connections may NOT be secure. To fix this, please install the ssl module from http://pypi.python.org/pypi/ssl
I tried to fix this last summer, but didn't get anywhere on Cygwin and gave up after a few hours.  Instead,  I was able to install the ssl module on my Windows installation of python (not Cygwin) and have been using the App Engine Launcher (Windows client) to deploy my apps.

Today I decided to give try again on Cygwin.  To my surprise, the solution turned out to be very simple, but I only realized this after I messed up my Cygwin installation and had to run setup.exe about fifty times with different settings before I fixed it.

So here is the process:

1. download the ssl-1.15.tar.gz from http://pypi.python.org/pypi/ssl and extract the archive
2. > cd ssl-1.15
3. > python setup.py build


If the build fails, complaining about some OpenSSL-related stuff missing, just run Cygwin's setup.exe and install the openssl-devel package (make sure you get the same version as your libopenssl package, which you will also need, by the way).  Now the build should succeed.

4. > python setup.py install

That should do the trick.  

Be careful: do not run the install command until the build command runs successfully and until you make sure that you have the same version of the libopenssl and openssl-devel packages in your Cygwin installation.