有没有办法限制用户的su尝试次数?
例如,恶意用户进入具有su访问权限的用户login名。 反复运行su以获得超级用户访问权限。
这个例子将是一个罕见的情况,但它似乎是一个好主意,join保护。
尝试Faillock:
我添加了以下几行到/etc/pam.d/su来testing它:
auth required pam_faillock.so preauth silent audit deny=1 unlock_time=120 auth sufficient pam_unix.so nullok try_first_pass auth [default=die] pam_faillock.so authfail audit deny=1 unlock_time=120 account required pam_faillock.so
但是,它不会阻止任何人。 我正在监视通过faillock,我看到:
# faillock user: When Type Source Valid root: When Type Source Valid 2015-01-30 20:55:05 TTY pts/1 V 2015-01-30 20:55:20 TTY pts/1 V
但是,这个条目是在根目录下的(所以它会locking每个人的root用户?),这个条目对su没有影响。
一个小的Googlesearch结果链接到这个文档 :
Task: Set Maximum Number of Login Failures The -m option is allows you to set maximum number of login failures after the account is disabled to specific number called MAX. Selecting MAX value of 0 has the effect of not placing a limit on the number of failed logins. The maximum failure count should always be 0 for root to prevent a denial of services attack against the system: # faillog -M MAX -u username # faillog -M 10 -u vivek
和这个文档 :
faillog faillog -u <user> -r faillog -u oracle -m 0 /var/log/faillog faillog -u <user> -m -1
但是在faillog上执行faillog。 根据这个问答, pam_tally2取代了faillog命令。
deny=n Deny access if tally for this user exceeds n.