New Version
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
unredirected_headers: [Authorization]
|
||||
timeout: 30
|
||||
block:
|
||||
- name: Validate optional logout redirect before API changes
|
||||
ansible.builtin.assert:
|
||||
that: pve_logout_redirect_uri in pve_redirect_uris
|
||||
when: pve_logout_enabled | default(false) | bool
|
||||
- name: Obtain short-lived admin token
|
||||
ansible.builtin.uri:
|
||||
url: "{{ keycloak_base_url }}/realms/{{ keycloak_admin_realm }}/protocol/openid-connect/token"
|
||||
@@ -100,6 +104,10 @@
|
||||
kc_session_attributes:
|
||||
client.session.idle.timeout: "{{ keycloak_client_idle | string }}"
|
||||
client.session.max.lifespan: "{{ keycloak_client_max | string }}"
|
||||
- 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}) }}"
|
||||
when: pve_logout_enabled | default(false) | bool
|
||||
- name: Create confidential PVE client
|
||||
ansible.builtin.uri:
|
||||
url: "{{ kc_api }}/clients"
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
- name: Reject unsupported patch dry-run
|
||||
ansible.builtin.assert:
|
||||
that: not ansible_check_mode
|
||||
fail_msg: 'Logout-Patch bitte regulär ausführen; --check wird nicht unterstützt.'
|
||||
- name: Read installed PVE version
|
||||
ansible.builtin.command: pveversion
|
||||
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'
|
||||
when: pve_logout_enabled | default(false) | bool
|
||||
- name: Install guarded patch helper
|
||||
ansible.builtin.copy:
|
||||
src: ../scripts/logout_patch.py
|
||||
dest: /usr/local/sbin/pve-idm-logout-patch
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0700'
|
||||
- name: Apply or remove managed desktop logout patch
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- python3
|
||||
- /usr/local/sbin/pve-idm-logout-patch
|
||||
- --target
|
||||
- /usr/share/pve-manager/js/pvemanagerlib.js
|
||||
- --state-dir
|
||||
- /var/lib/pve-idm/logout
|
||||
- --enabled
|
||||
- "{{ (pve_logout_enabled | default(false) | bool) | ternary('true', 'false') }}"
|
||||
- --version
|
||||
- "{{ logout_version.stdout | default('') }}"
|
||||
- --realm
|
||||
- "{{ pve_realm }}"
|
||||
- --endpoint
|
||||
- "{{ (logout_discovery.json | default({})).get('end_session_endpoint', '') }}"
|
||||
- --client
|
||||
- "{{ keycloak_client_id }}"
|
||||
- --redirect
|
||||
- "{{ pve_logout_redirect_uri | default('') }}"
|
||||
register: logout_patch_result
|
||||
changed_when: (logout_patch_result.stdout | from_json).changed
|
||||
Reference in New Issue
Block a user