文章詳情頁
關(guān)于Oracle 9i數(shù)據(jù)庫密碼重用規(guī)則分析
瀏覽:6日期:2023-11-22 13:55:16
Oracle通過PROFILE中的PASSWord_REUSE_TIME和PASSWORD_REUSE_MAX來確定密碼是否可以重用以及密碼重用的限制。 但是,經(jīng)過測(cè)試,發(fā)現(xiàn)Oracle的ADMINISTRATOR GUIDE里面的描述是錯(cuò)誤的,我查閱了一下METALINK,METALINK上的一篇文章雖然對(duì)這兩個(gè)參數(shù)進(jìn)行了比較具體的說明,但是仍然有一部分描述是錯(cuò)誤。 PASSWORD_REUSE_TIME是重用密碼的最小時(shí)間間隔,單位是天。可以給出整數(shù)或分?jǐn)?shù),如1/1440表示1分鐘(出于效率的考慮,oracle不會(huì)每分鐘都去進(jìn)行檢查,一般來說,有5分鐘左右的誤差,因此假如這個(gè)數(shù)小于1/144則沒有多大的意義)。 PASSWORD_REUSE_MAX是重用密碼前更換密碼的最小次數(shù)。這兩項(xiàng)本身沒有任何異議,要害是兩項(xiàng)如何配合使用。可以分為3種情況進(jìn)行描述: 一、PASSWORD_REUSE_MAX和PASSWORD_REUSE_TIME都為UNLIMITED 這時(shí)密碼可以任意重用,沒有限制這也是DEFAULT profile的默認(rèn)值。當(dāng)這兩項(xiàng)都為UNLIMITED時(shí),認(rèn)為這兩個(gè)參數(shù)沒有使用,因此,密碼重用沒有任何限制。 SQL> create profile prof_test limit password_reuse_max unlimited2password_reuse_time unlimited;配置文件已創(chuàng)建SQL> create user test identified by test profile prof_test;用戶已創(chuàng)建SQL> alter user test identified by test;用戶已更改。SQL> alter user test identified by test;用戶已更改。二、PASSWORD_REUSE_MAX和PASSWORD_REUSE_TIME中有一個(gè)為UNLIMITED,另一個(gè)為其他值。 這個(gè)時(shí)候你的密碼將永遠(yuǎn)無法重用。看看administrator guide上是怎么說的: Use the CREATE PROFILE statement to specify a time interval during which users cannot reuse a password. In the following statement, a profile is defined wherethe PASSWORD_REUSE_TIME clause specifies that the user cannot reuse the passwordfor 60 days.CREATE PROFILE prof LIMITPASSWORD_REUSE_TIME 60PASSWORD_REUSE_MAX UNLIMITED;In the next statement, the PASSWORD_REUSE_MAX clause specifies that the numberof password changes the user must make before the current password can be used again is three.CREATE PROFILE prof LIMITPASSWORD_REUSE_MAX 3PASSWORD_REUSE_TIME UNLIMITED;Note: If you specify PASSWORD_REUSE_TIME or PASSWORD_REUSE_MAX, you must setthe other to UNLIMITED or not specify it at all.文檔告訴我們,只使用其中一個(gè),把另外一個(gè)設(shè)置為UNLIMITED,但是這是不正確的,這樣會(huì)導(dǎo)致你的密碼永遠(yuǎn)無法重用。 SQL> alter profile prof_test limit password_reuse_max 3;配置文件已更改SQL> select resource_name, limit from dba_profiles2where profile = 'PROF_TEST' and resource_type = 'PASSWORD';RESOURCE_NAMELIMIT-------------------------------- ------------------------FAILED_LOGIN_ATTEMPTSDEFAULTPASSWORD_LIFE_TIMEDEFAULTPASSWORD_REUSE_TIMEUNLIMITEDPASSWORD_REUSE_MAX3PASSWORD_VERIFY_FUNCTIONDEFAULTPASSWORD_LOCK_TIMEDEFAULTPASSWORD_GRACE_TIMEDEFAULT已選擇7行。SQL> alter user test identified by test;用戶已更改。SQL> alter user test identified by test;alter user test identified by test*ERROR 位于第 1 行:ORA-28007: 無法重新使用口令SQL> alter user test identified by t1;用戶已更改。SQL> alter user test identified by t2;用戶已更改。SQL> alter user test identified by t3;用戶已更改。SQL> alter user test identified by test;alter user test identified by test*ERROR 位于第 1 行:ORA-28007: 無法重新使用口令修改profile后,只對(duì)test用戶的后續(xù)操作有效,第一次可以修改密碼為test是因?yàn)閛racle沒有記錄初始密碼,而第二次修改就會(huì)失敗,因?yàn)槊艽a已經(jīng)不能重用了。 根據(jù)文檔,我們只需要修改密碼三次,就可以重用,但是測(cè)試的結(jié)果確是密碼無法在重用。 SQL> alter profile prof_test limit password_reuse_max unlimited;配置文件已更改SQL> alter user test identified by test;用戶已更改。SQL> alter profile prof_test limit password_reuse_time 1/144;配置文件已更改SQL> select resource_name, limit from dba_profiles2where profile = 'PROF_TEST' and resource_type = 'PASSWORD';RESOURCE_NAMELIMIT-------------------------------- --------------FAILED_LOGIN_ATTEMPTSDEFAULTPASSWORD_LIFE_TIMEDEFAULTPASSWORD_REUSE_TIME.0069PASSWORD_REUSE_MAXUNLIMITEDPASSWORD_VERIFY_FUNCTIONDEFAULTPASSWORD_LOCK_TIMEDEFAULTPASSWORD_GRACE_TIMEDEFAULT已選擇7行。SQL> set time on16:47:29 SQL> alter user test identified by test;alter user test identified by test*ERROR 位于第 1 行:ORA-28007: 無法重新使用口令16:47:48 SQL>16:48:23 SQL>16:59:45 SQL> alter user test identified by test;alter user test identified by test*ERROR 位于第 1 行:ORA-28007: 無法重新使用口令16:59:59 SQL>17:07:32 SQL> alter user test identified by test;alter user test identified by test*ERROR 位于第 1 行:ORA-28007: 無法重新使用口令17:07:40 SQL> set time off修改PASSWORD_REUSE_TIME為1/144,也就是說大概10分鐘的時(shí)間,考慮的oracle的誤差,我們?cè)?0分鐘和20分鐘后分別進(jìn)行測(cè)試。結(jié)果發(fā)現(xiàn)密碼仍然無法重用。 三、PASSWORD_REUSE_MAX和PASSWORD_REUSE_TIME都不為UNLIMITED。 這時(shí)只需滿足任意一個(gè)條件就可以重用密碼。Metalink上的文章在這里描述有誤,密碼重用不需要同時(shí)滿足兩個(gè)條件,只要滿足一個(gè)既可。 SQL> alter profile prof_test limit password_reuse_time unlimited;配置文件已更改SQL> alter user test identified by test;用戶已更改。SQL> alter profile prof_test limit2password_reuse_max 3 password_reuse_time 1/144;配置文件已更改SQL> set time on17:11:30 SQL> alter user test identified by test;用戶已更改。17:11:47 SQL> alter user test identified by test;alter user test identified by test*ERROR 位于第 1 行:ORA-28007: 無法重新使用口令17:11:56 SQL> alter user test identified by t1;用戶已更改。17:12:06 SQL> alter user test identified by t2;用戶已更改。17:12:12 SQL> alter user test identified by t3;用戶已更改。17:12:19 SQL> alter user test identified by test;用戶已更改。17:12:50 SQL>17:13:45 SQL> alter user test identified by test;alter user test identified by test*ERROR 位于第 1 行:ORA-28007: 無法重新使用口令17:13:55 SQL>17:14:00 SQL>17:32:14 SQL> alter user test identified by test;用戶已更改。第一次重用test密碼才過了1分鐘左右,而在第二次重用test密碼之前并沒有使用過其他密碼。可見,只需滿足PASSWORD_REUSE_MAX和PASSWORD_REUSE_TIME中的任意一個(gè)條件就可以。
標(biāo)簽:
Oracle
數(shù)據(jù)庫
排行榜
