From d9cc7b8cf7810c517c795210cbcb5ee539419055 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Thu, 1 Nov 2012 07:50:39 +0000 Subject: [PATCH] Now using debconf to ask for activating apache vhost, disabling default apache vhost and using ssl. Rewritten-From: 239b0fc2466f79166a9828251f2340eeb38572c1 --- xenial/debian/changelog | 2 + .../openstack-dashboard-apache-ssl.conf | 40 +++++++++++++++++++ .../debian/openstack-dashboard-apache.config | 16 ++++++++ .../openstack-dashboard-apache.postinst | 14 ++++++- .../openstack-dashboard-apache.templates | 21 ++++++++++ xenial/debian/po/POTFILES.in | 1 + xenial/debian/po/templates.pot | 39 ++++++++++++++++++ xenial/debian/rules | 1 + 8 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 xenial/debian/openstack-dashboard-apache-ssl.conf create mode 100644 xenial/debian/openstack-dashboard-apache.config create mode 100644 xenial/debian/openstack-dashboard-apache.templates create mode 100644 xenial/debian/po/POTFILES.in create mode 100644 xenial/debian/po/templates.pot diff --git a/xenial/debian/changelog b/xenial/debian/changelog index fac3995..fd6e5e0 100644 --- a/xenial/debian/changelog +++ b/xenial/debian/changelog @@ -9,6 +9,8 @@ horizon (2012.2-1) experimental; urgency=low we should ask for permission to do that using debconf). * Now writing css and js script in /var, plus we aren't doing chown www-data of all the static, but only css + js in /var. + * Now asking using debconf if we should disable the default apache vhost, + and activate the Dasboard, and if we should use SSL or not. -- Mehdi Abaakouk Sat, 29 Sep 2012 09:38:19 +0200 diff --git a/xenial/debian/openstack-dashboard-apache-ssl.conf b/xenial/debian/openstack-dashboard-apache-ssl.conf new file mode 100644 index 0000000..c9927ce --- /dev/null +++ b/xenial/debian/openstack-dashboard-apache-ssl.conf @@ -0,0 +1,40 @@ + + ServerAdmin webmaster@localhost + SSLEngine on + SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem + SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi + WSGIDaemonProcess horizon user=www-data group=www-data + #WSGIProcessGroup openstack-dashboard + Alias /static /usr/share/openstack-dashboard/openstack_dashboard/static + + DocumentRoot /var/www + + + AllowOverride None + + + + Order allow,deny + Allow from all + + + + Order allow,deny + Allow from all + + + + Order allow,deny + Allow from all + + + ErrorLog ${APACHE_LOG_DIR}/error.log + LogLevel warn + CustomLog ${APACHE_LOG_DIR}/access.log combined + diff --git a/xenial/debian/openstack-dashboard-apache.config b/xenial/debian/openstack-dashboard-apache.config new file mode 100644 index 0000000..76b4bb2 --- /dev/null +++ b/xenial/debian/openstack-dashboard-apache.config @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +db_input high horizon/activate_vhost || true +db_go || true + +db_get horizon/activate_vhost +if [ "${RET}" = "true" ] ; then + db_input high horizon/use_ssl || true + db_go || true +fi + +exit 0 diff --git a/xenial/debian/openstack-dashboard-apache.postinst b/xenial/debian/openstack-dashboard-apache.postinst index 85f3c89..a8594bb 100644 --- a/xenial/debian/openstack-dashboard-apache.postinst +++ b/xenial/debian/openstack-dashboard-apache.postinst @@ -3,9 +3,19 @@ set -e if [ "$1" = "configure" ] ; then - if [ -x /etc/init.d/apache2 ]; then + . /usr/share/debconf/confmodule + db_get horizon/activate_vhost + if [ "${RET}" = "true" ] && [ -x /etc/init.d/apache2 ] ; then a2dissite default - a2ensite openstack-dashboard + db_get horizon/use_ssl + if [ "${RET}" = "true" ] ; then + a2enmod ssl + a2ensite openstack-dashboard-ssl + a2dissite openstack-dashboard + else + a2ensite openstack-dashboard + a2dissite openstack-dashboard-ssl + fi invoke-rc.d --quiet apache2 reload fi fi diff --git a/xenial/debian/openstack-dashboard-apache.templates b/xenial/debian/openstack-dashboard-apache.templates new file mode 100644 index 0000000..bdaa2e2 --- /dev/null +++ b/xenial/debian/openstack-dashboard-apache.templates @@ -0,0 +1,21 @@ +# These templates have been reviewed by the debian-l10n-english +# team +# +# If modifications/additions/rewording are needed, please ask +# debian-l10n-english@lists.debian.org for advice. +# +# Even minor modifications require translation updates and such +# changes should be coordinated with translators and reviewers. + +Template: horizon/activate_vhost +Type: boolean +Default: false +_Description: Activate Dashboard and disable default VirtualHost? + In Debian, Apache comes with a default website and a default page, configured + in /etc/apache2/sites-available/default. Should this configuration be disabled + and shall the Openstack Dashboard replace it? + +Template: horizon/use_ssl +Type: boolean +Default: true +_Description: Should the Dashboard be installed on HTTPS? diff --git a/xenial/debian/po/POTFILES.in b/xenial/debian/po/POTFILES.in new file mode 100644 index 0000000..e2d3c4d --- /dev/null +++ b/xenial/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] openstack-dashboard-apache.templates diff --git a/xenial/debian/po/templates.pot b/xenial/debian/po/templates.pot new file mode 100644 index 0000000..72351be --- /dev/null +++ b/xenial/debian/po/templates.pot @@ -0,0 +1,39 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: horizon\n" +"Report-Msgid-Bugs-To: horizon@packages.debian.org\n" +"POT-Creation-Date: 2012-11-01 07:34+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../openstack-dashboard-apache.templates:2001 +msgid "Activate Dashboard and disable default VirtualHost?" +msgstr "" + +#. Type: boolean +#. Description +#: ../openstack-dashboard-apache.templates:2001 +msgid "" +"In Debian, Apache comes with a default website and a default page, " +"configured in /etc/apache2/sites-available/default. Should this " +"configuration be disabled and shall the Openstack Dashboard replace it?" +msgstr "" + +#. Type: boolean +#. Description +#: ../openstack-dashboard-apache.templates:3001 +msgid "Should the Dashboard be installed on HTTPS?" +msgstr "" diff --git a/xenial/debian/rules b/xenial/debian/rules index f94ee5b..32d4815 100755 --- a/xenial/debian/rules +++ b/xenial/debian/rules @@ -43,6 +43,7 @@ override_dh_auto_install: # openstack-dashboard-apache install -D -m 0644 $(CURDIR)/debian/openstack-dashboard-apache.conf $(CURDIR)/debian/tmp/etc/apache2/sites-available/openstack-dashboard + install -D -m 0644 $(CURDIR)/debian/openstack-dashboard-apache-ssl.conf $(CURDIR)/debian/tmp/etc/apache2/sites-available/openstack-dashboard-ssl override_dh_install: dh_install -- 2.45.2