Skip to content

Commit b69f2bd

Browse files
committed
INFRA-839 Add config for pulp TLS
Add playbooks, config & docs for enabling pulp tls with vault
1 parent 232b220 commit b69f2bd

File tree

5 files changed

+115
-2
lines changed

5 files changed

+115
-2
lines changed

doc/source/configuration/vault.rst

+25
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,31 @@ Enable the required TLS variables in kayobe and kolla
298298
299299
kayobe overcloud host command run --command "systemctl restart kolla-nova_compute-container.service" --become --show-output -l compute
300300
301+
Pulp TLS with Vault
302+
===================
303+
To enable tls for pulp using vault generated certificates, we first need to generate the certificates using vault and then configure the seed + seed-hypervisor + overcloud nodes to add the root CA to their trust.
304+
305+
1. Run the playbook which will generate the certificates and add the root CA to the seed + seed-hypervisor + overcloud nodes
306+
307+
.. code-block::
308+
309+
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/vault-generate-pulp-tls.yml
310+
311+
2. Next, enable tls for pulp in pulp.yml
312+
313+
.. code-block::
314+
315+
# Whether to enable TLS for Pulp.
316+
pulp_enable_tls: true
317+
318+
3. Redeploy pulp
319+
320+
.. code-block::
321+
322+
kayobe seed service reconfigure -t seed-deploy-containers
323+
324+
You should now have pulp running with tls enabled using the certificates generated by vault.
325+
301326
Barbican integration
302327
====================
303328

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
- name: Copy CA certificate and update trust
3+
hosts: overcloud:seed:seed-hypervisor
4+
become: true
5+
vars:
6+
cert_path: "{{ kayobe_env_config_path }}/vault/OS-TLS-ROOT.pem"
7+
8+
tasks:
9+
- name: Copy certificate on RedHat family systems (Rocky, RHEL, CentOS)
10+
copy:
11+
src: "{{ cert_path }}"
12+
dest: "/etc/pki/ca-trust/source/anchors/OS-TLS-ROOT.pem"
13+
mode: "0644"
14+
when: ansible_facts.os_family == 'RedHat'
15+
16+
- name: Update CA trust on RedHat family systems
17+
command: "update-ca-trust"
18+
when: ansible_facts.os_family == 'RedHat'
19+
20+
- name: Copy certificate on Debian family systems (Ubuntu, Debian)
21+
copy:
22+
src: "{{ cert_path }}"
23+
dest: "/usr/local/share/ca-certificates/OS-TLS-ROOT.crt"
24+
mode: "0644"
25+
when: ansible_facts.os_family == 'Debian'
26+
27+
- name: Update CA trust on Debian family systems
28+
command: "update-ca-certificates"
29+
when: ansible_facts.os_family == 'Debian'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
- name: Generate TLS certificate for pulp
3+
hosts: controllers
4+
run_once: true
5+
vars:
6+
vault_api_addr: "https://{{ internal_net_name | net_ip(groups['controllers'][0]) }}:8200"
7+
vault_intermediate_ca_name: "OS-TLS-INT"
8+
tasks:
9+
- name: Include Vault keys
10+
include_vars:
11+
file: "{{ kayobe_env_config_path }}/vault/overcloud-vault-keys.json"
12+
name: vault_keys
13+
14+
- name: Issue a certificate for pulp TLS
15+
hashivault_pki_cert_issue:
16+
url: "{{ vault_api_addr }}"
17+
ca_cert: "{{ '/etc/pki/tls/certs/ca-bundle.crt' if ansible_facts.os_family == 'RedHat' else '/usr/local/share/ca-certificates/OS-TLS-ROOT.crt' }}"
18+
token: "{{ vault_keys.root_token }}"
19+
mount_point: "{{ vault_intermediate_ca_name }}"
20+
role: "{{ overcloud_vault_pki_internal_tls_role_name }}"
21+
common_name: ""
22+
verify: false
23+
extra_params:
24+
ip_sans: "{{ lookup('vars', admin_oc_net_name ~ '_ips')[groups.seed.0] }}"
25+
register: pulp_cert
26+
environment:
27+
https_proxy: ''
28+
29+
- name: Ensure pulp certificates directory exists
30+
file:
31+
path: "{{ kayobe_env_config_path }}/pulp/certificates"
32+
state: directory
33+
delegate_to: localhost
34+
35+
- name: Copy pulp TLS certificate (including intermediate)
36+
no_log: true
37+
copy:
38+
dest: "{{ kayobe_env_config_path }}/pulp/certificates/pulp.crt"
39+
content: |
40+
{{ pulp_cert.data.certificate }}
41+
{{ pulp_cert.data.issuing_ca }}
42+
mode: 0600
43+
delegate_to: localhost
44+
45+
- name: Copy pulp private key
46+
no_log: true
47+
copy:
48+
dest: "{{ kayobe_env_config_path }}/pulp/certificates/pulp.key"
49+
content: "{{ pulp_cert.data.private_key }}"
50+
mode: 0600
51+
delegate_to: localhost
52+
53+
- import_playbook: copy-ca-to-hosts.yml

etc/kayobe/pulp.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ pulp_port: "{{ '443' if pulp_enable_tls | bool else '80' }}"
1414
pulp_enable_tls: false
1515

1616
# Path to a TLS certificate to use when TLS is enabled.
17-
#pulp_cert_path:
17+
pulp_cert_path: "{{ kayobe_env_config_path ~ '/pulp/certificates/pulp.crt' if pulp_enable_tls | bool else '' }}"
1818

1919
# Path to a TLS key to use when TLS is enabled.
20-
#pulp_key_path:
20+
pulp_key_path: "{{ kayobe_env_config_path ~ '/pulp/certificates/pulp.key' if pulp_enable_tls | bool else '' }}"
2121

2222
###############################################################################
2323
# Local Pulp access credentials
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
features:
3+
- |
4+
Playbooks have been added to allow for the configuration of Pulp with TLS
5+
using certificates generated from vault. Instructions have been added to
6+
the docs.

0 commit comments

Comments
 (0)