f3fbe83708
This pull request adds support for the OpenID Connect authentication flow in Keystone and enables both ID and access token authentication flows. The ID token configuration is designed to allow users to authenticate via Horizon using an identity federation; whereas the Access token is used to allow users to authenticate in the OpenStack CLI using a federated user. Without this PR, if one wants to configure OpenStack to use identity federation, he/she needs to do a lot of configurations in the keystone, Horizon, and register quite a good number of different parameters using the CLI such as mappings, identity providers, federated protocols, and so on. Therefore, with this PR, we propose a method for operators to introduce/present the IdP's metadata to Kolla-ansible, and based on the presented metadata, Kolla-ansible takes care of all of the configurations to prepare OpenStack to work in a federated environment. Implements: blueprint add-openid-support Co-Authored-By: Jason Anderson <jasonanderson@uchicago.edu> Change-Id: I0203a3470d7f8f2a54d5e126d947f540d93b8210
87 lines
2.8 KiB
YAML
87 lines
2.8 KiB
YAML
---
|
|
- name: Remove OpenID certificate and metadata files
|
|
become: true
|
|
vars:
|
|
keystone: "{{ keystone_services['keystone'] }}"
|
|
file:
|
|
state: absent
|
|
path: "{{ item }}"
|
|
when:
|
|
- inventory_hostname in groups[keystone.group]
|
|
with_items:
|
|
- "{{ keystone_host_federation_oidc_metadata_folder }}"
|
|
- "{{ keystone_host_federation_oidc_idp_certificate_folder }}"
|
|
- "{{ keystone_host_federation_oidc_attribute_mappings_folder }}"
|
|
|
|
- name: Create OpenID configuration directories
|
|
vars:
|
|
keystone: "{{ keystone_services['keystone'] }}"
|
|
file:
|
|
dest: "{{ item }}"
|
|
state: "directory"
|
|
mode: "0770"
|
|
become: true
|
|
with_items:
|
|
- "{{ keystone_host_federation_oidc_metadata_folder }}"
|
|
- "{{ keystone_host_federation_oidc_idp_certificate_folder }}"
|
|
- "{{ keystone_host_federation_oidc_attribute_mappings_folder }}"
|
|
when:
|
|
- inventory_hostname in groups[keystone.group]
|
|
|
|
- name: Copying OpenID Identity Providers metadata
|
|
vars:
|
|
keystone: "{{ keystone_services['keystone'] }}"
|
|
become: true
|
|
copy:
|
|
src: "{{ item.metadata_folder }}/"
|
|
dest: "{{ keystone_host_federation_oidc_metadata_folder }}"
|
|
mode: "0660"
|
|
with_items: "{{ keystone_identity_providers }}"
|
|
when:
|
|
- item.protocol == 'openid'
|
|
- inventory_hostname in groups[keystone.group]
|
|
|
|
- name: Copying OpenID Identity Providers certificate
|
|
vars:
|
|
keystone: "{{ keystone_services['keystone'] }}"
|
|
become: true
|
|
copy:
|
|
src: "{{ item.certificate_file }}"
|
|
dest: "{{ keystone_host_federation_oidc_idp_certificate_folder }}"
|
|
mode: "0660"
|
|
with_items: "{{ keystone_identity_providers }}"
|
|
when:
|
|
- item.protocol == 'openid'
|
|
- inventory_hostname in groups[keystone.group]
|
|
|
|
- name: Copying OpenStack Identity Providers attribute mappings
|
|
vars:
|
|
keystone: "{{ keystone_services['keystone'] }}"
|
|
become: true
|
|
copy:
|
|
src: "{{ item.file }}"
|
|
dest: "{{ keystone_host_federation_oidc_attribute_mappings_folder }}/{{ item.file | basename }}"
|
|
mode: "0660"
|
|
with_items: "{{ keystone_identity_mappings }}"
|
|
when:
|
|
- inventory_hostname in groups[keystone.group]
|
|
|
|
- name: Setting the certificates files variable
|
|
become: true
|
|
vars:
|
|
keystone: "{{ keystone_services['keystone'] }}"
|
|
find:
|
|
path: "{{ keystone_host_federation_oidc_idp_certificate_folder }}"
|
|
pattern: "*.pem"
|
|
register: certificates_path
|
|
when:
|
|
- inventory_hostname in groups[keystone.group]
|
|
|
|
- name: Setting the certificates variable
|
|
vars:
|
|
keystone: "{{ keystone_services['keystone'] }}"
|
|
set_fact:
|
|
keystone_federation_openid_certificate_key_ids: "{{ certificates_path.files | map(attribute='path') | map('regex_replace', '^.*/(.*)\\.pem$', '\\1#' + keystone_container_federation_oidc_idp_certificate_folder + '/\\1.pem') | list }}" # noqa 204
|
|
when:
|
|
- inventory_hostname in groups[keystone.group]
|