【翻译自mos文章】oracle密码管理策略

oracle密码管理策略

参考原文:
Oracle Password Management Policy (Doc ID 114930.1)

细节:
密码管理通过使用profile来建立。

当密码过期后,如果user有能力独立地从 end-user application(前台业务软件)修改密码的话,通常的推荐是只指派给这些schemas 一个profile,该profile有  password aging an expiration features 。
通常这意味着application(前台业务软件)必须正确的使用 OCIPasswordChange() OCI call ,比如sqlplus


一个profile 可以在指定password参数时被建立,然后把该profile指派给一个user

SQL> create profile custom limit failed_login_attempts 20;
Profile created.

SQL> alter user scott profile custom;
User altered.

oracle提供一个脚本( $ORACLE_HOME/rdbms/admin/utlpwdmg.sql)来实现  DEFAULT profile上的 密码管理特性。
dba可以把它(该脚本)作为一个例子使用,以查看password management特性时怎么被enabled的。
复制该脚本并根据你的需要自定义该脚本,请在上生产之前测试该脚本(或者你自己定义的脚本)

在oracle database profile中,有7个密码管理的参数可以被指定。下面分别讨论:

1. Account Locking

 当一个user 超过了指派给他的失败登陆次数(FAILED_LOGIN_ATTEMPTS),oracle db 会自动lock住该user的账户(account),该lock的持续时间为PASSWORD_LOCK_TIME(该PASSWORD_LOCK_TIME是profile里边的resource)指定的时间。
 
 Profile parameters:
  FAILED_LOGIN_ATTEMPTS
  PASSWORD_LOCK_TIME

2. Password Aging and Expiration
当超过了PASSWORD_LIFE_TIME中指定的时间之后,密码会expire,然后 user or  dba 必须改掉该密码。A grace period(以天为单位,也就是PASSWORD_GRACE_TIME指定的period)可以被设置,以允许user 在密码expired之后直到 grace period 期间之内, 改变他们的密码。
user 进入 grace period 期间的依据是:在他们的密码expired后,并且他们第一次登陆到db中的那个时刻。在 grace period 期间之内, 在用户每一次登陆到db之后,都会显示一条warning的消息,该消息会持续出现,直到grace period expired。在grace period 期内,用户必须修改密码,如果在grace period 期内不修改密码,则该account expired 并且不会被允许登陆,直到密码被修改。

注意: 密码不会也不能被locked,即使是由于 超过life time 和后来的 grace time。但是该user除非修改密码,否则是不能login的。

Profile parameters:
 PASSWORD_LIFE_TIME
 PASSWORD_GRACE_TIME

3. Password History

user 不能重用原来密码的时间间隔 就是 (PASSWORD_REUSE_TIME。该间隔可以以天为单位指定,
or a number of password changes the user must make before the current password can be reused (PASSWORD_REUSE_MAX).
--->看似这个PASSWORD_REUSE_MAX的含义是:在当前密码能被重用之前,用户必须改变许多次密码,也就是说PASSWORD_REUSE_MAX是指定的改密码的次数?

4. Password Complexity Verification
dba可以使用PL/SQL建立自己的 password verification routines (密码验证程序),然后就可以让oracle db 使用该routine 来检查密码复杂度。

Profile parameter:
PASSWORD_VERIFY_FUNCTION

sys拥有的PL/SQL function 必须遵守 下面的格式:
routine_name( userid_parameter IN VARCHAR2, password_parameter IN VARCHAR2, old_password_parameter IN VARCHAR2) RETURN BOOLEAN

默认的密码验证函数在 $ORACLE_HOME/rdbms/admin/utlpwdmg.sql文件中。该文件可以作为一个例子或者根据你的需要进行修改。

该函数可以被profile关联使用。
alter profile default limit password_verify_function <routine_name>;

禁用某 default profile上的密码验证函数的方法如下:
SQL> alter profile default limit password_verify_function null;

密码复杂验证一旦启用,用户可以通过很多方法来修改他们自己的密码:

第一个方法: sqlplus的password命令
SQL> connect scott/tiger
Connected.
SQL> password
Changing password for SCOTT
Old password:
New password:
Retype new password:
Password changed
SQL>


第二个方法:alter user 命令:
SQL> ALTER USER &MYUSERNAME IDENTIFIED BY &NEWPASSWORD REPLACE &OLDPASSWORD;

使用replace 关键字的alter user 语法 是修复 bug 1231172方案的一部分,因此,该语法可以在当前所有支持的release上使用。

第三个方法:前台业务软件使用 OCIPasswordChange() call。

下面是一个例子:
-- A default password complexity function is provided.
-- This sample function makes no checks and always returns true.
-- The logic in the function should be modified as required.
-- See $ORACLE_HOME/rdbms/admin/utlpwdmg.sql for an idea of kind
-- of logic that can be used.
-- This function must be created in SYS schema.
-- connect sys/ as sysdba before running this.

 

-- This function will not check the provided password. It is just an example and
-- will return true for any password. For a real password verification routine see
-- script $ORACLE_HOME/rdbms/admin/utlpwdmg.sql.


CREATE OR REPLACE FUNCTION always_true (username varchar2,
password varchar2, old_password varchar2) RETURN boolean IS
BEGIN
RETURN(TRUE);
END;
/

-- This script alters the default parameters for Password Management.
-- This means that all the users on the system have Password Management
-- enabled and set to the following values unless another profile is
-- created with parameter values set to different value or UNLIMITED
-- is created and assigned to the user.

ALTER PROFILE DEFAULT LIMIT
PASSWORD_LIFE_TIME 60 -- (days)
PASSWORD_GRACE_TIME 10 --(days)
PASSWORD_REUSE_TIME 1800
PASSWORD_REUSE_MAX UNLIMITED
FAILED_LOGIN_ATTEMPTS 3 --(times)
PASSWORD_LOCK_TIME 1/1440 --(days)
PASSWORD_VERIFY_FUNCTION always_true;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值