Add MySQL connection SSL support

When 'nova_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: I9f9a130be3a4920170295b041b94dd435e3781d1
Partial-Bug: 1667789
This commit is contained in:
Jimmy McCrory 2017-12-14 08:07:06 -08:00
parent 6b96ce9039
commit 70c663391b
5 changed files with 28 additions and 10 deletions

View File

@ -75,16 +75,16 @@ nova_lock_path: "/var/lock/nova"
# nova_system_user_uid = <UID>
# nova_system_group_gid = <GID>
## DB
## Database info
nova_galera_user: nova
nova_galera_database: nova
nova_db_max_overflow: 10
nova_db_max_pool_size: 120
nova_db_pool_timeout: 30
# Toggle whether nova connects via an encrypted connection
nova_galera_use_ssl: False
nova_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
# The path where to store the database server CA certificate
nova_galera_ssl_ca_cert: /etc/ssl/certs/galera-ca.pem
nova_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}"
## DB API
nova_api_galera_user: nova_api

View File

@ -214,25 +214,24 @@ memcache_secret_key = {{ memcached_encryption_key }}
{% if inventory_hostname in (groups['nova_conductor'] + groups['nova_scheduler'] + groups['nova_api_os_compute'] + groups['nova_api_metadata'] + groups['nova_console'] + groups['nova_api_placement'])%}
[database]
{% if nova_galera_use_ssl | bool %}
connection = mysql+pymysql://{{ nova_galera_user }}:{{ nova_container_mysql_password }}@{{ nova_galera_address }}/{{ nova_galera_database }}?charset=utf8&ssl_ca={{ nova_galera_ssl_ca_cert }}
{% else %}
connection = mysql+pymysql://{{ nova_galera_user }}:{{ nova_container_mysql_password }}@{{ nova_galera_address }}/{{ nova_galera_database }}?charset=utf8
{% endif %}
connection = mysql+pymysql://{{ nova_galera_user }}:{{ nova_container_mysql_password }}@{{ nova_galera_address }}/{{ nova_galera_database }}?charset=utf8{% if nova_galera_use_ssl | bool %}&ssl_ca={{ nova_galera_ssl_ca_cert }}{% endif %}
max_overflow = {{ nova_db_max_overflow }}
max_pool_size = {{ nova_db_max_pool_size }}
pool_timeout = {{ nova_db_pool_timeout }}
[api_database]
connection = mysql+pymysql://{{ nova_api_galera_user }}:{{ nova_api_container_mysql_password }}@{{ nova_api_galera_address }}/{{ nova_api_galera_database }}?charset=utf8
connection = mysql+pymysql://{{ nova_api_galera_user }}:{{ nova_api_container_mysql_password }}@{{ nova_api_galera_address }}/{{ nova_api_galera_database }}?charset=utf8{% if nova_galera_use_ssl | bool %}&ssl_ca={{ nova_galera_ssl_ca_cert }}{% endif %}
max_overflow = {{ nova_api_db_max_overflow }}
max_pool_size = {{ nova_api_db_max_pool_size }}
pool_timeout = {{ nova_api_db_pool_timeout }}
{% if nova_placement_service_enabled | bool %}
[placement_database]
connection = mysql+pymysql://{{ nova_placement_galera_user }}:{{ nova_placement_container_mysql_password }}@{{ nova_placement_galera_address }}/{{ nova_placement_galera_database }}?charset=utf8
connection = mysql+pymysql://{{ nova_placement_galera_user }}:{{ nova_placement_container_mysql_password }}@{{ nova_placement_galera_address }}/{{ nova_placement_galera_database }}?charset=utf8{% if nova_galera_use_ssl | bool %}&ssl_ca={{ nova_galera_ssl_ca_cert }}{% endif %}
max_overflow = {{ nova_placement_db_max_overflow }}
max_pool_size = {{ nova_placement_db_max_pool_size }}
pool_timeout = {{ nova_placement_db_pool_timeout }}

11
tox.ini
View File

@ -126,6 +126,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}

View File

@ -19,3 +19,9 @@
vars:
tox_env: func_lxd
- job:
name: openstack-ansible-nova-ssl-nv
parent: openstack-ansible-functional-ubuntu-xenial
voting: false
vars:
tox_env: ssl

View File

@ -23,6 +23,7 @@
- openstack-ansible-functional-ubuntu-xenial
- openstack-ansible-upgrade-ubuntu-xenial
- openstack-ansible-lxd-ubuntu-xenial
- openstack-ansible-nova-ssl-nv
experimental:
jobs:
- openstack-ansible-integrated-deploy-aio
@ -34,3 +35,4 @@
- openstack-ansible-functional-ubuntu-xenial
- openstack-ansible-upgrade-ubuntu-xenial
- openstack-ansible-lxd-ubuntu-xenial
- openstack-ansible-nova-ssl-nv