summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-03-27 17:38:22 +0000
committerBaserock Gerrit <gerrit@baserock.org>2015-03-30 13:41:18 +0000
commitc092bb9f60ef8c37d81210f8be3579af7b90ba70 (patch)
treee3b9a91dffb370161c2d9f01c15d73ef036f19be
parent39473587d6b669ccecc6907641aad72942b7fbba (diff)
downloadinfrastructure-c092bb9f60ef8c37d81210f8be3579af7b90ba70.tar.gz
Use HTTPS for all infrastructure.
This is implemented with the HAProxy frontend doing 'SSL termination'. So internal traffic between the frontend_haproxy instance and the various machines serving content is unencrypted HTTP as before, but all traffic that goes over the public internet is encrypted now. Note that storyboard.baserock.org is not behind HAProxy, and currently uses a different, self-signed certificate. Change-Id: I9140def605fe26c9c613066fa6524e3cf817f97c
-rw-r--r--README.mdwn14
-rw-r--r--baserock_gerrit/gerrit.config10
-rw-r--r--baserock_gerrit/instance-ca-certificate-config.yml28
-rw-r--r--baserock_openid_provider/baserock_openid_provider/settings.py8
-rw-r--r--baserock_openid_provider/templates/index.html2
-rw-r--r--baserock_openid_provider/templates/registration/activation_email.txt2
-rw-r--r--baserock_storyboard/site.pp2
-rw-r--r--certs/baserock.org-ssl-certificate-temporary-dsilverstone.full.cert118
-rw-r--r--frontend/haproxy.cfg29
-rw-r--r--frontend/instance-config.yml18
10 files changed, 217 insertions, 14 deletions
diff --git a/README.mdwn b/README.mdwn
index 4a8a1635..5b92cbd7 100644
--- a/README.mdwn
+++ b/README.mdwn
@@ -110,6 +110,8 @@ To deploy this system:
packer build -only=production frontend/packer_template.json
+ ansible-playbook -i hosts frontend/instance-config.yml
+
Full HAProxy 1.5 documentation: <https://cbonte.github.io/haproxy-dconv/configuration-1.5.html>.
When setting up a new instance with the frontend already deployed, do the
@@ -195,6 +197,14 @@ https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
ansible-playbook -i hosts baserock_openid_provider/instance-config.yml
+To change Cherokee configuration, it's usually easiest to use the
+cherokee-admin tool in a running instance. SSH in as normal but forward port
+9090 to localhost (pass `-L9090:localhost:9090` to SSH). Backup the old
+/etc/cherokee/cherokee.conf file, then run `cherokee-admin`, and log in using
+the creditials it gives you. After changing the configuration, please update
+the cherokee.conf in infrastructure.git to match the changes `cherokee-admin`
+made.
+
### Gerrit
To deploy to production, run these commands in a Baserock 'devel'
@@ -241,6 +251,10 @@ Ansible playbook will upload them to the new system.
ansible-playbook -i hosts baserock_gerrit/instance-config.yml
+For baserock.org Gerrit you will also need to run:
+
+ ansible-playbook -i hosts baserock_gerrit/instance-ca-certificate-config.yml
+
#### Access control
Gerrit should now be up and running and accessible through the web interface.
diff --git a/baserock_gerrit/gerrit.config b/baserock_gerrit/gerrit.config
index c34aaa45..9adced02 100644
--- a/baserock_gerrit/gerrit.config
+++ b/baserock_gerrit/gerrit.config
@@ -4,7 +4,7 @@
[gerrit]
basePath = git
- canonicalWebUrl = http://gerrit.baserock.org/
+ canonicalWebUrl = https://gerrit.baserock.org/
[database]
type = mysql
hostname = 192.168.222.30
@@ -14,12 +14,12 @@
type = LUCENE
[auth]
type = OPENID_SSO
- allowedOpenID = http://openid.baserock.org/
- trustedOpenID = http://openid.baserock.org/
+ allowedOpenID = https://openid.baserock.org/
+ trustedOpenID = https://openid.baserock.org/
# XRDS is a mechanism for saying 'here are the services I provide'. Gerrit
# expects the URL provided here to describe the OpenID provider service
# using XRDS.
- openIdSsoUrl = http://openid.baserock.org/openid/xrds/
+ openIdSsoUrl = https://openid.baserock.org/openid/xrds/
[sendemail]
smtpServer = 192.168.222.111
# Send mails as '${user} (Code Review) <gerrit.baserock.org>'
@@ -32,7 +32,7 @@
[sshd]
listenAddress = *:29418
[httpd]
- listenUrl = http://*:8080/
+ listenUrl = proxy-https://*:8080/
[cache]
directory = cache
[user]
diff --git a/baserock_gerrit/instance-ca-certificate-config.yml b/baserock_gerrit/instance-ca-certificate-config.yml
new file mode 100644
index 00000000..0424b176
--- /dev/null
+++ b/baserock_gerrit/instance-ca-certificate-config.yml
@@ -0,0 +1,28 @@
+# The CA chain needed for the baserock.org certificate we use is present in
+# the system, but it's not present in the set of trusted root certificates
+# bundled with Java.
+#
+# We need Gerrit to trust the baserock.org certificate so that it will trust
+# https://openid.baserock.org/.
+#
+# This playbook is a hack at present: the second time you run it, the command
+# will fail because the certificate is already present. There is a proposed
+# Ansible module that can do this in a nicer way:
+# <https://github.com/ansible/ansible-modules-extras/pull/286/commits>.
+---
+- hosts: gerrit
+ gather_facts: False
+ vars:
+ JRE_DIR: /opt/jdk1.8.0_40
+ tasks:
+ - name: baserock.org SSL certificate with chain of trust
+ copy: src=../certs/baserock.org-ssl-certificate-temporary-dsilverstone.full.cert dest=/home/gerrit
+
+ - name: install SSL certificate into Java certificate keystore
+ shell: >
+ {{ JRE_DIR }}/jre/bin/keytool \
+ -file /home/gerrit/baserock.org-ssl-certificate-temporary-dsilverstone.full.cert \
+ -importcert \
+ -keystore {{ JRE_DIR }}/jre/lib/security/cacerts \
+ -storepass changeit \
+ -noprompt
diff --git a/baserock_openid_provider/baserock_openid_provider/settings.py b/baserock_openid_provider/baserock_openid_provider/settings.py
index 1ac1d147..a7e892ba 100644
--- a/baserock_openid_provider/baserock_openid_provider/settings.py
+++ b/baserock_openid_provider/baserock_openid_provider/settings.py
@@ -32,6 +32,14 @@ ALLOWED_HOSTS = [
'openid.baserock.org',
]
+# All connections for openid.baserock.org are forced through HTTPS by HAProxy.
+# This line is necessary so that the Django code generates https:// rather than
+# http:// URLs for internal redirects.
+#
+# You MUST remove this line if this application is not running behind a proxy
+# that forces all traffic through HTTPS.
+SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
+
# Application definition
diff --git a/baserock_openid_provider/templates/index.html b/baserock_openid_provider/templates/index.html
index b2f46630..1cb4bf73 100644
--- a/baserock_openid_provider/templates/index.html
+++ b/baserock_openid_provider/templates/index.html
@@ -8,7 +8,7 @@
<p>You are registered as {{ user.get_full_name }}.</p>
<p>Your OpenID is:
- <a href="http://openid.baserock.org/openid/{{ user.username }}/">http://openid.baserock.org/openid/{{ user.username }}/</a>
+ <a href="https://openid.baserock.org/openid/{{ user.username }}/">https://openid.baserock.org/openid/{{ user.username }}/</a>
</p>
{% endif %}
diff --git a/baserock_openid_provider/templates/registration/activation_email.txt b/baserock_openid_provider/templates/registration/activation_email.txt
index 911df019..bfa784d9 100644
--- a/baserock_openid_provider/templates/registration/activation_email.txt
+++ b/baserock_openid_provider/templates/registration/activation_email.txt
@@ -1,6 +1,6 @@
{% load i18n %}
{% trans "Activate account at" %} {{ site.name }}:
-http://{{ site.domain }}{% url 'registration_activate' activation_key %}
+https://{{ site.domain }}{% url 'registration_activate' activation_key %}
{% blocktrans %}Link is valid for {{ expiration_days }} days.{% endblocktrans %}
diff --git a/baserock_storyboard/site.pp b/baserock_storyboard/site.pp
index d062f817..32323877 100644
--- a/baserock_storyboard/site.pp
+++ b/baserock_storyboard/site.pp
@@ -28,7 +28,7 @@ node default {
# need class storyboard::rabbitmq too
class { 'storyboard::application':
- openid_url => 'http://openid.baserock.org/',
+ openid_url => 'https://openid.baserock.org/',
mysql_host => '192.168.222.30',
mysql_database => 'storyboard',
diff --git a/certs/baserock.org-ssl-certificate-temporary-dsilverstone.full.cert b/certs/baserock.org-ssl-certificate-temporary-dsilverstone.full.cert
new file mode 100644
index 00000000..78a80f5e
--- /dev/null
+++ b/certs/baserock.org-ssl-certificate-temporary-dsilverstone.full.cert
@@ -0,0 +1,118 @@
+-----BEGIN CERTIFICATE-----
+MIIGkTCCBXmgAwIBAgIHBv5yWci2CjANBgkqhkiG9w0BAQsFADCBjDELMAkGA1UE
+BhMCSUwxFjAUBgNVBAoTDVN0YXJ0Q29tIEx0ZC4xKzApBgNVBAsTIlNlY3VyZSBE
+aWdpdGFsIENlcnRpZmljYXRlIFNpZ25pbmcxODA2BgNVBAMTL1N0YXJ0Q29tIENs
+YXNzIDIgUHJpbWFyeSBJbnRlcm1lZGlhdGUgU2VydmVyIENBMB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XQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8
+jhvh3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUW
+FjgKXlf2Ysd6AgXmvB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJz
+ewT4F+irsfMuXGRuczE6Eri8sxHkfY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1
+ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3fsNrarnDy0RLrHiQi+fHLB5L
+EUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZEoalHmdkrQYu
+L6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
+yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuC
+O3NJo2pXh5Tl1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6V
+um0ABj6y6koQOdjQK/W/7HW/lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkySh
+NOsF/5oirpt9P/FlUQqmMGqz9IgcgA38corog14=
+-----END CERTIFICATE-----
diff --git a/frontend/haproxy.cfg b/frontend/haproxy.cfg
index b0b46d00..5ebbc031 100644
--- a/frontend/haproxy.cfg
+++ b/frontend/haproxy.cfg
@@ -11,6 +11,13 @@ global
log /dev/log local0
stats socket /var/lib/haproxy/stats
+ # Maximum number of bits used when generating temporary
+ # keys for DHE key exchange. Higher values involve more CPU
+ # usage, lower values are less secure. HAProxy's default is
+ # 1024, which is too low and HAProxy actually warns if you use
+ # the default.
+ tune.ssl.default-dh-param 2048
+
defaults
mode http
timeout connect 5000ms
@@ -21,7 +28,18 @@ defaults
option httplog
frontend http-in
+ # All HTTP traffic is redirected to HTTPS using the '301 Moved' HTTP code.
bind *:80
+ redirect scheme https code 301
+
+frontend https-in
+ # We do 'SSL termination' with HAProxy. So secure requests are received in
+ # the frontend, then decrypted and sent over HTTP on the internal network.
+ # This means we only need to have the certificate in one place, and the
+ # configuration of the other instances is simpler. It does mean that we
+ # need to avoid having any insecure machines in the cloud.
+ bind *:443 ssl crt /etc/pki/tls/private/baserock.pem
+ reqadd X-Forwarded-Proto:\ https
# Rules below here implement the URL-based forwarding to the
# appropriate instance. The hdr(host) call means 'extract the
@@ -44,8 +62,7 @@ frontend http-in
acl host_mason_x86_64 hdr(host) -m beg -i mason-x86-64
use_backend baserock_mason_x86_64_http if host_mason_x86_64
- acl host_openid hdr(host) -m beg -i openid
- use_backend baserock_openid_provider_http if host_openid
+ use_backend baserock_openid_provider_http if { hdr(host) -m beg -i openid }
frontend ssh-in:
# FIXME: it'd be better if we could limit traffic on port 29418 to
@@ -68,13 +85,13 @@ backend baserock_gerrit_ssh
server baserock_gerrit 192.168.222.69:29418
backend baserock_irclogs_http
- server baserock_irclogs 192.168.222.74
+ server baserock_irclogs 192.168.222.74:80
backend baserock_mason_x86_32_http
- server baserock_mason_x86_32 192.168.222.81
+ server baserock_mason_x86_32 192.168.222.81:80
backend baserock_mason_x86_64_http
- server baserock_mason_x86_64 192.168.222.80
+ server baserock_mason_x86_64 192.168.222.80:80
backend baserock_openid_provider_http
- server baserock_openid_provider 192.168.222.67
+ server baserock_openid_provider 192.168.222.67:80
diff --git a/frontend/instance-config.yml b/frontend/instance-config.yml
new file mode 100644
index 00000000..5484c344
--- /dev/null
+++ b/frontend/instance-config.yml
@@ -0,0 +1,18 @@
+# Instance configuration for Baserock HAProxy instance.
+#
+# This playbook should be run after starting an instance of the Baserock
+# frontend image.
+---
+- hosts: frontend-haproxy
+ gather_facts: false
+ sudo: yes
+ tasks:
+ - name: ensure system up to date
+ yum: name=* state=latest
+
+ # To create the .pem file, simply concatenate
+ # certs/baserock.org-ssl-certificate-temporary-dsilverstone.full.cert with
+ # the private key for that certificate (which is not committed to Git, of
+ # course).
+ - name: install SSL certificate
+ copy: src=../private/baserock.org-ssl-certificate-temporary-dsilverstone.pem owner=haproxy mode=400