技术开发 频道

ORACLE9i密码策略--密码重用规则

    修改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_profiles 2where profile = 'PROF_TEST' and resource_type = 'PASSWORD'; RESOURCE_NAMELIMIT -------------------------------- ---------------------------------------- FAILED_LOGIN_ATTEMPTSDEFAULT PASSWORD_LIFE_TIMEDEFAULT PASSWORD_REUSE_TIME.0069 PASSWORD_REUSE_MAXUNLIMITED PASSWORD_VERIFY_FUNCTIONDEFAULT PASSWORD_LOCK_TIMEDEFAULT PASSWORD_GRACE_TIMEDEFAULT 已选择7行。 SQL> set time on 16: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 limit 2password_reuse_max 3 password_reuse_time 1/144; 配置文件已更改 SQL> set time on 17: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中的任意一个条件就可以。

0
相关文章