Refactor galera_use_ssl behaviour

With PKI role in place in most cases you don't need to explicitly
provide path to the CA file because PKI role ensures that CA is trusted
by the system overall. In the meanwhile in PyMySQL [1] you must either
provide CA file or cert/key or enable verify.

Since current behaviour is to provide path to the custom CA we expect
certificate being trusted overall. Thus we enable cert verification when
galera_use_ssl is True.

[1] 78f0cf99e5/pymysql/connections.py (L267)

Change-Id: I7042118a17d533c472f09bb2098bbc3c01195477
This commit is contained in:
Dmitriy Rabotyagov 2021-09-17 17:24:34 +03:00 committed by Dmitriy Rabotyagov
parent d4ca9d3483
commit 956c84d1a4
2 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ blazar_galera_address: "{{ galera_address | default('127.0.0.1') }}"
blazar_galera_database: blazar
blazar_galera_user: blazar
blazar_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
blazar_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}"
blazar_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('') }}"
blazar_galera_port: "{{ galera_port | default('3306') }}"
## Service Type and Data

View File

@ -28,4 +28,4 @@ password={{ blazar_service_password }}
auth_url={{ keystone_service_adminuri }}
[database]
connection = mysql+pymysql://{{ blazar_galera_user }}:{{ blazar_container_mysql_password }}@{{ blazar_galera_address }}/{{ blazar_galera_database }}?charset=utf8{% if blazar_galera_use_ssl | bool %}&ssl_ca={{ blazar_galera_ssl_ca_cert }}{% endif %}
connection = mysql+pymysql://{{ blazar_galera_user }}:{{ blazar_container_mysql_password }}@{{ blazar_galera_address }}/{{ blazar_galera_database }}?charset=utf8{% if blazar_galera_use_ssl | bool %}&ssl_verify_cert=true{% if blazar_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ blazar_galera_ssl_ca_cert }}{% endif %}{% endif %}