Add MySQL connection SSL support

When 'horizon_galera_use_ssl' is True, use an encrypted connection to
the database using either a self-signed or user-provided CA certificate.

A new non-voting test has been added to verify that the role remains
functional when enabling SSL features.

Change-Id: Ie7e0e5f7fc89978126d0d735367d8ecf3e007cfc
Partial-Bug: 1667789
This commit is contained in:
Jimmy McCrory 2017-12-14 10:26:37 -08:00
parent da72526dc1
commit b775123f54
5 changed files with 40 additions and 1 deletions

View File

@ -68,9 +68,11 @@ horizon_system_user_home: "/var/lib/{{ horizon_system_user_name }}"
horizon_service_region: RegionOne
horizon_service_name: horizon
## DB info
## Database info
horizon_galera_database: dash
horizon_galera_user: dash
horizon_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
horizon_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}"
## Session configuration
# Specifies the timespan in seconds inactivity, until a user is considered as

View File

@ -140,6 +140,9 @@ DATABASES = {
'USER': '{{ horizon_galera_user }}',
'PASSWORD': '{{ horizon_container_mysql_password }}',
'default-character-set': 'utf8'
{% if horizon_galera_use_ssl | bool -%}
,'ssl-ca': '{{ horizon_galera_ssl_ca_cert }}'
{% endif -%}
},
}

11
tox.ini
View File

@ -103,6 +103,17 @@ commands =
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
[testenv:ssl]
deps =
{[testenv:ansible]deps}
setenv =
{[testenv]setenv}
ANSIBLE_PARAMETERS=-vvv -e galera_use_ssl=True
commands =
bash -c "{toxinidir}/tests/tests-repo-clone.sh"
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
[testenv:linters]
deps =
{[testenv:ansible]deps}

21
zuul.d/jobs.yaml Normal file
View File

@ -0,0 +1,21 @@
---
# Copyright 2017, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- job:
name: openstack-ansible-horizon-ssl-nv
parent: openstack-ansible-functional-ubuntu-xenial
voting: false
vars:
tox_env: ssl

View File

@ -21,6 +21,7 @@
- openstack-ansible-functional-centos-7
- openstack-ansible-functional-opensuse-423
- openstack-ansible-functional-ubuntu-xenial
- openstack-ansible-horizon-ssl-nv
experimental:
jobs:
- openstack-ansible-integrated-deploy-aio
@ -30,3 +31,4 @@
- openstack-ansible-functional-centos-7
- openstack-ansible-functional-opensuse-423
- openstack-ansible-functional-ubuntu-xenial
- openstack-ansible-horizon-ssl-nv