regenconf: be paranoid and force the boolean setting to be yes/no

This commit is contained in:
Alexandre Aubin 2023-06-20 19:23:42 +02:00
parent 839672d28f
commit 1e4e7044a4
2 changed files with 5 additions and 1 deletions

View file

@ -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)))'
}

View file

@ -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"