Explorar el Código

Make allowing ssh passwords a separate menu entry

Bob Mottram hace 8 años
padre
commit
6096ac3bf8
Se han modificado 1 ficheros con 27 adiciones y 20 borrados
  1. 27
    20
      src/freedombone-sec

+ 27
- 20
src/freedombone-sec Ver fichero

175
             return
175
             return
176
         fi
176
         fi
177
         if [ ! $SSH_PASSWORDS ]; then
177
         if [ ! $SSH_PASSWORDS ]; then
178
-            return
178
+            SSH_PASSWORDS='yes'
179
         fi
179
         fi
180
 
180
 
181
         sed -i "s|Ciphers .*|Ciphers $SSH_CIPHERS|g" $SSH_CONFIG
181
         sed -i "s|Ciphers .*|Ciphers $SSH_CIPHERS|g" $SSH_CONFIG
182
         sed -i "s|MACs .*|MACs $SSH_MACS|g" $SSH_CONFIG
182
         sed -i "s|MACs .*|MACs $SSH_MACS|g" $SSH_CONFIG
183
         sed -i "s|KexAlgorithms .*|KexAlgorithms $SSH_KEX|g" $SSH_CONFIG
183
         sed -i "s|KexAlgorithms .*|KexAlgorithms $SSH_KEX|g" $SSH_CONFIG
184
+        sed -i "s|#PasswordAuthentication .*|PasswordAuthentication $SSH_PASSWORDS|g" $SSH_CONFIG
184
         sed -i "s|PasswordAuthentication .*|PasswordAuthentication $SSH_PASSWORDS|g" $SSH_CONFIG
185
         sed -i "s|PasswordAuthentication .*|PasswordAuthentication $SSH_PASSWORDS|g" $SSH_CONFIG
185
         systemctl restart ssh
186
         systemctl restart ssh
186
         echo $'ssh server security settings changed'
187
         echo $'ssh server security settings changed'
203
     echo $'xmpp security settings changed'
204
     echo $'xmpp security settings changed'
204
 }
205
 }
205
 
206
 
207
+function allow_ssh_passwords {
208
+    if [[ $SSH_PASSWORDS == "yes" ]]; then
209
+        dialog --title $"SSH Passwords" \
210
+               --backtitle $"Freedombone Security Configuration" \
211
+               --yesno $"\nAllow SSH login using passwords?" 7 60
212
+    else
213
+        dialog --title $"SSH Passwords" \
214
+               --backtitle $"Freedombone Security Configuration" \
215
+               --defaultno \
216
+               --yesno $"\nAllow SSH login using passwords?" 7 60
217
+    fi
218
+    sel=$?
219
+    case $sel in
220
+        0) SSH_PASSWORDS="yes";;
221
+        1) SSH_PASSWORDS="no";;
222
+        255) exit 0;;
223
+    esac
224
+}
225
+
206
 function interactive_setup {
226
 function interactive_setup {
207
     if [ $SSL_CIPHERS ]; then
227
     if [ $SSL_CIPHERS ]; then
208
         data=$(tempfile 2>/dev/null)
228
         data=$(tempfile 2>/dev/null)
257
         esac
277
         esac
258
     fi
278
     fi
259
 
279
 
260
-    if [[ $SSH_PASSWORDS == "yes" ]]; then
261
-        dialog --title $"SSH Passwords" \
262
-               --backtitle $"Freedombone Security Configuration" \
263
-               --yesno $"\nAllow SSH login using passwords?" 7 60
264
-    else
265
-        dialog --title $"SSH Passwords" \
266
-               --backtitle $"Freedombone Security Configuration" \
267
-               --defaultno \
268
-               --yesno $"\nAllow SSH login using passwords?" 7 60
269
-    fi
270
-    sel=$?
271
-    case $sel in
272
-        0) SSH_PASSWORDS="yes";;
273
-        1) SSH_PASSWORDS="no";;
274
-        255) exit 0;;
275
-    esac
276
-
277
     if [ $XMPP_CIPHERS ]; then
280
     if [ $XMPP_CIPHERS ]; then
278
         data=$(tempfile 2>/dev/null)
281
         data=$(tempfile 2>/dev/null)
279
         trap "rm -f $data" 0 1 2 5 15
282
         trap "rm -f $data" 0 1 2 5 15
680
     trap "rm -f $data" 0 1 2 5 15
683
     trap "rm -f $data" 0 1 2 5 15
681
     dialog --backtitle $"Freedombone Control Panel" \
684
     dialog --backtitle $"Freedombone Control Panel" \
682
            --title $"Security Settings" \
685
            --title $"Security Settings" \
683
-           --radiolist $"Choose an operation:" 15 76 15 \
686
+           --radiolist $"Choose an operation:" 16 76 16 \
684
            1 $"Regenerate ssh host keys" off \
687
            1 $"Regenerate ssh host keys" off \
685
            2 $"Regenerate Diffie-Hellman keys" off \
688
            2 $"Regenerate Diffie-Hellman keys" off \
686
            3 $"Update cipersuite" off \
689
            3 $"Update cipersuite" off \
688
            5 $"Renew Let's Encrypt certificate" off \
691
            5 $"Renew Let's Encrypt certificate" off \
689
            6 $"Enable GPG based authentication (monkeysphere)" off \
692
            6 $"Enable GPG based authentication (monkeysphere)" off \
690
            7 $"Register a website with monkeysphere" off \
693
            7 $"Register a website with monkeysphere" off \
691
-           8 $"Go Back/Exit" on 2> $data
694
+           8 $"Allow ssh login with passwords" off \
695
+           9 $"Go Back/Exit" on 2> $data
692
     sel=$?
696
     sel=$?
693
     case $sel in
697
     case $sel in
694
         1) exit 1;;
698
         1) exit 1;;
733
             register_website
737
             register_website
734
             ;;
738
             ;;
735
         8)
739
         8)
740
+            allow_ssh_passwords
741
+            ;;
742
+        9)
736
             exit 0
743
             exit 0
737
             ;;
744
             ;;
738
     esac
745
     esac