Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MySQL SSL connections allowed. Self-signed SSL bundle created and placed to the deployment host, or user-provided SSL bundle (CA, cert and the key) is used. Change-Id: Ibac61d45cea67123fe61a6de4f906b4bd1949a34 Partial-Bug: #1667789
- Loading branch information
Andrey
committed
Mar 30, 2017
1 parent
03b702b
commit eb5fc9c
Showing
7 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
features: | ||
- Implements SSL connection ability to MySQL. ``galera_use_ssl`` option has to | ||
be set to ``true`` (default), in this case playbooks create self-signed | ||
SSL bundle and sets up MySQL configs to use it or distributes user-provided | ||
bundle throughout Galera nodes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
# Copyright 2015, Rackspace US, Inc., Mirantis 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. | ||
|
||
- name: Check if SSL bundle exists | ||
stat: | ||
path: "{{ item }}" | ||
delegate_to: localhost | ||
register: res | ||
with_items: | ||
- "{{ galera_user_ssl_ca_cert }}" | ||
- "{{ galera_user_ssl_cert }}" | ||
- "{{ galera_user_ssl_key }}" | ||
|
||
- include: galera_ssl_key_create.yml | ||
when: > | ||
( not res.results[0].stat.exists or | ||
not res.results[1].stat.exists or | ||
not res.results[2].stat.exists ) | ||
- name: Create ssl directory | ||
file: | ||
path: "/etc/mysql/ssl" | ||
state: "directory" | ||
owner: "mysql" | ||
group: "mysql" | ||
mode: "0750" | ||
|
||
- name: Copy CA cert and key | ||
copy: | ||
src: "{{ item.src }}" | ||
dest: "{{ item.dest }}" | ||
owner: "mysql" | ||
group: "mysql" | ||
mode: "{{ item.mode|default('0640') }}" | ||
with_items: | ||
- src: "{{ galera_user_ssl_ca_cert }}" | ||
dest: "{{ galera_ssl_ca_cert }}" | ||
- src: "{{ galera_user_ssl_cert }}" | ||
dest: "{{ galera_ssl_cert }}" | ||
- src: "{{ galera_user_ssl_key }}" | ||
dest: "{{ galera_ssl_key }}" | ||
mode: "0600" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
# Copyright 2015, Rackspace US, Inc., Mirantis 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. | ||
|
||
- name: Create ssl directory | ||
file: | ||
path: "{{ galera_user_ssl_ca_cert | dirname }}" | ||
state: "directory" | ||
delegate_to: localhost | ||
|
||
- name: Remove self signed cert for regen | ||
file: | ||
dest: "{{ item }}" | ||
state: "absent" | ||
with_items: | ||
- "{{ galera_user_ssl_ca_cert }}" | ||
- "{{ galera_user_ssl_cert }}" | ||
- "{{ galera_user_ssl_key }}" | ||
- "{{ galera_user_ssl_ca_cert | dirname }}/galera-ca.key " | ||
- "{{ galera_user_ssl_ca_cert | dirname }}/galera-req.pem " | ||
delegate_to: localhost | ||
when: galera_ssl_self_signed_regen | bool | ||
|
||
- name: Create galera CA cert | ||
command: > | ||
openssl req -new -nodes -x509 -subj | ||
"{{ galera_ssl_ca_self_signed_subject }}" | ||
-keyout {{ galera_user_ssl_ca_cert | dirname }}/galera-ca.key | ||
-out {{ galera_user_ssl_ca_cert }} | ||
creates={{ galera_user_ssl_ca_cert }} | ||
delegate_to: localhost | ||
|
||
- name: Create galera ssl request | ||
command: > | ||
openssl req -new -nodes -sha256 -subj | ||
"{{ galera_ssl_self_signed_subject }}" | ||
-days 3650 | ||
-keyout {{ galera_user_ssl_key }} | ||
-out {{ galera_user_ssl_ca_cert | dirname }}/galera-req.pem | ||
-extensions v3_ca | ||
creates={{ galera_user_ssl_ca_cert | dirname }}/galera-req.pem | ||
delegate_to: localhost | ||
|
||
- name: Create galera ssl cert | ||
command: > | ||
openssl x509 -req | ||
-days 3650 | ||
-in {{ galera_user_ssl_ca_cert | dirname }}/galera-req.pem | ||
-CA {{ galera_user_ssl_ca_cert }} | ||
-CAkey {{ galera_user_ssl_ca_cert | dirname }}/galera-ca.key | ||
-out {{ galera_user_ssl_cert }} | ||
-set_serial 01 | ||
creates={{ galera_user_ssl_cert }} | ||
delegate_to: localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters