From 1e4e7044a4d46e737777dd79ef32e3c17fd3bc8c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 20 Jun 2023 19:23:42 +0200 Subject: [PATCH] regenconf: be paranoid and force the boolean setting to be yes/no --- helpers/utils | 4 ++++ hooks/conf_regen/03-ssh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/helpers/utils b/helpers/utils index 52d7c734f..1f5de6dfd 100644 --- a/helpers/utils +++ b/helpers/utils @@ -1085,6 +1085,10 @@ int_to_bool() { sed -e 's/^1$/True/g' -e 's/^0$/False/g' } +int_to_yesno() { + sed -e 's/^1$/yes/g' -e 's/^0$/no/g' +} + toml_to_json() { python3 -c 'import toml, json, sys; print(json.dumps(toml.load(sys.stdin)))' } diff --git a/hooks/conf_regen/03-ssh b/hooks/conf_regen/03-ssh index d0351b4e5..d2dff49e4 100755 --- a/hooks/conf_regen/03-ssh +++ b/hooks/conf_regen/03-ssh @@ -17,7 +17,7 @@ do_pre_regen() { # Support different strategy for security configurations export compatibility="$(yunohost settings get 'security.ssh.ssh_compatibility')" export port="$(yunohost settings get 'security.ssh.ssh_port')" - export password_authentication="$(yunohost settings get 'security.ssh.ssh_password_authentication' | int_to_bool)" + export password_authentication="$(yunohost settings get 'security.ssh.ssh_password_authentication' | int_to_yesno)" export ssh_keys export ipv6_enabled ynh_render_template "sshd_config" "${pending_dir}/etc/ssh/sshd_config"