From 198acc08aa2924892dbee9adf5c949a6f940c016 Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Wed, 13 Dec 2017 17:22:39 -0800 Subject: [PATCH] Add MySQL connection SSL support When 'cinder_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: Ifeda0acb4b70ba313e6572c806125d31ab3eb300 Depends-On: I95cc994df5118fce7ce588fc0bff979bc283a6f3 --- defaults/main.yml | 4 +++- templates/cinder.conf.j2 | 2 +- tox.ini | 11 +++++++++++ zuul.d/jobs.yaml | 21 +++++++++++++++++++++ zuul.d/project.yaml | 2 ++ 5 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 zuul.d/jobs.yaml diff --git a/defaults/main.yml b/defaults/main.yml index def0f11f..4ca31290 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -51,9 +51,11 @@ cinder_nova_catalog_admin_info: compute:nova:adminURL cinder_fatal_deprecations: False -## DB +## Database info cinder_galera_user: cinder cinder_galera_database: cinder +cinder_galera_use_ssl: "{{ galera_use_ssl | default(False) }}" +cinder_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}" ## RabbitMQ info diff --git a/templates/cinder.conf.j2 b/templates/cinder.conf.j2 index 22b99d30..ba3397f5 100644 --- a/templates/cinder.conf.j2 +++ b/templates/cinder.conf.j2 @@ -103,7 +103,7 @@ enabled_backends={% for backend in cinder_backends|dictsort %}{{ backend.0 }}{% {% endif %} [database] -connection = mysql+pymysql://{{ cinder_galera_user }}:{{ cinder_container_mysql_password }}@{{ cinder_galera_address }}/{{ cinder_galera_database }}?charset=utf8 +connection = mysql+pymysql://{{ cinder_galera_user }}:{{ cinder_container_mysql_password }}@{{ cinder_galera_address }}/{{ cinder_galera_database }}?charset=utf8{% if cinder_galera_use_ssl | bool %}&ssl_ca={{ cinder_galera_ssl_ca_cert }}{% endif %} [oslo_messaging_rabbit] ssl = {{ cinder_rabbitmq_use_ssl }} diff --git a/tox.ini b/tox.ini index f4094c63..fe5f7868 100644 --- a/tox.ini +++ b/tox.ini @@ -116,6 +116,17 @@ commands = bash -c "{toxinidir}/tests/test-cinder-upgrades.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} diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml new file mode 100644 index 00000000..5095b679 --- /dev/null +++ b/zuul.d/jobs.yaml @@ -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-cinder-ssl-nv + parent: openstack-ansible-functional-ubuntu-xenial + voting: false + vars: + tox_env: ssl diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 57b7ca64..5376ee16 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -22,6 +22,7 @@ - openstack-ansible-functional-opensuse-423 - openstack-ansible-functional-ubuntu-xenial - openstack-ansible-upgrade-ubuntu-xenial + - openstack-ansible-cinder-ssl-nv experimental: jobs: - openstack-ansible-integrated-deploy-aio @@ -32,3 +33,4 @@ - openstack-ansible-functional-opensuse-423 - openstack-ansible-functional-ubuntu-xenial - openstack-ansible-upgrade-ubuntu-xenial + - openstack-ansible-cinder-ssl-nv