From 7d04781b58ce2bd8fe129867f246b0dc013c06cf Mon Sep 17 00:00:00 2001 From: Christian Iuga Date: Wed, 10 Jan 2024 11:44:16 +0100 Subject: [PATCH] Add TOTP Configuration --- README.md | 8 ++++++++ tasks/main.yml | 2 +- templates/etc/guacamole/guacamole.properties.j2 | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a5cd12e..956ca37 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,14 @@ For any required Ansible roles, review: [defaults/main.yml](defaults/main.yml) +### TOTP Configuration + +To enable Two factor authentification, create a variable `guacamole_totp`: +``` +guacamole_totp: + issuer: 'guacamole.exemple.com' + period: 60 +``` ## Dependencies ## Example Playbook diff --git a/tasks/main.yml b/tasks/main.yml index 9c7f4d7..7148857 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -29,4 +29,4 @@ - name: Manage Guacamole TOTP configurations ansible.builtin.include_tasks: totp.yml - when: guacamole_totp | default(false) | bool + when: guacamole_totp is defined diff --git a/templates/etc/guacamole/guacamole.properties.j2 b/templates/etc/guacamole/guacamole.properties.j2 index a478ec8..08f1aee 100644 --- a/templates/etc/guacamole/guacamole.properties.j2 +++ b/templates/etc/guacamole/guacamole.properties.j2 @@ -100,3 +100,18 @@ ldap-max-referral-hops: {{ guacamole_ldap['max_referral_hops'] }} ldap-operation-timeout: {{ guacamole_ldap['operation_timeout'] }} {% endif %} {% endif %} +{# TOTP Configuration #} +{% if guacamole_totp is defined %} +{% if guacamole_totp['issuer'] is defined %} +totp-issuer: {{ guacamole_totp['issuer'] }} +{% endif %} +{% if guacamole_totp['digits'] is defined %} +totp-digits: {{ guacamole_totp['digits'] }} +{% endif %} +{% if guacamole_totp['period'] is defined %} +totp-period: {{ guacamole_totp['period'] }} +{% endif %} +{% if guacamole_totp['mode'] is defined %} +totp-mode: {{ guacamole_totp['mode'] }} +{% endif %} +{% endif %}