[리눅스] 계정 잠금 임계값 설정 (RHEL 8버전 이상)

반응형

 

리눅스 8버전 이상 : faillock

리눅스 7버전 이하 : pam_tally2

 

1. 계정 잠금 임계값 관련 파일 수정 (일부 항목 추가)

# vi /etc/pam.d/system-auth

# Generated by authselect on Mon Jan 15 09:33:20 2024
# Do not modify this file manually.

auth        required                                     pam_env.so
auth        required                                     pam_faillock.so preauth silent audit deny=5 unlock_time=600 // 추가
auth        required                                     pam_faildelay.so delay=2000000
auth        sufficient                                   pam_fprintd.so
auth        [default=1 ignore=ignore success=ok]         pam_usertype.so isregular
auth        [default=1 ignore=ignore success=ok]         pam_localuser.so
auth        sufficient                                   pam_unix.so nullok
auth        [default=die]                                pam_faillock.so authfail audit deny=5 unlock_time=600 // 추가
auth        [default=1 ignore=ignore success=ok]         pam_usertype.so isregular
auth        sufficient                                   pam_sss.so forward_pass
auth        required                                     pam_deny.so

account     required                                     pam_unix.so
account     sufficient                                   pam_localuser.so
account     sufficient                                   pam_usertype.so issystem
account     [default=bad success=ok user_unknown=ignore] pam_sss.so
account     required                                     pam_permit.so
account     required                                     pam_faillock.so // 추가

password    requisite                                    pam_pwquality.so local_users_only
password    sufficient                                   pam_unix.so sha512 shadow nullok use_authtok
password    sufficient                                   pam_sss.so use_authtok
password    required                                     pam_deny.so

session     optional                                     pam_keyinit.so revoke
session     required                                     pam_limits.so
-session    optional                                     pam_systemd.so
session     [success=1 default=ignore]                   pam_succeed_if.so service in crond quiet use_uid
session     required                                     pam_unix.so
session     optional                                     pam_sss.so



# vi /etc/pam.d/password-auth

# Generated by authselect on Mon Jan 15 09:34:03 2024
# Do not modify this file manually.

auth        required                                     pam_env.so
auth        required                                     pam_faillock.so preauth silent audit deny=5 unlock_time=600 // 추가
auth        required                                     pam_faildelay.so delay=2000000
auth        [default=1 ignore=ignore success=ok]         pam_usertype.so isregular
auth        [default=1 ignore=ignore success=ok]         pam_localuser.so
auth        sufficient                                   pam_unix.so nullok
auth        [default=die]                                pam_faillock.so authfail audit deny=5 unlock_time=600 // 추가
auth        [default=1 ignore=ignore success=ok]         pam_usertype.so isregular
auth        sufficient                                   pam_sss.so forward_pass
auth        required                                     pam_deny.so

account     required                                     pam_unix.so
account     sufficient                                   pam_localuser.so
account     sufficient                                   pam_usertype.so issystem
account     [default=bad success=ok user_unknown=ignore] pam_sss.so
account     required                                     pam_permit.so
account     required                                     pam_faillock.so // 추가

password    requisite                                    pam_pwquality.so local_users_only
password    sufficient                                   pam_unix.so sha512 shadow nullok use_authtok
password    sufficient                                   pam_sss.so use_authtok
password    required                                     pam_deny.so

session     optional                                     pam_keyinit.so revoke
session     required                                     pam_limits.so
-session    optional                                     pam_systemd.so
session     [success=1 default=ignore]                   pam_succeed_if.so service in crond quiet use_uid
session     required                                     pam_unix.so
session     optional                                     pam_sss.so

 

 

2. faillock - 계정 상태 확인 및 잠금 해제

# faillock
lmw:
When                Type  Source                                           Valid
2024-01-15 09:44:32 RHOST 192.168.0.100                                        V
root:
When                Type  Source                                           Valid
2024-01-12 08:34:12 TTY   /dev/tty1                                            V
2024-01-13 08:41:52 TTY   /dev/tty1                                            V
2024-01-13 10:55:24 TTY   /dev/tty1                                            V
2024-01-14 09:12:38 TTY   /dev/tty1                                            V


특정 사용자만 확인 
# faillock --user lmw
lmw:
When                Type  Source                                           Valid
2024-01-15 09:44:42 RHOST 192.168.0.100                                        V


수동 계정 잠금 해제
# faillock --user lmw --reset


로그인 한 번이라도 실패 시 아래 경로에 기록
# ls /var/run/faillock/
lmw  root
반응형

댓글

Designed by JB FACTORY