Add MySQL connection SSL support

When 'barbican_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.

Partial-Bug: 1667789

Change-Id: I10c578f32c54138cac87ad42adc0ab38d62da9a6
Depends-On: I95cc994df5118fce7ce588fc0bff979bc283a6f3
This commit is contained in:
Jimmy McCrory 2017-12-13 16:02:17 -08:00
parent 37fd290dbd
commit 5141c18209
5 changed files with 37 additions and 1 deletions

View File

@ -90,6 +90,8 @@ barbican_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/barbican.tgz
# Database vars
barbican_galera_database: barbican
barbican_galera_user: barbican
barbican_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
barbican_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}"
# Rabbit vars
barbican_rabbitmq_userid: barbican

View File

@ -39,7 +39,7 @@ max_allowed_request_size_in_bytes = 1000000
#sql_connection = sqlite:///barbican.sqlite
# Note: For absolute addresses, use '////' slashes after 'sqlite:'
# Uncomment for a more global development environment
sql_connection = mysql+pymysql://{{ barbican_galera_user }}:{{ barbican_galera_password }}@{{ barbican_galera_address }}/{{ barbican_galera_database }}?charset=utf8
sql_connection = mysql+pymysql://{{ barbican_galera_user }}:{{ barbican_galera_password }}@{{ barbican_galera_address }}/{{ barbican_galera_database }}?charset=utf8{% if barbican_galera_use_ssl | bool %}&ssl_ca={{ barbican_galera_ssl_ca_cert }}{% endif %}
# Period in seconds after which SQLAlchemy should reestablish its connection
# to the database.

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-barbican-ssl-nv
parent: openstack-ansible-functional-ubuntu-xenial
voting: false
vars:
tox_env: ssl

View File

@ -20,6 +20,7 @@
- openstack-ansible-linters
- openstack-ansible-functional-centos-7
- openstack-ansible-functional-ubuntu-xenial
- openstack-ansible-barbican-ssl-nv
experimental:
jobs:
- openstack-ansible-integrated-deploy-aio
@ -28,3 +29,4 @@
- openstack-ansible-linters
- openstack-ansible-functional-centos-7
- openstack-ansible-functional-ubuntu-xenial
- openstack-ansible-barbican-ssl-nv