Add DB SSL support

Change-Id: I4af5f0aaf6dc65c2e2bd5159823d39dbe4bb0f62
Depends-On: I9e6d9ee439cab734eba02320d58ccfcd73e23106
This commit is contained in:
Proskurin Kirill 2017-02-09 11:33:20 +00:00
parent f4f30a276f
commit 11e00a8c2c
3 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash -ex
set -o pipefail
BACKUP_FILE="/var/ccp/backup/neutron/backup-$(date "+%Y%m%d%H%M%S").sql"
mysqldump -h {{ address(service.database) }} \
mysqldump {% if percona.tls.enabled %} --ssl-mode REQUIRED {% endif %} -h {{ address(service.database) }} \
-u {{ neutron.db.username }} -p{{ neutron.db.password }} \
--single-transaction {{ neutron.db.name }} > "${BACKUP_FILE}"

View File

@ -56,7 +56,7 @@ root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf
root_helper_daemon = sudo neutron-rootwrap-daemon /etc/neutron/rootwrap.conf
[database]
connection = mysql+pymysql://{{ neutron.db.username }}:{{ neutron.db.password }}@{{ address(service.database) }}/{{ neutron.db.name }}
connection = mysql+pymysql://{{ neutron.db.username }}:{{ neutron.db.password }}@{{ address(service.database) }}/{{ neutron.db.name }}{% if percona.tls.enabled %}?ssl_ca=/opt/ccp/etc/tls/ca.pem{% endif %}
max_retries = -1
max_pool_size = {{ neutron.db.max_pool_size }}
max_overflow = {{ neutron.db.max_overflow }}

View File

@ -15,7 +15,10 @@ service:
- {{ service.database }}
type: single
command: mysql -u root -p{{ db.root_password }} -h {{ address(service.database) }} -e 'create database `{{ neutron.db.name }}`;
grant all privileges on `{{ neutron.db.name }}`.* to "{{ neutron.db.username }}"@"%" identified by "{{ neutron.db.password }}"'
create user "{{ neutron.db.username }}"@"%" identified by "{{ neutron.db.password }}"
{% if percona.tls.enabled %} require ssl {% endif %};
grant all privileges on `{{ neutron.db.name }}`.* to "{{ neutron.db.username }}"@"%" identified by "{{ neutron.db.password }}"
{% if percona.tls.enabled %} require ssl {% endif %};'
- name: neutron-db-sync
type: single
command: neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head