Switch to using ad-hoc SSL
Switch to using ad-hoc SSL

We do this so that messaging metadata isn't leaked quite so much on the loopback interface

--- a/client/LocalChatClient.py
+++ b/client/LocalChatClient.py
@@ -15,6 +15,7 @@
 
 import json
 import urllib2
+import ssl
 
 import datetime as dt
 
@@ -24,7 +25,7 @@
 
 # We'll get these from the commandline later
 USER='ben2'
-SERVER='http://127.0.0.1:8090'
+SERVER='https://127.0.0.1:8090'
 ROOMNAME='BenTest'
 
 
@@ -281,8 +282,15 @@
         data = json.dumps(data)
         
         try:
+            # The cert the other end will be considered invalid
+            #
+            # Ignore it
+            ctx = ssl.create_default_context()
+            ctx.check_hostname = False
+            ctx.verify_mode = ssl.CERT_NONE
+
             req = urllib2.Request(self.server, data, {'Content-Type': 'application/json'})
-            f = urllib2.urlopen(req)
+            f = urllib2.urlopen(req,context=ctx)
             response = f.read()
             f.close()
             return json.loads(response)

--- a/server/LocalChat.py
+++ b/server/LocalChat.py
@@ -5,7 +5,8 @@
 #
 #
 # apt-get install:
-#    python-flask
+#   python-flask
+#   python-openssl
 #
 
 from flask import Flask
@@ -523,5 +524,5 @@
 if __name__ == '__main__':
     # Bind to PORT if defined, otherwise default to 8090.
     port = int(os.environ.get('PORT', 8090))
-    app.run(host='0.0.0.0', port=port,debug=True)
-
+    app.run(host='0.0.0.0', port=port,debug=True,ssl_context='adhoc')
+