文章詳情頁
關于Oracle 9i數據庫密碼重用規則分析
瀏覽:4日期:2023-11-22 13:55:16
Oracle通過PROFILE中的PASSWord_REUSE_TIME和PASSWORD_REUSE_MAX來確定密碼是否可以重用以及密碼重用的限制。 但是,經過測試,發現Oracle的ADMINISTRATOR GUIDE里面的描述是錯誤的,我查閱了一下METALINK,METALINK上的一篇文章雖然對這兩個參數進行了比較具體的說明,但是仍然有一部分描述是錯誤。 PASSWORD_REUSE_TIME是重用密碼的最小時間間隔,單位是天。可以給出整數或分數,如1/1440表示1分鐘(出于效率的考慮,oracle不會每分鐘都去進行檢查,一般來說,有5分鐘左右的誤差,因此假如這個數小于1/144則沒有多大的意義)。 PASSWORD_REUSE_MAX是重用密碼前更換密碼的最小次數。這兩項本身沒有任何異議,要害是兩項如何配合使用。可以分為3種情況進行描述: 一、PASSWORD_REUSE_MAX和PASSWORD_REUSE_TIME都為UNLIMITED 這時密碼可以任意重用,沒有限制這也是DEFAULT profile的默認值。當這兩項都為UNLIMITED時,認為這兩個參數沒有使用,因此,密碼重用沒有任何限制。 SQL> create profile prof_test limit password_reuse_max unlimited2password_reuse_time unlimited;配置文件已創建SQL> create user test identified by test profile prof_test;用戶已創建SQL> alter user test identified by test;用戶已更改。SQL> alter user test identified by test;用戶已更改。二、PASSWORD_REUSE_MAX和PASSWORD_REUSE_TIME中有一個為UNLIMITED,另一個為其他值。 這個時候你的密碼將永遠無法重用。看看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.文檔告訴我們,只使用其中一個,把另外一個設置為UNLIMITED,但是這是不正確的,這樣會導致你的密碼永遠無法重用。 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后,只對test用戶的后續操作有效,第一次可以修改密碼為test是因為oracle沒有記錄初始密碼,而第二次修改就會失敗,因為密碼已經不能重用了。 根據文檔,我們只需要修改密碼三次,就可以重用,但是測試的結果確是密碼無法在重用。 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分鐘的時間,考慮的oracle的誤差,我們在10分鐘和20分鐘后分別進行測試。結果發現密碼仍然無法重用。 三、PASSWORD_REUSE_MAX和PASSWORD_REUSE_TIME都不為UNLIMITED。 這時只需滿足任意一個條件就可以重用密碼。Metalink上的文章在這里描述有誤,密碼重用不需要同時滿足兩個條件,只要滿足一個既可。 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中的任意一個條件就可以。
排行榜
