New Version
This commit is contained in:
@@ -104,9 +104,12 @@
|
||||
kc_session_attributes:
|
||||
client.session.idle.timeout: "{{ keycloak_client_idle | string }}"
|
||||
client.session.max.lifespan: "{{ keycloak_client_max | string }}"
|
||||
- name: Prepare verified logout redirect chain
|
||||
ansible.builtin.include_tasks: logout_plan.yml
|
||||
when: pve_logout_enabled | default(false) | bool
|
||||
- name: Register explicit post-logout return address
|
||||
ansible.builtin.set_fact:
|
||||
kc_session_attributes: "{{ kc_session_attributes | combine({'post.logout.redirect.uris': pve_logout_redirect_uri}) }}"
|
||||
kc_session_attributes: "{{ kc_session_attributes | combine({'post.logout.redirect.uris': logout_plan.allowed_redirects | join('##')}) }}"
|
||||
when: pve_logout_enabled | default(false) | bool
|
||||
- name: Create confidential PVE client
|
||||
ansible.builtin.uri:
|
||||
|
||||
@@ -7,26 +7,8 @@
|
||||
register: logout_version
|
||||
changed_when: false
|
||||
when: pve_logout_enabled | default(false) | bool
|
||||
- name: Validate logout return address
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- pve_logout_redirect_uri in pve_redirect_uris
|
||||
fail_msg: 'Logout-Rücksprung muss einer konfigurierten PVE-Browser-URL entsprechen.'
|
||||
when: pve_logout_enabled | default(false) | bool
|
||||
- name: Discover verified Keycloak logout endpoint
|
||||
ansible.builtin.uri:
|
||||
url: "{{ pve_oidc_issuer }}/.well-known/openid-configuration"
|
||||
validate_certs: true
|
||||
ca_path: "{{ system_ca_bundle }}"
|
||||
use_proxy: false
|
||||
follow_redirects: none
|
||||
register: logout_discovery
|
||||
when: pve_logout_enabled | default(false) | bool
|
||||
- name: Validate discovered endpoint and issuer
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- logout_discovery.json.issuer == pve_oidc_issuer
|
||||
- logout_discovery.json.end_session_endpoint == pve_oidc_issuer ~ '/protocol/openid-connect/logout'
|
||||
- name: Prepare verified logout sequence
|
||||
ansible.builtin.include_tasks: logout_plan.yml
|
||||
when: pve_logout_enabled | default(false) | bool
|
||||
- name: Install guarded patch helper
|
||||
ansible.builtin.copy:
|
||||
@@ -52,6 +34,8 @@
|
||||
- "{{ pve_realm }}"
|
||||
- --endpoint
|
||||
- "{{ (logout_discovery.json | default({})).get('end_session_endpoint', '') }}"
|
||||
- --endpoints-json
|
||||
- "{{ (logout_plan | default({})).get('endpoints', []) | to_json }}"
|
||||
- --client
|
||||
- "{{ keycloak_client_id }}"
|
||||
- --redirect
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
- name: Read canonical discovery with CA verification
|
||||
ansible.builtin.uri:
|
||||
url: "{{ pve_oidc_issuer }}/.well-known/openid-configuration"
|
||||
validate_certs: true
|
||||
ca_path: "{{ system_ca_bundle }}"
|
||||
use_proxy: false
|
||||
follow_redirects: none
|
||||
register: logout_discovery
|
||||
- name: Validate canonical issuer and return address
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- logout_discovery.json.issuer == pve_oidc_issuer
|
||||
- pve_logout_redirect_uri in pve_redirect_uris
|
||||
- name: Build explicit logout sequence and exact allowed redirects
|
||||
ansible.builtin.set_fact:
|
||||
logout_plan: "{{ (pve_logout_endpoints | default([]) or [logout_discovery.json.end_session_endpoint]) | pve_idm_logout_plan(keycloak_client_id, pve_logout_redirect_uri) }}"
|
||||
- name: Verify both host certificates and realm discovery
|
||||
ansible.builtin.uri:
|
||||
url: "{{ item | regex_replace('/protocol/openid-connect/logout$', '/.well-known/openid-configuration') }}"
|
||||
validate_certs: true
|
||||
ca_path: "{{ system_ca_bundle }}"
|
||||
use_proxy: false
|
||||
follow_redirects: none
|
||||
loop: "{{ logout_plan.endpoints }}"
|
||||
register: logout_alias_discovery
|
||||
- name: Require all aliases to advertise the same canonical realm issuer
|
||||
ansible.builtin.assert:
|
||||
that: item.json.issuer == pve_oidc_issuer
|
||||
loop: "{{ logout_alias_discovery.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.item }}"
|
||||
Reference in New Issue
Block a user