From d798e086d2a87c7a150f56dd4544237328fa81ef Mon Sep 17 00:00:00 2001 From: Tommaso Bailetti Date: Tue, 5 Nov 2024 17:42:27 +0100 Subject: [PATCH] fix: add missing ISSUER_2FA default --- imageroot/update-module.d/11set_twofa_provider | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 imageroot/update-module.d/11set_twofa_provider diff --git a/imageroot/update-module.d/11set_twofa_provider b/imageroot/update-module.d/11set_twofa_provider new file mode 100755 index 0000000..1a238e7 --- /dev/null +++ b/imageroot/update-module.d/11set_twofa_provider @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +# +# Copyright (C) 2024 Nethesis S.r.l. +# SPDX-License-Identifier: GPL-3.0-or-later +# + +# sets a 2FA provider in the config.env file +with open('config.env', 'a+') as file: + already_exists = False + fqdn = '' + while line := file.readline(): + if line.startswith('FQDN'): + fqdn = line.split('=')[1].strip() + if line.startswith('ISSUER_2FA'): + already_exists = True + if not already_exists: + file.write(f'ISSUER_2FA={fqdn}\n')