diff --git a/src/freedombone-app-xmpp b/src/freedombone-app-xmpp index 692e2bf03b3dad9dbcffe9cd00e0821425a07bb5..e79665d7ada0e95e5abd55458efb9c18c8216738 100755 --- a/src/freedombone-app-xmpp +++ b/src/freedombone-app-xmpp @@ -247,21 +247,46 @@ function xmpp_remove_onion_address_interactive { } function configure_interactive_xmpp { - W=(1 $"Add an ICANN to onion domain mapping" - 2 $"Remove an ICANN to onion domain mapping") while true do + e2ee_policy=$'optional' + if [[ "$XMPP_E2EE" == 'y'* || "$XMPP_E2EE" == 't'* ]]; then + e2ee_policy=$'required' + fi + + W=(1 $"End-to-end security policy: $e2ee_policy" + 2 $"Add an ICANN to onion domain mapping" + 3 $"Remove an ICANN to onion domain mapping") + # shellcheck disable=SC2068 - selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"XMPP" --menu $"Choose an operation, or ESC to exit:" 10 60 2 "${W[@]}" 3>&2 2>&1 1>&3) + selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"XMPP" --menu $"Choose an operation, or ESC to exit:" 11 60 3 "${W[@]}" 3>&2 2>&1 1>&3) if [ ! "$selection" ]; then break fi case $selection in - 1) xmpp_add_onion_address_interactive;; - 2) xmpp_remove_onion_address_interactive;; + 1) if [[ "$XMPP_E2EE" == 'y'* || "$XMPP_E2EE" == 't'* ]]; then + XMPP_E2EE='no' + else + XMPP_E2EE='yes' + fi + write_config_param 'XMPP_E2EE' "$XMPP_E2EE" + xmpp_update_e2e_policy /etc/prosody/conf.avail/xmpp.cfg.lua + xmpp_update_e2e_policy /etc/prosody/prosody.cfg.lua + systemctl restart prosody + + e2ee_policy=$'optional' + if [[ "$XMPP_E2EE" == 'y'* || "$XMPP_E2EE" == 't'* ]]; then + e2ee_policy=$'required' + fi + + dialog --title $"xmpp end-to-end security policy" \ + --msgbox $"The security policy has been changed to $e2ee_policy" 6 70 + ;; + 2) xmpp_add_onion_address_interactive;; + 3) xmpp_remove_onion_address_interactive;; esac done } @@ -524,6 +549,7 @@ function upgrade_xmpp { fi fi + read_config_param XMPP_E2EE xmpp_update_e2e_policy /etc/prosody/conf.avail/xmpp.cfg.lua xmpp_update_e2e_policy /etc/prosody/prosody.cfg.lua