Add TLS support to manila backends

By overriding the variable `manila_backend_ssl: True` HTTPS will
be enabled, disabling HTTP support on the manila backend api.

The ansible-role-pki is used to generate the required TLS
certificates if this functionality is enabled.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/879085
Change-Id: I38b95b73301d2210f64105c20f389c74498a5345
This commit is contained in:
Damian Dabrowski 2023-04-14 23:03:06 +02:00
parent 136089ce58
commit 0b6f8da608
3 changed files with 74 additions and 0 deletions

View File

@ -284,6 +284,7 @@ manila_services:
uwsgi_overrides: "{{ manila_api_uwsgi_ini_overrides }}"
uwsgi_port: "{{ manila_service_port }}"
uwsgi_bind_address: "{{ manila_uwsgi_bind_address }}"
uwsgi_tls: "{{ manila_backend_ssl | ternary(manila_uwsgi_tls, {}) }}"
#condition: "{{ manila_service_data_program_enabled | bool }}"
# Manila uWSGI settings
@ -291,6 +292,9 @@ manila_wsgi_processes_max: 16
manila_wsgi_processes: "{{ [[ansible_facts['processor_vcpus']|default(1), 1] | max * 2, manila_wsgi_processes_max] | min }}"
manila_wsgi_threads: 1
manila_wsgi_buffer_size: 65535
manila_uwsgi_tls:
crt: "{{ manila_ssl_cert }}"
key: "{{ manila_ssl_key }}"
## Tunable overrides
manila_policy_overrides: {}
@ -306,3 +310,51 @@ manila_api_uwsgi_ini_overrides: {}
# is set and a key cannot be found it will generate one.
#
# manila_keypair_path: /etc/openstack_deploy/id_rsa
###
### Backend TLS
###
# Define if communication between haproxy and service backends should be
# encrypted with TLS.
manila_backend_ssl: "{{ openstack_service_backend_ssl | default(False) }}"
# Storage location for SSL certificate authority
manila_pki_dir: "{{ openstack_pki_dir | default('/etc/openstack_deploy/pki') }}"
# Delegated host for operating the certificate authority
manila_pki_setup_host: "{{ openstack_pki_setup_host | default('localhost') }}"
# manila server certificate
manila_pki_keys_path: "{{ manila_pki_dir ~ '/certs/private/' }}"
manila_pki_certs_path: "{{ manila_pki_dir ~ '/certs/certs/' }}"
manila_pki_intermediate_cert_name: "{{ openstack_pki_service_intermediate_cert_name | default('ExampleCorpIntermediate') }}"
manila_pki_regen_cert: ''
manila_pki_san: "{{ openstack_pki_san | default('DNS:' ~ ansible_facts['hostname'] ~ ',IP:' ~ management_address) }}"
manila_pki_certificates:
- name: "manila_{{ ansible_facts['hostname'] }}"
provider: ownca
cn: "{{ ansible_facts['hostname'] }}"
san: "{{ manila_pki_san }}"
signed_by: "{{ manila_pki_intermediate_cert_name }}"
# manila destination files for SSL certificates
manila_ssl_cert: /etc/manila/manila.pem
manila_ssl_key: /etc/manila/manila.key
# Installation details for SSL certificates
manila_pki_install_certificates:
- src: "{{ manila_user_ssl_cert | default(manila_pki_certs_path ~ 'manila_' ~ ansible_facts['hostname'] ~ '-chain.crt') }}"
dest: "{{ manila_ssl_cert }}"
owner: "{{ manila_system_user_name }}"
group: "{{ manila_system_user_name }}"
mode: "0644"
- src: "{{ manila_user_ssl_key | default(manila_pki_keys_path ~ 'manila_' ~ ansible_facts['hostname'] ~ '.key.pem') }}"
dest: "{{ manila_ssl_key }}"
owner: "{{ manila_system_user_name }}"
group: "{{ manila_system_user_name }}"
mode: "0600"
# Define user-provided SSL certificates
#manila_user_ssl_cert: <path to cert on ansible deployment host>
#manila_user_ssl_key: <path to cert on ansible deployment host>

View File

@ -28,6 +28,7 @@
- "Restart manila services"
- "venv changed"
- "systemd service changed"
- "cert installed"
- name: Start services
service:
@ -44,3 +45,4 @@
- "Restart manila services"
- "venv changed"
- "systemd service changed"
- "cert installed"

View File

@ -123,6 +123,26 @@
tags:
- manila-install
- name: Create and install SSL certificates
include_role:
name: pki
tasks_from: main_certs.yml
apply:
tags:
- manila-config
- pki
vars:
pki_setup_host: "{{ manila_pki_setup_host }}"
pki_dir: "{{ manila_pki_dir }}"
pki_create_certificates: "{{ manila_user_ssl_cert is not defined and manila_user_ssl_key is not defined }}"
pki_regen_cert: "{{ manila_pki_regen_cert }}"
pki_certificates: "{{ manila_pki_certificates }}"
pki_install_certificates: "{{ manila_pki_install_certificates }}"
when:
- manila_backend_ssl
tags:
- always
- import_tasks: manila_post_install.yml
tags:
- manila-config