Commit ce5b9f01 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Bugfix and UX improvements

parent 326c45c4
...@@ -952,7 +952,7 @@ function jobs () ...@@ -952,7 +952,7 @@ function jobs ()
"SSH" ) "SSH" )
while true; do while true; do
DIALOG_CANCEL=1 DIALOG_CANCEL=2
DIALOG_ESC=255 DIALOG_ESC=255
LIST_CONST=7 LIST_CONST=7
...@@ -962,11 +962,11 @@ function jobs () ...@@ -962,11 +962,11 @@ function jobs ()
PasswordAuthentication=""; PasswordAuthentication="";
PhoneAuthentication="" PhoneAuthentication=""
MergeParameter=""; MergeParameter="";
EXTRABUTTON=""; Buttons="--no-cancel --ok-label "Save" --help-button --help-label Cancel"
# read values # read values
[[ $(grep "^PermitRootLogin" /etc/ssh/sshd_config | awk '{print $2}') == "yes" ]] && PermitRootLogin="on" [[ $(grep "^PermitRootLogin" /etc/ssh/sshd_config | awk '{print $2}') == "yes" ]] && PermitRootLogin="on"
[[ $(grep "^PasswordAuthentication" /etc/ssh/sshd_config | awk '{print $2}') == "yes" ]] && PasswordAuthentication="on" [[ $(grep "^@include common-auth" /etc/pam.d/sshd | awk '{print $2}') == "common-auth" ]] && PasswordAuthentication="on"
[[ $(grep "^PubkeyAuthentication" /etc/ssh/sshd_config | awk '{print $2}') == "yes" ]] && PubkeyAuthentication="on" [[ $(grep "^PubkeyAuthentication" /etc/ssh/sshd_config | awk '{print $2}') == "yes" ]] && PubkeyAuthentication="on"
[[ -n $(grep "pam_google_authenticator.so" /etc/pam.d/sshd) ]] && PhoneAuthentication="on" [[ -n $(grep "pam_google_authenticator.so" /etc/pam.d/sshd) ]] && PhoneAuthentication="on"
...@@ -977,15 +977,17 @@ function jobs () ...@@ -977,15 +977,17 @@ function jobs ()
MOTD+=( "PhoneAuthentication" "Mobile phone one-time passcode" "$PhoneAuthentication" ) MOTD+=( "PhoneAuthentication" "Mobile phone one-time passcode" "$PhoneAuthentication" )
LISTLENGHT="$(($LIST_CONST+${#MOTD[@]}/2))" LISTLENGHT="$(($LIST_CONST+${#MOTD[@]}/2))"
Buttons="--no-cancel --ok-label "Save" --help-button --help-label Cancel"
if [[ $PhoneAuthentication == "on" ]]; then if [[ $PhoneAuthentication == "on" ]]; then
EXTRABUTTON="--help-button --help-label Generate-token"; Buttons="--cancel-label Generate-token --ok-label "Save" --help-button --help-label Cancel"
[[ -f ~/.google_authenticator ]] && EXTRABUTTON="--help-button --help-label Generate-token --extra-button --extra-label Show-token"; if [[ -f ~/.google_authenticator ]]; then
Buttons="--cancel-label New-token --ok-label "Save" --help-button --help-label Cancel --extra-button --extra-label Show-token"
fi
fi fi
exec 3>&1 exec 3>&1
selection=$(dialog $EXTRABUTTON --backtitle "$BACKTITLE" --title " Toggle sshd options " --clear --cancel-label \ selection=$(dialog $Buttons --backtitle "$BACKTITLE" --title " Toggle sshd options " --clear --checklist \
"Cancel" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \ "\nChoose what you want to enable or disable:\n " $LISTLENGHT 80 21 "${MOTD[@]}" 2>&1 1>&3)
$LISTLENGHT 80 21 "${MOTD[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
...@@ -1063,7 +1065,7 @@ function jobs () ...@@ -1063,7 +1065,7 @@ function jobs ()
3) 3)
display_qr_code display_qr_code
;; ;;
2) 1)
google-authenticator -t -d -f -r 3 -R 30 -W -q google-authenticator -t -d -f -r 3 -R 30 -W -q
display_qr_code display_qr_code
;; ;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment