From 742fe48a29e55e0200700ee5438e9e1007b4c547 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalpati Date: Wed, 1 Mar 2017 19:23:18 +0530 Subject: [PATCH] diaspora: Disabled SSL Created a custom command in Plinth to disable ssl for the diaspora pod on the freedombox. --- actions/diaspora | 17 +++++++++++------ .../apache2/conf-available/diaspora-plinth.conf | 9 ++++++++- plinth/modules/diaspora/__init__.py | 4 ++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/actions/diaspora b/actions/diaspora index 3a1adff51..d6ca8baf4 100755 --- a/actions/diaspora +++ b/actions/diaspora @@ -36,18 +36,23 @@ def parse_arguments(): 'pre-install', help='Preseed debconf values before packages are installed.') - # Preseed debconf values before packages are installed. - - # pre_install.add_argument( - # '--thirdpartyservices', - # help='Third party services enabled: Facebook, Twitter, Tumblr, Wordpress') - subparsers.add_parser('enable', help='Enable diaspora*') subparsers.add_parser('disable', help='Disable diaspora*') + subparsers.add_parser('disable-ssl', help="Disable SSL on the diaspora* application server") return parser.parse_args() +def subcommand_disable_ssl(_): + """ + Disable ssl in the diaspora configuration + as the apache server takes care of ssl + """ + subprocess.call(["sed", "-i", + "s/#require_ssl: true/require_ssl: false/g", + "/etc/diaspora/diaspora.yml"]) + + def subcommand_pre_install(arguments): """Pre installation configuration for diaspora""" presets= [ diff --git a/data/etc/apache2/conf-available/diaspora-plinth.conf b/data/etc/apache2/conf-available/diaspora-plinth.conf index 3e75a029d..a59aa8a18 100644 --- a/data/etc/apache2/conf-available/diaspora-plinth.conf +++ b/data/etc/apache2/conf-available/diaspora-plinth.conf @@ -1,3 +1,10 @@ -Location "/diaspora"> + ProxyPass "unix:/var/run/diaspora/diaspora.sock|http://localhost" + +# TODO This is temporary. Remove this + + ProxyPass "unix:/var/run/diaspora/diaspora.sock|http://freedombox/podmin" + + +Alias "/assets" "/usr/share/diaspora/public/assets" \ No newline at end of file diff --git a/plinth/modules/diaspora/__init__.py b/plinth/modules/diaspora/__init__.py index 1abf3eca3..1c381eca6 100644 --- a/plinth/modules/diaspora/__init__.py +++ b/plinth/modules/diaspora/__init__.py @@ -15,6 +15,8 @@ # along with this program. If not, see . # +import subprocess + from django.utils.translation import ugettext_lazy as _ from plinth import actions, action_utils, cfg, frontpage, service as service_module @@ -65,6 +67,7 @@ def setup(helper, old_version=None): """Install and configure the module.""" helper.call('pre', actions.superuser_run, 'diaspora', ['pre-install']) helper.install(managed_packages) + helper.call('custom_config', actions.superuser_run, 'diaspora', ['disable-ssl']) helper.call('post', actions.superuser_run, 'diaspora', ['enable']) global service if service is None: @@ -81,6 +84,7 @@ def setup(helper, old_version=None): def add_shortcut(): + """Add shortcut to diaspora on the Plinth homepage""" frontpage.add_shortcut( 'diaspora', title, url='/diaspora', login_required=True)