真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

linux如何實(shí)現(xiàn)賬號(hào)密碼安全加固

這篇文章將為大家詳細(xì)講解有關(guān)linux如何實(shí)現(xiàn)賬號(hào)密碼安全加固,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)建站是一家專注于做網(wǎng)站、網(wǎng)站建設(shè)與策劃設(shè)計(jì),柯城網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)建站做網(wǎng)站,專注于網(wǎng)站建設(shè)十年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:柯城等地區(qū)。柯城做網(wǎng)站價(jià)格咨詢:028-86922220

Linux用戶密碼策略

    Linux用戶密碼的有效期,是否可以修改密碼可以通過(guò)login.defs文件控制.對(duì)login.defs文件修只影響后續(xù)建立的用戶,如果要改變以前建立的用戶的有效期等可以使用chage命令.

    Linux用戶密碼的復(fù)雜度可以通過(guò)pam pam_cracklib module或pam_passwdqc module控制,兩者不能同時(shí)使用. 個(gè)人感覺(jué)pam_passwdqc更好用.

/etc/login.defs密碼策略

PASS_MAX_DAYS   99999     #密碼的最大有效期, 99999:永久有期

PASS_MIN_DAYS   0          #是否可修改密碼,0可修改,非0多少天后可修改

PASS_MIN_LEN    5          #密碼最小長(zhǎng)度,使用pam_cracklib module,該參數(shù)不再有效

PASS_WARN_AGE   7         #密碼失效前多少天在用戶登錄時(shí)通知用戶修改密碼

pam_cracklib主要參數(shù)說(shuō)明:

    tretry=N:重試多少次后返回密碼修改錯(cuò)誤

    difok=N:新密碼必需與舊密碼不同的位數(shù)

    dcredit=N: N >= 0:密碼中最多有多少個(gè)數(shù)字;N < 0密碼中最少有多少個(gè)數(shù)字.

    lcredit=N:小寶字母的個(gè)數(shù)

    ucredit=N大寶字母的個(gè)數(shù)

    credit=N:特殊字母的個(gè)數(shù)

    minclass=N:密碼組成(大/小字母,數(shù)字,特殊字符)

pam_passwdqc主要參數(shù)說(shuō)明:

mix:設(shè)置口令字最小長(zhǎng)度,默認(rèn)值是mix=disabled。

max:設(shè)置口令字的最大長(zhǎng)度,默認(rèn)值是max=40。

passphrase:設(shè)置口令短語(yǔ)中單詞的最少個(gè)數(shù),默認(rèn)值是passphrase=3,如果為0則禁用口令短語(yǔ)。

atch:設(shè)置密碼串的常見(jiàn)程序,默認(rèn)值是match=4。

similar:設(shè)置當(dāng)我們重設(shè)口令時(shí),重新設(shè)置的新口令能否與舊口令相似,它可以是similar=permit允許相似或similar=deny不允許相似。

random:設(shè)置隨機(jī)生成口令字的默認(rèn)長(zhǎng)度。默認(rèn)值是random=42。設(shè)為0則禁止該功能。

enforce:設(shè)置約束范圍,enforce=none表示只警告弱口令字,但不禁止它們使用;enforce=users將對(duì)系統(tǒng)上的全體非根用戶實(shí)行這一限制;enforce=everyone將對(duì)包括根用戶在內(nèi)的全體用戶實(shí)行這一限制。

non-unix:它告訴這個(gè)模塊不要使用傳統(tǒng)的getpwnam函數(shù)調(diào)用獲得用戶信息,

retry:設(shè)置用戶輸入口令字時(shí)允許重試的次數(shù),默認(rèn)值是retry=3

密碼復(fù)雜度通過(guò)/etc/pam.d/system-auth實(shí)施

如:

要使用pam_cracklib將注釋去掉,把pam_passwdqc.so注釋掉即可.

#password    requisite     /lib/security/$ISA/pam_cracklib.so retry=3 difok=1

password    requisite     /lib/security/$ISA/pam_passwdqc.so min=disabled,24,12,8,7 passphrase=3

password    sufficient    /lib/security/$ISA/pam_unix.so nullok use_authtok md5 shadow

#password    requisite     /lib/security/$ISA/pam_cracklib.so retry=3 difok=1

新密碼至少有一位與原來(lái)的不同.




加策略:

1、Linux系統(tǒng)的用戶帳號(hào)策略
編輯/etc/pam.d/system-auth 添加如下語(yǔ)句。
   auth required /lib/security/$ISA/pam_tally.so deny=5
   account required pam_tally.so
該語(yǔ)句的解釋:密碼最大聯(lián)系登錄6次,超過(guò)只能聯(lián)系管理員。


2、密碼策略
    2.1編輯/etc/login.defs  指定如下參數(shù)的值。
         PASS_MAX_DAYS   99999
         PASS_MIN_DAYS   0
         PASS_MIN_LEN    5
         PASS_WARN_AGE   7
         參數(shù)值得解釋: PASS_MAX_DAYS(設(shè)置密碼過(guò)期日期) 
              PASS_MIN_DAYS(設(shè)置密碼最少更改日期)
              PASS_MIN_LEN(設(shè)置密碼最小長(zhǎng)度)時(shí)指密碼設(shè)置的最小長(zhǎng)度,一般定義為8位以上
              PASS_WARN_AGE(設(shè)置過(guò)期提前警告天數(shù))
     2.2 設(shè)置賬戶鎖定登陸失敗鎖定次數(shù)、鎖定時(shí)間
         編輯/etc/pam.d/system- auth   首先  cp /etc/pam.d/system-auth /etc/pam.d/system-auth.bak      
         #vi /etc/pam.d/system-auth
         auth required pam_tally.so onerr=fail deny=6 unlock_time=300
         解釋:設(shè)置位密碼連續(xù)六次鎖定,鎖定時(shí)間300秒 
         解鎖用戶 faillog -u <用戶名》 -r
     2.3 設(shè)置口令的復(fù)雜程度。
         編輯/etc/pam.d/system- auth   首先  cp /etc/pam.d/system-auth /etc/pam.d/system-auth.bak
         #vi /etc/pam.d/system-auth
         找到pam_cracklib.so  在后面加一些參數(shù),
         例:password    requisite     pam_cracklib.so  minlen=8 ucredit=-2   lcredit=-2   dcredit=-5    ocredit=-1
         意思為最少有2個(gè)大寫(xiě)字母,2個(gè)小寫(xiě)字符,5個(gè)數(shù)字, 1個(gè)符號(hào)
     2.4 限制su的權(quán)限
         如果你不想任何人能夠用su作為root,可以編輯/etc/pam.d/su文件,增加如下兩行:
       auth sufficient /lib/security/pam_rootok.so debug
       auth required /lib/security/pam_wheel.so group=isd
     這時(shí),僅isd組的用戶可以用su作為root。此后,如果你希望用戶admin能夠用su作為root,可以運(yùn)行如下命令
           # usermod -G10 admin
如何設(shè)置PAM模塊控制Linux密碼策略


我們?cè)谑褂胠inux系統(tǒng)設(shè)置密碼的時(shí)候,經(jīng)常遇到這樣的問(wèn)題,系統(tǒng)提示:您的密碼太簡(jiǎn)單,或者您的密碼是字典的一部分。那么系統(tǒng)是如何實(shí)現(xiàn)對(duì)用戶的密碼的復(fù)雜度的檢查的呢?
系統(tǒng)對(duì)密碼的控制是有兩部分(我知道的)組成:
1 cracklib
2 login.defs
聲明:login.defs主要是控制密碼的有效期。對(duì)密碼進(jìn)行時(shí)間管理。此處不細(xì)談
login.defs --shadow password suite configuration
pam_cracklib.so 才是控制密碼復(fù)雜度的關(guān)鍵文件
redhat公司專門開(kāi)發(fā)了cracklib這個(gè)安裝包來(lái)判斷密碼的復(fù)雜度
可以rpm -ql cracklib查看
密碼的復(fù)雜度的判斷是通過(guò)pam模塊控制來(lái)實(shí)現(xiàn)的,具體的模塊是pam_cracklibpam_cracklib 的參數(shù)介紹:
debug
This option makes the module write information to syslog(3) indicating the behavior of the module (this option does not write password information to the log file).
type=XXX
The default action is for the module to use the following prompts when requesting passwords: "New UNIX password: " and "Retype UNIX password: ". The default word UNIX can be replaced with this option.
retry=N
Prompt user at most N times before returning with error. The default is 1
difok=N
This argument will change the default of 5 for the number of characters in the new password that must not be present in the old password. In addition, if 1/2 of the characters in the new password are different then the new password will be accepted anyway.
difignore=N
How many characters should the password have before difok will be ignored. The default is 23.
minlen=N
The minimum acceptable size for the new password (plus one if credits are not disabled which is the default). In addition to the number of characters in the new password, credit (of +1 in length) is given for each different kind of character (other, upper, lower and digit). The default for this parameter is 9 which is good for a old style UNIX password all of the same type of character but may be too low to exploit the added security of a md5 system. Note that there is a pair of length limits in Cracklib itself, a "way too short" limit of 4 which is hard coded in and a defined limit (6) that will be checked without reference to minlen. If you want to allow passwords as short as 5 characters you should not use this module.
dcredit=N
(N >= 0) This is the maximum credit for having digits in the new password. If you have less than or N digits, each digit will count +1 towards meeting the current minlen value. The default for dcredit is 1 which is the recommended value for minlen less than 10.
(N < 0) This is the minimum number of digits that must be met for a new password.
ucredit=N
(N >= 0) This is the maximum credit for having upper case letters in the new password. If you have less than or N upper case letters each letter will count +1 towards meeting the current minlen value. The default for ucredit is 1 which is the recommended value for minlen less than 10.
(N > 0) This is the minimum number of upper case letters that must be met for a new password.
lcredit=N
(N >= 0) This is the maximum credit for having lower case letters in the new password. If you have less than or N lower case letters, each letter will count +1 towards meeting the current minlen value. The default for lcredit is 1 which is the recommended value for minlen less than 10.
(N < 0) This is the minimum number of lower case letters that must be met for a new password.
ocredit=N
(N >= 0) This is the maximum credit for having other characters in the new password. If you have less than or N other characters, each character will count +1 towards meeting the current minlen value. The default for ocredit is 1 which is the recommended value for minlen less than 10.
(N < 0) This is the minimum number of other characters that must be met for a new password.
use_authtok
This argument is used to force the module to not prompt the user for a new password but use the one provided by the previously stacked password module.
dictpath=/path/to/dict
Path to the cracklib dictionaries.
dictpath=/path/to/dict //注:密碼字典,這個(gè)是驗(yàn)證用戶的密碼是否是字典一部分的關(guān)鍵。
Path to the cracklib dictionaries.
cracklib密碼強(qiáng)度檢測(cè)過(guò)程
首先檢查密碼是否是字典的一部分,如果不是,則進(jìn)行下面的檢查
密碼強(qiáng)度檢測(cè)過(guò)程
These checks are:
Palindrome
Is the new password a palindrome of the old one?
新密碼是否舊密碼的回文
Case Change Only
Is the new password the the old one with only a change of case?
新密碼是否只是就密碼改變了大小寫(xiě)
Similar
Is the new password too much like the old one?
新密碼是否和舊密碼很相似
This is primarily controlled by one argument, difok which is a number of characters that if different between the old and new are enough to accept the new password, this defaults to 10 or 1/2 the size of the new password whichever is smaller.
To avoid the lockup associated with trying to change a long and complicated password, difignore is available. This argument can be used to specify the minimum length a new password needs to be before the difok value is ignored. The default value for difignore is 23.
Simple
Is the new password too small?
新密碼是否太短
This is controlled by 5 arguments minlen, dcredit, ucredit, lcredit, and ocredit. See the section on the arguments for the details of how these work and there defaults.
Rotated
Is the new password a rotated version of the old password?
新密碼的字符是否

關(guān)于“l(fā)inux如何實(shí)現(xiàn)賬號(hào)密碼安全加固”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。


標(biāo)題名稱:linux如何實(shí)現(xiàn)賬號(hào)密碼安全加固
鏈接地址:http://weahome.cn/article/ggehhp.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部