从10g开始,Oracle修改了DEFAULT资源限制,设置FAILED_LOGIN_ATTEMPTS的值为3,这避免了恶意破解用户密码的可能性。
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> select * from dba_profiles;
PROFILE RESOURCE_NAME RESOURCE LIMIT
------------------------------ -------------------------------- -------- ------------------
DEFAULT COMPOSITE_LIMIT KERNEL UNLIMITED
DEFAULT SESSIONS_PER_USER KERNEL UNLIMITED
DEFAULT CPU_PER_SESSION KERNEL UNLIMITED
DEFAULT CPU_PER_CALL KERNEL UNLIMITED
DEFAULT LOGICAL_READS_PER_SESSION KERNEL UNLIMITED
DEFAULT LOGICAL_READS_PER_CALL KERNEL UNLIMITED
DEFAULT IDLE_TIME KERNEL UNLIMITED
DEFAULT CONNECT_TIME KERNEL UNLIMITED
DEFAULT PRIVATE_SGA KERNEL UNLIMITED
DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD 10
DEFAULT PASSWORD_LIFE_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_REUSE_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_REUSE_MAX PASSWORD UNLIMITED
DEFAULT PASSWORD_VERIFY_FUNCTION PASSWORD NULL
DEFAULT PASSWORD_LOCK_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_GRACE_TIME PASSWORD UNLIMITED
已选择16行。
但是同时引发了另一个问题,虽然其他用户试图通过暴力破解的方式猜测用户密码变得不可能,但是可以通过不断尝试,导致用户帐号被锁定,同样达到影响业务正常运行的目的。
在11g中,Oracle的延迟错误密码验证是解决这个问题的一个好方法,可以参考:http://yangtingkun.itpub.net/post/468/505041
同时Oracle也考虑到帐号被锁定后引发的管理问题,因此有一次修改了默认PROFILE:
SQL> select * from dba_profiles;
PROFILE RESOURCE_NAME RESOURCE LIMIT
------------------------------ -------------------------------- -------- -----------------
DEFAULT COMPOSITE_LIMIT KERNEL UNLIMITED
DEFAULT SESSIONS_PER_USER KERNEL UNLIMITED
DEFAULT CPU_PER_SESSION KERNEL UNLIMITED
DEFAULT CPU_PER_CALL KERNEL UNLIMITED
DEFAULT LOGICAL_READS_PER_SESSION KERNEL UNLIMITED
DEFAULT LOGICAL_READS_PER_CALL KERNEL UNLIMITED
DEFAULT IDLE_TIME KERNEL UNLIMITED
DEFAULT CONNECT_TIME KERNEL UNLIMITED
DEFAULT PRIVATE_SGA KERNEL UNLIMITED
DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD 3 -- 密码出错次数(超过后账号将锁定)
DEFAULT PASSWORD_LIFE_TIME PASSWORD 180 -- 密码有效期(天)
DEFAULT PASSWORD_REUSE_TIME PASSWORD UNLIMITED -- 密码不能重新用的天数
DEFAULT PASSWORD_REUSE_MAX PASSWORD UNLIMITED -- 密码重用之前修改的最少次数
DEFAULT PASSWORD_VERIFY_FUNCTION PASSWORD NULL
DEFAULT PASSWORD_LOCK_TIME PASSWORD 1 -- 超过了1天后,帐号自动解锁
DEFAULT PASSWORD_GRACE_TIME PASSWORD 7 -- 密码到期提前7天提配
已选择16行。
Oracle将PASSWORD_LOCK_TIME的值设置为1,这样当输入多次密码导致帐号被锁定后,只要超过了1天后,帐号自动解锁,这样可以避免DBA手工干预引入的管理代价。
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> alter profile default limit password_lock_time 1/24;
配置文件已更改
SQL> select * from dba_profiles;
PROFILE RESOURCE_NAME RESOURCE LIMIT
------------------------------ -------------------------------- -------- ------------------
DEFAULT COMPOSITE_LIMIT KERNEL UNLIMITED
DEFAULT SESSIONS_PER_USER KERNEL UNLIMITED
DEFAULT CPU_PER_SESSION KERNEL UNLIMITED
DEFAULT CPU_PER_CALL KERNEL UNLIMITED
DEFAULT LOGICAL_READS_PER_SESSION KERNEL UNLIMITED
DEFAULT LOGICAL_READS_PER_CALL KERNEL UNLIMITED
DEFAULT IDLE_TIME KERNEL UNLIMITED
DEFAULT CONNECT_TIME KERNEL UNLIMITED
DEFAULT PRIVATE_SGA KERNEL UNLIMITED
DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD 10
DEFAULT PASSWORD_LIFE_TIME PASSWORD 180
DEFAULT PASSWORD_REUSE_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_REUSE_MAX PASSWORD UNLIMITED
DEFAULT PASSWORD_VERIFY_FUNCTION PASSWORD NULL
DEFAULT PASSWORD_LOCK_TIME PASSWORD .0416
DEFAULT PASSWORD_GRACE_TIME PASSWORD 7
已选择16行。
SQL> conn test/test
ERROR:
ORA-01017: invalid username/password; logon denied
警告: 您不再连接到 ORACLE。
SQL> conn test/test
ERROR:
ORA-01017: invalid username/password; logon denied
SQL> conn test/test
ERROR:
ORA-01017: invalid username/password; logon denied
SQL> conn test/test
ERROR:
ORA-01017: invalid username/password; logon denied
SQL> conn test/test
ERROR:
ORA-01017: invalid username/password; logon denied
SQL> conn / as sysdba
已连接。
SQL> select username, account_status from dba_users where username = 'TEST';
USERNAME ACCOUNT_STATUS
------------------------------ --------------------------------
TEST LOCKED(TIMED)
一旦超过PASSWORD_LOCK_TIME的时间,帐号自动解锁,但是不适用帐号被管理员手工锁定的情况。
设置一个合理的PASSWORD_LOCK_TIME的值,可以有效的降低用户被恶意锁定所带来的危害,同时避免帐号被恶意破解。
转载自:http://blog.itpub.net/4227/viewspace-673255