From bd2c5bdff98e4ef73ee7d3f756c6d2bfafde06d0 Mon Sep 17 00:00:00 2001 From: flan Date: Sat, 28 Oct 2017 05:50:18 +0200 Subject: [PATCH] Remove SSL support If there's a need for SSL, you can always use a reverse proxy or a more advanced WSGI server. This reverts commit 1678890d3dd0bd1c169c1bcffd83b398e2e1eee5. --- README.md | 7 ++----- ankisyncd.conf | 3 --- ankisyncd/sync_app.py | 20 ++++++-------------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 560cba5..b32cc2b 100644 --- a/README.md +++ b/README.md @@ -21,14 +21,13 @@ this is just a matter of: install some of the dependencies we need there: $ virtualenv ankisyncd.env - $ ankisyncd.env/bin/easy_install webob simplejson eventlet + $ ankisyncd.env/bin/easy_install webob simplejson 3. Patch the bundled libanki: $ ./patch_libanki.sh -4. Copy the example.ini to production.ini and edit for your needs. Warning: If - you disable SSL, login credentials will be transported in plain text! +4. Copy the example.ini to production.ini and edit for your needs. 5. Create authentication database: @@ -53,11 +52,9 @@ To make Anki use ankisyncd as its sync server, create a file (name it something like ankisyncd.py) containing the code below and put it in ~/Anki/addons. import anki.sync - import httplib2 anki.sync.SYNC_BASE = 'http://127.0.0.1:27701/' anki.sync.SYNC_MEDIA_BASE = 'http://127.0.0.1:27701/msync/' - anki.sync.httpCon = lambda: httplib2.Http() Replace 127.0.0.1 with the IP address or the domain name of your server if ankisyncd is not running on the same machine as Anki. diff --git a/ankisyncd.conf b/ankisyncd.conf index a6c8bc3..b0c53eb 100644 --- a/ankisyncd.conf +++ b/ankisyncd.conf @@ -1,9 +1,6 @@ [sync_app] host = 127.0.0.1 port = 27701 -ssl = true -certfile = /etc/ssl/certs/server.pem -keyfile = /etc/ssl/private/privkey.pem data_root = ./collections base_url = /sync/ base_media_url = /msync/ diff --git a/ankisyncd/sync_app.py b/ankisyncd/sync_app.py index e27ae71..6b7a9b2 100644 --- a/ankisyncd/sync_app.py +++ b/ankisyncd/sync_app.py @@ -739,28 +739,20 @@ def make_app(global_conf, **local_conf): return SyncApp(**local_conf) def main(): - from eventlet import wsgi,wrap_ssl,listen + from wsgiref.simple_server import make_server from ankisyncd.thread import shutdown config = SafeConfigParser() config.read("ankisyncd.conf") ankiserver = SyncApp(config) - host = config.get("sync_app", "host") - port = config.getint("sync_app", "port") - - if(config.getboolean("sync_app", "ssl")): - certfile = config.get("sync_app", "certfile") - keyfile = config.get("sync_app", "keyfile") - socket = wrap_ssl( listen((host, port)), - certfile=certfile, - keyfile=keyfile, - server_side=True ) - else: - socket = listen((host, port)) + httpd = make_server('', config.getint("sync_app", "port"), ankiserver) try: - wsgi.server(socket, ankiserver) + print "Starting..." + httpd.serve_forever() + except KeyboardInterrupt: + print "Exiting ..." finally: shutdown()