Browse Source

Set maximum login attempts

Bob Mottram 8 years ago
parent
commit
b8b0637e13
3 changed files with 16 additions and 3 deletions
  1. 2
    2
      src/freedombone-tests
  2. 13
    0
      src/freedombone-utils-setup
  3. 1
    1
      tests/output.sh

+ 2
- 2
src/freedombone-tests View File

397
     ################
397
     ################
398
 
398
 
399
     ##RHEL-06-000061
399
     ##RHEL-06-000061
400
-    ##The system must disable accounts after three consecutive unsuccessful logon attempts.
400
+    ##The system must disable accounts after ten consecutive unsuccessful logon attempts.
401
 
401
 
402
-    bash $STIG_TESTS_DIR/check-password.sh /etc/pam.d/common-auth pam_tally deny gt 3 > /dev/null 2>&1 &
402
+    bash $STIG_TESTS_DIR/check-password.sh /etc/pam.d/common-auth pam_tally deny gt 10 > /dev/null 2>&1 &
403
 
403
 
404
     stig_spinner $!
404
     stig_spinner $!
405
     output "V-38573" $? ${SETLANG}
405
     output "V-38573" $? ${SETLANG}

+ 13
- 0
src/freedombone-utils-setup View File

377
     chmod 0000 /etc/gshadow
377
     chmod 0000 /etc/gshadow
378
 }
378
 }
379
 
379
 
380
+function set_max_login_tries {
381
+    max_tries=$1
382
+
383
+    if ! grep ' deny=' /etc/pam.d/common-auth; then
384
+        sed -i "/pam_deny.so/a auth    required    pam_tally2.so    onerr=fail unlock_time=1800 deny=$max_tries" /etc/pam.d/common-auth
385
+    else
386
+        sed -i "s| deny=.*| deny=$max_tries|g" /etc/pam.d/common-auth
387
+    fi
388
+}
389
+
380
 function setup_firewall {
390
 function setup_firewall {
381
     function_check create_completion_file
391
     function_check create_completion_file
382
     create_completion_file
392
     create_completion_file
401
     read_config_param "PROJECT_REPO"
411
     read_config_param "PROJECT_REPO"
402
     write_config_param "PROJECT_REPO" "$PROJECT_REPO"
412
     write_config_param "PROJECT_REPO" "$PROJECT_REPO"
403
 
413
 
414
+    function_check set_max_login_tries
415
+    set_max_login_tries 10
416
+
404
     function_check set_shadow_permissions
417
     function_check set_shadow_permissions
405
     set_shadow_permissions
418
     set_shadow_permissions
406
 
419
 

+ 1
- 1
tests/output.sh View File

482
               fi
482
               fi
483
               ;;
483
               ;;
484
     V-38573)  if [ "$3" = "en" ]; then
484
     V-38573)  if [ "$3" = "en" ]; then
485
-                  log_msg $2 'The system must disable accounts after three consecutive unsuccessful logon attempts.'
485
+                  log_msg $2 'The system must disable accounts after ten consecutive unsuccessful logon attempts.'
486
               else
486
               else
487
                   log_msg $2 "系统必须在连续3次失败的登录尝试后禁用帐号。"
487
                   log_msg $2 "系统必须在连续3次失败的登录尝试后禁用帐号。"
488
               fi
488
               fi