Bläddra i källkod

Password length for remote backups

Bob Mottram 10 år sedan
förälder
incheckning
344c87b2f2
1 ändrade filer med 10 tillägg och 2 borttagningar
  1. 10
    2
      src/freedombone

+ 10
- 2
src/freedombone Visa fil

@@ -116,6 +116,9 @@ DDNS_PASSWORD=
116 116
 CURRENT_DDNS_DOMAIN=
117 117
 CURRENT_DDNS_CODE=
118 118
 
119
+# Minimum number of characters in a password
120
+MINIMUM_PASSWORD_LENGTH=10
121
+
119 122
 # number of CPU cores
120 123
 CPU_CORES=1
121 124
 
@@ -414,11 +417,16 @@ function interactive_configuration_remote_backups {
414 417
           $remote_ssh_domain != "" && \
415 418
           $remote_ssh_port != "" && \
416 419
           $remote_ssh_password != "" ]]; then
417
-          echo "$remote_ssh_username@$remote_ssh_domain:$remote_ssh_port//home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
420
+
421
+		  if [ ${#remote_ssh_password} -lt $MINIMUM_PASSWORD_LENGTH ]; then
422
+			  dialog --title "Password quality check" --msgbox "The password given was too short. It must be at least $MINIMUM_PASSWORD_LENGTH characters" 6 40
423
+		  else
424
+			  echo "$remote_ssh_username@$remote_ssh_domain:$remote_ssh_port//home/$remote_ssh_username $remote_ssh_password" >> $FRIENDS_SERVERS_LIST
425
+			  entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
426
+		  fi
418 427
       else
419 428
           entering_remote_backups_done="yes"
420 429
       fi
421
-      entering_remote_backups_ctr=$((entering_remote_backups_ctr + 1))
422 430
   done
423 431
   if [ -f $FRIENDS_SERVERS_LIST ]; then
424 432
       chown $MY_USERNAME:$MY_USERNAME $FRIENDS_SERVERS_LIST