oracle profile password,Oracle Profile and PASSWORD_VERIFY_FUNCTION

这篇博客介绍了如何在Oracle数据库中设置默认的密码管理参数,包括密码生命周期、宽限期、重用时间和复杂性检查。提供了一个名为MY_PASSWORD_VERIFY_FUNC的示例函数,用于验证密码是否符合最小复杂性要求,如长度、不包含用户名、不包含常见词汇等。此外,还展示了ALTER PROFILE语句用于启用这些策略。
摘要由CSDN通过智能技术生成

ALTER PROFILE default LIMIT

PASSWORD_LIFE_TIME 90

PASSWORD_GRACE_TIME 5

PASSWORD_REUSE_TIME 100

PASSWORD_REUSE_MAX 360

FAILED_LOGIN_ATTEMPTS 3

PASSWORD_VERIFY_FUNCTION MY_PASSWORD_VERIFY_FUNC;[@more@]Rem

Rem $Header: utlpwdmg.sql 31-aug-2000.11:00:47 nireland Exp $

Rem

Rem utlpwdmg.sql

Rem

Rem Copyright (c) Oracle Corporation 1996, 2000. All Rights Reserved.

Rem

Rem NAME

Rem utlpwdmg.sql - script for Default Password Resource Limits

Rem

Rem DESCRIPTION

Rem This is a script for enabling the password management features

Rem by setting the default password resource limits.

Rem

Rem NOTES

Rem This file contains a function for minimum checking of password

Rem complexity. This is more of a sample function that the customer

Rem can use to develop the function for actual complexity checks that the

Rem customer wants to make on the new password.

Rem

Rem MODIFIED (MM/DD/YY)

Rem nireland 08/31/00 - Improve check for username=password. #1390553

Rem nireland 06/28/00 - Fix null old password test. #1341892

Rem asurpur 04/17/97 - Fix for bug479763

Rem asurpur 12/12/96 - Changing the name of password_verify_function

Rem asurpur 05/30/96 - New script for default password management

Rem asurpur 05/30/96 - Created

Rem

-- This script sets the default password resource parameters

-- This script needs to be run to enable the password features.

-- However the default resource parameters can be changed based

-- on the need.

-- A default password complexity function is also provided.

-- This function makes the minimum complexity checks like

-- the minimum length of the password, password not same as the

-- username, etc. The user may enhance this function according to

-- the need.

-- This function must be created in SYS schema.

-- connect sys/ as sysdba before running the script

-- JackJiang: this function MY_PASSWORD_VERIFY_FUNC derive from VERIFY_FUNC in $ORACLE_HOME/rdbms/admin/utlpwdmg.sql

CREATE OR REPLACE FUNCTION MY_PASSWORD_VERIFY_FUNC

(username varchar2,

password varchar2,

old_password varchar2)

RETURN boolean IS

n boolean;

m integer;

differ integer;

isdigit boolean;

ischar boolean;

ispunct boolean;

digitarray varchar2(20);

punctarray varchar2(25);

chararray varchar2(52);

BEGIN

digitarray:= '0123456789';

chararray:= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

punctarray:='!"#$%&()``*+,-/:;<=>?_';

-- Check if the password is same as the username

IF NLS_LOWER(password) = NLS_LOWER(username) THEN

raise_application_error(-20001, 'Password same as or similar to user');

END IF;

-- Check for the minimum length of the password

IF length(password) < 8 THEN

raise_application_error(-20002, 'Password length less than 8');

END IF;

-- Check if the password is too simple. A dictionary of words may be

-- maintained and a check may be made so as not to allow the words

-- that are too simple for the password.

IF NLS_LOWER(password) IN ('welcome', 'database', 'account', 'user', 'password', 'oracle', 'computer', 'abcd') THEN

raise_application_error(-20002, 'Password too simple');

END IF;

-- Check if the password contains at least one letter, one digit and one

-- punctuation mark.

-- 1. Check for the digit

isdigit:=FALSE;

m := length(password);

FOR i IN 1..10 LOOP

FOR j IN 1..m LOOP

IF substr(password,j,1) = substr(digitarray,i,1) THEN

isdigit:=TRUE;

GOTO findchar;

END IF;

END LOOP;

END LOOP;

-- IF isdigit = FALSE THEN

-- raise_application_error(-20003, 'Password should contain at least one digit, one character and one punctuation');

-- END IF;

-- 2. Check for the punctuation

ispunct:=FALSE;

FOR i IN 1..length(punctarray) LOOP

FOR j IN 1..m LOOP

IF substr(password,j,1) = substr(punctarray,i,1) THEN

ispunct:=TRUE;

GOTO findchar;

END IF;

END LOOP;

END LOOP;

-- IF ispunct = FALSE THEN

-- raise_application_error(-20003, 'Password should contain at least one

-- digit, one character and one punctuation');

-- END IF;

-- password must contain at least one alphabetic and one non-alphabetic

-- runs to here, then the password doesn't have any non-alphabetic.

raise_application_error(-20003, 'Password must contain at least one alphabetic and one non-alphabetic');

-- 3. Check for the character

<>

ischar:=FALSE;

FOR i IN 1..length(chararray) LOOP

FOR j IN 1..m LOOP

IF substr(password,j,1) = substr(chararray,i,1) THEN

ischar:=TRUE;

END IF;

END LOOP;

END LOOP;

IF ischar = FALSE THEN

raise_application_error(-20003, 'Password must contain at least one alphabetic and one non-alphabetic');

END IF;

-- Everything is fine; return TRUE ;

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 90

PASSWORD_GRACE_TIME 5

PASSWORD_REUSE_TIME 100

PASSWORD_REUSE_MAX 360

FAILED_LOGIN_ATTEMPTS 3

PASSWORD_VERIFY_FUNCTION MY_PASSWORD_VERIFY_FUNC;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14377/viewspace-1060108/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/14377/viewspace-1060108/

In Oracle, the PASSWORD_VERIFY_FUNCTION is a built-in function that allows you to enforce password complexity rules and policies when creating or altering user passwords. It helps to ensure that passwords meet certain requirements and enhances the security of the Oracle database. By default, Oracle provides a default password verification function called "ORA12C_STRONG_VERIFY_FUNCTION". This function enforces the following password complexity rules: 1. The password must be at least 8 characters long. 2. It must contain at least one uppercase letter. 3. It must contain at least one lowercase letter. 4. It must contain at least one numeric digit. 5. It must contain at least one special character (e.g., !@#$%^&*). You can view the details of this default password verification function by querying the DBA_USERS view: ```sql SELECT * FROM DBA_USERS; ``` To alter the password complexity rules or create a custom password verification function, you can use the DBMS_AUTHENTICATION package. Here's an example of how to create a custom password verification function in Oracle: ```sql CREATE OR REPLACE FUNCTION my_password_verify_function ( username IN VARCHAR2, password IN VARCHAR2, old_password IN VARCHAR2 ) RETURN BOOLEAN IS -- Custom password verification logic goes here BEGIN -- Return TRUE if the password meets the desired criteria, otherwise FALSE END; / ``` Once you have created your custom password verification function, you can set it as the current password verification function using the ALTER PROFILE statement: ```sql ALTER PROFILE my_profile LIMIT PASSWORD_VERIFY_FUNCTION my_password_verify_function; ``` This will enforce your custom password complexity rules for new passwords or when altering existing passwords for users associated with the specified profile. Remember to adjust the logic inside your custom password_verify_function to fit your specific requirements for password complexity and security.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值