Compare commits
16 Commits
a9e6253449
...
default-va
Author | SHA1 | Date | |
---|---|---|---|
81f6948104 | |||
e6f973805b | |||
9054f14223 | |||
547eb73d6c | |||
2b4e669cc3 | |||
e88e45ac91 | |||
03cc82f26e | |||
2f464faff3 | |||
a8a1632eb6 | |||
d259417d47 | |||
8bc50e1533 | |||
9261bff896 | |||
19bc989486 | |||
2bbef92ed9 | |||
571c297741 | |||
7c745e2cf9 |
@ -1,4 +1,6 @@
|
||||
---
|
||||
install_only: false
|
||||
|
||||
# cadoles-pod repository configuration
|
||||
cadoles_pod_debian_repository_url: https://vulcain.cadoles.com
|
||||
cadoles_pod_debian_repository: bullseye-dev
|
||||
@ -15,7 +17,8 @@ cadoles_pod_hydra_oidc_v1_package_version: '*'
|
||||
cadoles_pod_hydra_ldap_v1_package_version: '*'
|
||||
|
||||
# Hydra database configuration
|
||||
hydra_use_external_database: no
|
||||
hydra_use_external_database: false
|
||||
hydra_auto_migrate: false
|
||||
hydra_database_name: hydra
|
||||
hydra_database_user: hydra
|
||||
hydra_database_password: hydra
|
||||
@ -61,6 +64,7 @@ hydra_clients:
|
||||
|
||||
# Hydra dispatcher configuration
|
||||
|
||||
enable_hydra_dispatcher: true
|
||||
hydra_dispatcher_cookie_path: "{{ haproxy_hydra_dispatcher_base_path }}"
|
||||
hydra_dispatcher_debug: no
|
||||
hydra_dispatcher_admin_authorized_hosts:
|
||||
@ -162,6 +166,9 @@ hydra_saml_debug: no
|
||||
# Niveau de verbosité du service shibboleth-sp
|
||||
hydra_saml_sp_log_level: WARN
|
||||
|
||||
# Durée de vie des "refresh_token"
|
||||
hydra_ttl_refresh_token: "24h"
|
||||
|
||||
# Inclure les règles de cartographie des attributs SAML fournis par défaut par le projet hydra-shibboleth-sp-v3
|
||||
hydra_saml_include_sp_default_attributes_mapping: "yes"
|
||||
|
||||
|
@ -4,36 +4,42 @@
|
||||
name: haproxy
|
||||
state: restarted
|
||||
become: true
|
||||
when: not install_only
|
||||
|
||||
- name: Restart cadoles-pod-hydra-v1
|
||||
service:
|
||||
name: cadoles-pod-hydra-v1
|
||||
state: restarted
|
||||
become: true
|
||||
when: not install_only
|
||||
|
||||
- name: Restart cadoles-pod-hydra-dispatcher-v1
|
||||
service:
|
||||
name: cadoles-pod-hydra-dispatcher-v1
|
||||
state: restarted
|
||||
become: true
|
||||
when: not install_only
|
||||
|
||||
- name: Restart cadoles-pod-hydra-passwordless-v1
|
||||
service:
|
||||
name: cadoles-pod-hydra-passwordless-v1
|
||||
state: restarted
|
||||
become: true
|
||||
when: not install_only
|
||||
|
||||
- name: Restart cadoles-pod-hydra-remote-user-v1
|
||||
service:
|
||||
name: cadoles-pod-hydra-remote-user-v1
|
||||
state: restarted
|
||||
become: true
|
||||
when: not install_only
|
||||
|
||||
- name: Restart cadoles-pod-shibboleth-sp-v3
|
||||
service:
|
||||
name: cadoles-pod-shibboleth-sp-v3
|
||||
state: restarted
|
||||
become: true
|
||||
when: not install_only
|
||||
|
||||
- name: Restart cadoles-pod-hydra-oidc-v1
|
||||
service:
|
||||
@ -46,13 +52,16 @@
|
||||
name: cadoles-pod-hydra-ldap-v1
|
||||
state: restarted
|
||||
become: true
|
||||
when: not install_only
|
||||
|
||||
- name: Restart cadoles-pod-goweb-oidc-v1
|
||||
service:
|
||||
name: cadoles-pod-goweb-oidc-v1
|
||||
state: restarted
|
||||
become: true
|
||||
when: not install_only
|
||||
|
||||
- name: Reload hydra clients
|
||||
ansible.builtin.include_tasks:
|
||||
file: hydra-reload-clients.yml
|
||||
when: not install_only
|
||||
|
@ -86,6 +86,9 @@ properties:
|
||||
hydra_log_leak_sensitive_values:
|
||||
type: boolean
|
||||
|
||||
hydra_ttl_refresh_token:
|
||||
type: string
|
||||
|
||||
# This value should not be changed after first deployment !
|
||||
hydra_secrets_seed:
|
||||
type: string
|
||||
|
@ -13,11 +13,21 @@
|
||||
when: item.client_id == client_id
|
||||
become: true
|
||||
|
||||
- name: Delete client
|
||||
command: podman exec -t cadoles-pod-hydra-v1 /bin/sh -c "hydra clients delete {{ client_id }} --endpoint http://127.0.0.1:4445"
|
||||
ignore_errors: true
|
||||
- name: Update client
|
||||
command: >
|
||||
podman exec -t cadoles-pod-hydra-v1 /bin/sh -c "hydra clients update '{{ client_id }}'
|
||||
--endpoint http://127.0.0.1:4445
|
||||
--name '{{ item.client_name | default(item.client_id) }}'
|
||||
--secret '{{ item.client_secret | default(lookup('ansible.builtin.password', '/dev/null chars=ascii_lowercase,digits length=32 seed=inventory_hostname')) }}'
|
||||
--grant-types '{{ ','.join(item.grant_types) if "grant_types" in item else "authorization_code, refresh_token" }}'
|
||||
--post-logout-callbacks '{{ ','.join(item.post_logout_redirect_uris) if "post_logout_redirect_uris" in item else "" }}'
|
||||
--callbacks '{{ ','.join(item.redirect_uris) }}'
|
||||
--response-types '{{ ','.join(item.response_types) if "response_types" in item else "code" }}'
|
||||
--logo-uri '{{ item.logo_uri if "logo_uri" in item else "" }}'
|
||||
--scope '{{ ','.join(item.scope) if "scope" in item else "openid profile email webhook" }}'
|
||||
--token-endpoint-auth-method '{{ item.token_endpoint_auth_method if "token_endpoint_auth_method" in item else "client_secret_post" }}'
|
||||
"
|
||||
with_items: "{{ hydra_clients }}"
|
||||
when: item.client_id == client_id
|
||||
become: true
|
||||
|
||||
- name: Import client
|
||||
command: podman exec -t cadoles-pod-hydra-v1 /bin/sh -c "hydra clients import /etc/hydra/clients.d/{{ client_id }}.json --endpoint http://127.0.0.1:4445"
|
||||
become: true
|
||||
|
45
tasks/install-hydra.yml
Normal file
45
tasks/install-hydra.yml
Normal file
@ -0,0 +1,45 @@
|
||||
---
|
||||
|
||||
- name: Install Hydra
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- cadoles-pod-hydra-v1={{ cadoles_pod_hydra_v1_package_version }}
|
||||
update_cache: yes
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Configure Hydra local database
|
||||
ansible.builtin.include_tasks: hydra-database.yml
|
||||
when: not hydra_use_external_database
|
||||
|
||||
- name: Configure cadoles-pod-hydra-v1
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
with_items:
|
||||
- src: cadoles-pod-hydra-v1.conf.j2
|
||||
dest: /etc/cadoles-pod-hydra-v1.conf
|
||||
notify:
|
||||
- Restart cadoles-pod-hydra-v1
|
||||
become: true
|
||||
|
||||
- name: Check cadoles-pod-hydra-v1 status
|
||||
service:
|
||||
name: cadoles-pod-hydra-v1
|
||||
state: started
|
||||
become: true
|
||||
|
||||
- name: Migrate Hydra database schema
|
||||
command: podman exec -it cadoles-pod-hydra-v1 migrate-hydra-schema
|
||||
become: true
|
||||
when: hydra_auto_migrate
|
||||
|
||||
- name: Create hydra-clients
|
||||
template:
|
||||
src: hydra-client.json.j2
|
||||
dest: "/etc/hydra/clients.d/{{ item.client_id }}.json"
|
||||
with_items: "{{ hydra_clients }}"
|
||||
notify:
|
||||
- Reload hydra clients
|
||||
become: true
|
||||
|
@ -9,24 +9,28 @@
|
||||
update_cache: yes
|
||||
state: present
|
||||
become: true
|
||||
tags: [ hydra-only ]
|
||||
|
||||
- name: Add LetsEncrypt missing intermediate certificates
|
||||
command: "bash -c 'wget -O- --no-check-certificate https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash'"
|
||||
args:
|
||||
creates: /etc/ssl/certs/lets-encrypt-e1.pem.pem
|
||||
become: true
|
||||
tags: [ hydra-only ]
|
||||
|
||||
- name: Add cadoles-pod debian repository key
|
||||
ansible.builtin.apt_key:
|
||||
url: "{{ cadoles_pod_debian_repository_key_url }}"
|
||||
state: present
|
||||
become: true
|
||||
tags: [ hydra-only ]
|
||||
|
||||
- name: Configure cadoles-pod debian repository
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb {{ cadoles_pod_debian_repository_url }} {{ cadoles_pod_debian_repository }} main"
|
||||
state: present
|
||||
become: true
|
||||
tags: [ hydra-only ]
|
||||
|
||||
- name: Ensure sysctl configuration
|
||||
ansible.posix.sysctl:
|
||||
@ -39,39 +43,30 @@
|
||||
- name: fs.inotify.max_user_watches
|
||||
value: 204800
|
||||
become: true
|
||||
tags: [ hydra-only ]
|
||||
|
||||
- name: Install core packages
|
||||
- name: Install HAProxy
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- haproxy={{ haproxy_package_version }}
|
||||
- cadoles-pod-hydra-v1={{ cadoles_pod_hydra_v1_package_version }}
|
||||
- cadoles-pod-hydra-dispatcher-v1={{ cadoles_pod_hydra_dispatcher_v1_package_version }}
|
||||
update_cache: yes
|
||||
state: present
|
||||
become: true
|
||||
tags: [ hydra-only ]
|
||||
|
||||
- name: Configure Hydra local database
|
||||
ansible.builtin.include_tasks: hydra-database.yml
|
||||
when: not hydra_use_external_database
|
||||
- name: Install Hydra
|
||||
include_tasks:
|
||||
file: ./install-hydra.yml
|
||||
apply:
|
||||
tags: [ hydra-only ]
|
||||
tags: [ hydra-only ]
|
||||
|
||||
- name: Create hydra-clients
|
||||
template:
|
||||
src: hydra-client.json.j2
|
||||
dest: "/etc/hydra/clients.d/{{ item.client_id }}.json"
|
||||
with_items: "{{ hydra_clients }}"
|
||||
notify:
|
||||
- Reload hydra clients
|
||||
become: true
|
||||
|
||||
- name: Configure cadoles-pod-hydra-v1
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
with_items:
|
||||
- src: cadoles-pod-hydra-v1.conf.j2
|
||||
dest: /etc/cadoles-pod-hydra-v1.conf
|
||||
notify:
|
||||
- Restart cadoles-pod-hydra-v1
|
||||
- name: Install hydra-dispatcher
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- cadoles-pod-hydra-dispatcher-v1={{ cadoles_pod_hydra_dispatcher_v1_package_version }}
|
||||
update_cache: yes
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Configure cadoles-pod-hydra-dispatcher-v1
|
||||
@ -108,11 +103,11 @@
|
||||
|
||||
- name: Start OIDC Test app if enabled
|
||||
ansible.builtin.include_tasks: start-oidc-test.yml
|
||||
when: enable_oidc_test_app
|
||||
when: enable_oidc_test_app and not install_only
|
||||
|
||||
- name: Stop OIDC Test app if disabled
|
||||
ansible.builtin.include_tasks: stop-oidc-test.yml
|
||||
when: not enable_oidc_test_app
|
||||
when: not enable_oidc_test_app and not install_only
|
||||
|
||||
- name: Configure HAProxy
|
||||
template:
|
||||
@ -121,4 +116,5 @@
|
||||
validate: "haproxy -c -f %s"
|
||||
notify:
|
||||
- Restart HAProxy
|
||||
become: true
|
||||
become: true
|
||||
tags: [ hydra-only ]
|
||||
|
25
tasks/update-hydra-dispatcher.yml
Normal file
25
tasks/update-hydra-dispatcher.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
# Simple task to update the package/container cadoles-pod-hydra-dispatcher only.
|
||||
- name: Install hydra-dispatcher package
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- cadoles-pod-hydra-dispatcher-v1={{ cadoles_pod_hydra_dispatcher_v1_package_version }}
|
||||
update_cache: yes
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Configure cadoles-pod-hydra-dispatcher-v1
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: "{{ item.mode }}"
|
||||
with_items:
|
||||
- src: cadoles-pod-hydra-dispatcher-v1.conf.j2
|
||||
dest: /etc/cadoles-pod-hydra-dispatcher-v1.conf
|
||||
mode: u=rw,g=r
|
||||
- src: hydra-dispatcher-apps.yml.j2
|
||||
dest: /etc/hydra-dispatcher/conf.d/apps.yml
|
||||
mode: u=rw,g=r,o=r
|
||||
notify:
|
||||
- Restart cadoles-pod-hydra-dispatcher-v1
|
||||
become: true
|
22
tasks/update-hydra-sp.yml
Normal file
22
tasks/update-hydra-sp.yml
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
# Simple task to update the package/container cadoles-pod-shibboleth-sp only.
|
||||
- name: Install hydra-shibboleth package
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- cadoles-pod-shibboleth-sp-v3={{ cadoles_pod_shibboleth_sp_v3_package_version }}
|
||||
update_cache: yes
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Configure cadoles-pod-shibboleth-sp-v3
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: "{{ item.mode }}"
|
||||
with_items:
|
||||
- src: cadoles-pod-shibboleth-sp-v3.conf.j2
|
||||
dest: /etc/cadoles-pod-shibboleth-sp-v3.conf
|
||||
mode: u=rw,g=r
|
||||
notify:
|
||||
- Restart cadoles-pod-shibboleth-sp-v3
|
||||
become: true
|
31
tasks/update-hydra.yml
Normal file
31
tasks/update-hydra.yml
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
# Simple task to update the package/container cadoles-pod-hydra only.
|
||||
- name: Install hydra package
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- cadoles-pod-hydra-v1={{ cadoles_pod_hydra_v1_package_version }}
|
||||
update_cache: yes
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Configure cadoles-pod-hydra-v1
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: "{{ item.mode }}"
|
||||
with_items:
|
||||
- src: cadoles-pod-hydra-v1.conf.j2
|
||||
dest: /etc/cadoles-pod-hydra-v1.conf
|
||||
mode: u=rw,g=r
|
||||
notify:
|
||||
- Restart cadoles-pod-hydra-v1
|
||||
become: true
|
||||
|
||||
- name: Create hydra-clients
|
||||
template:
|
||||
src: hydra-client.json.j2
|
||||
dest: "/etc/hydra/clients.d/{{ item.client_id }}.json"
|
||||
with_items: "{{ hydra_clients }}"
|
||||
notify:
|
||||
- Reload hydra clients
|
||||
become: true
|
@ -18,6 +18,7 @@ PODMAN_ARGS="\
|
||||
-e 'HYDRA_URL_POST_LOGOUT={{ hydra_url_post_logout }}' \
|
||||
-e 'HYDRA_ALLOW_INSECURE=yes' \
|
||||
-e 'HYDRA_LEVEL={{ hydra_log_level }}' \
|
||||
-e 'TTL_REFRESH_TOKEN={{ hydra_ttl_refresh_token }}'\
|
||||
{% if hydra_public_cors_allowed_origins | default([]) | length > 0 %}
|
||||
-e 'SERVE_PUBLIC_CORS_ENABLED=true' \
|
||||
-e 'SERVE_PUBLIC_CORS_ALLOWED_ORIGINS={{ hydra_public_cors_allowed_origins | join(',') }}' \
|
||||
|
@ -12,7 +12,7 @@ PODMAN_ARGS="\
|
||||
-e 'APACHE_FORCE_HTTPS={{ "true" if haproxy_public_base_url.startswith('https') else "false" }}' \
|
||||
-e 'SP_HANDLER_BASE_PATH={{ haproxy_hydra_saml_base_path }}' \
|
||||
-e 'SP_SESSIONS_REDIRECT_LIMIT=host+allow' \
|
||||
-e 'SP_SESSIONS_REDIRECT_ALLOW={{ hydra_saml_allowed_redirects | join(',') }}' \
|
||||
-e 'SP_SESSIONS_REDIRECT_ALLOW={{ hydra_saml_allowed_redirects | default([]) | join(' ') }}' \
|
||||
-e 'SP_INCLUDE_DEFAULT_ATTRIBUTES_MAPPING={{ hydra_saml_include_sp_default_attributes_mapping }}' \
|
||||
-e 'SP_INCLUDE_DEFAULT_ATTRIBUTES_POLICY={{ hydra_saml_include_sp_default_attributes_policy }}' \
|
||||
-v '/etc/shibboleth/attribute-map.inc.xml:/etc/shibboleth/attribute-map.inc.xml' \
|
||||
|
@ -39,8 +39,9 @@ frontend http-in
|
||||
mode http
|
||||
|
||||
maxconn 2000
|
||||
|
||||
{% if enable_hydra_dispatcher %}
|
||||
acl login_dispatcher path_beg -i {{ haproxy_hydra_dispatcher_base_path }}
|
||||
{% endif %}
|
||||
{% if enable_hydra_passwordless %}
|
||||
acl login_passwordless path_beg -i {{ haproxy_hydra_passwordless_base_path }}
|
||||
{% endif %}
|
||||
@ -57,7 +58,9 @@ frontend http-in
|
||||
acl oidc_test path_beg -i {{ haproxy_oidc_test_base_path }}
|
||||
{% endif %}
|
||||
|
||||
{% if enable_hydra_dispatcher %}
|
||||
use_backend hydra_dispatcher if login_dispatcher
|
||||
{% endif %}
|
||||
{% if enable_hydra_passwordless %}
|
||||
use_backend hydra_passwordless if login_passwordless
|
||||
{% endif %}
|
||||
@ -86,6 +89,7 @@ backend hydra
|
||||
http-request set-path %[path,regsub(^{{ haproxy_hydra_base_path }},)]
|
||||
server hydra 127.0.0.1:4444 check
|
||||
|
||||
{% if enable_hydra_dispatcher %}
|
||||
# Backend Hydra Dispatcher
|
||||
backend hydra_dispatcher
|
||||
balance roundrobin
|
||||
@ -94,6 +98,7 @@ backend hydra_dispatcher
|
||||
http-request set-header X-Forwarded-Prefix {{ haproxy_hydra_dispatcher_base_path }}
|
||||
|
||||
server hydra-login-dispatcher 127.0.0.1:3000 check
|
||||
{%- endif %}
|
||||
|
||||
{% if enable_hydra_passwordless %}
|
||||
# Backend Hydra Passwordless
|
||||
|
Reference in New Issue
Block a user