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,9 +397,9 @@ function test_stig {
397 397
     ################
398 398
 
399 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 404
     stig_spinner $!
405 405
     output "V-38573" $? ${SETLANG}

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

@@ -377,6 +377,16 @@ function set_shadow_permissions {
377 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 390
 function setup_firewall {
381 391
     function_check create_completion_file
382 392
     create_completion_file
@@ -401,6 +411,9 @@ function setup_utils {
401 411
     read_config_param "PROJECT_REPO"
402 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 417
     function_check set_shadow_permissions
405 418
     set_shadow_permissions
406 419
 

+ 1
- 1
tests/output.sh View File

@@ -482,7 +482,7 @@ time, are stored in the following directories by default:\n\n/lib\n/lib64\n/usr/
482 482
               fi
483 483
               ;;
484 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 486
               else
487 487
                   log_msg $2 "系统必须在连续3次失败的登录尝试后禁用帐号。"
488 488
               fi