Oracle修改密码复杂度策略

更新时间:2023-05-04 01:22:12 阅读: 评论:0

Oracle修改密码复杂度策略1.以dba管理员登录
sqlplus / as sysdba
2.查看密码策略
SQL> lect * from dba_profiles where resource_NAME='PASSWORD_VERIFY_FUNCTION'; 3.登录PL/SQL,以sysdba⽅式登录,密码输⼊默认密码  change_on_install
4.执⾏两个Funtion
CREATE OR REPLACE FUNCTION verify_function
(urname varchar2,
password varchar2,
old_password varchar2)
RETURN boolean IS
n boolean;
m integer;
differ i杨幂情史 nteger;
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 urname
IF NLS_LOWER(password) = NLS_LOWER(urname) THEN
rai_application_error(-20001, 'Password same as or similar to ur');
END IF;
-- Check for the minimum length of the password
IF length(password) < 9 THEN
rai_application_error(-20002, 'Password length less than 9');
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', 'databa', 'account', 'ur', 'password', 'oracle', 'computer', 'abcd') THEN      rai_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 LOOP
IF substr(password,j,1) = substr(digitarray,i,1) THEN
isdigit:=TRUE;
GOTO findch醒神茶 ar;
END IF;
END LOOP;
END LOOP;
IF isdigit = FALSE THEN
rai_application_error(-20003, 'Password should contain at least one digit, one character and one punctuation');  END IF;
-- 2. Check for the character
<<findchar>>
ischar:=FALSE;
FOR i IN 1..length(chararray) LOOP
FOR j LOOP
IF substr(password,j,1) = substr(chararray,i,1) THEN
ischar:=TRUE;
GOTO findpunct;
END IF;
END LOOP;
END LOOP;
IF ischar = FALSE THEN
rai_application_error(-20003, 'Password should contain at least one \
digit, one character and one punctuation');
END IF;
-
- 3. Check for the punctuation
<<findpunct>>
ispunct:=FALSE;
FOR i IN 1..length(punctarray) LOOP
FOR j LOOP
IF substr(password,j,1) = substr(punctarray,i,1) THE山德士上校 N
ispunct:=TRUE;
GOTO endarch;
END IF;
END LOOP;
END LOOP;
IF ispunct = FALSE THEN
rai_application_error(-20003, 'Password should contain at least one \
digit, one character and one punctuation');
END IF;
<<endarch>>
-- Check if the password differs from the previous password by at least
-- 3 letters
IF old_password IS NOT NULL THEN
differ := length(old_password) - length(password);
IF abs(differ) < 3 THEN
IF length(password) < length(old_password) THEN
m := length(password);
ELSE
m := length(old_password);
END IF;
differ := abs(differ);
FOR i LOOP
IF substr(password,i,1) != substr(old_password,i,1) THEN
differ := differ + 1;
END IF;
END LOOP;
IF differ < 3 THEN
rai_application_error(-20004, 'Password should differ by at \
least 3 characters');
END IF;
END IF;
END IF;
-- Everything is fine; return TRUE ;
RETURN(TRUE);
END;
CREATE OR REPLACE FUNCTION verify_function_11G
(urname varchar2,
password varchar2,
old_password varchar2)
RETURN boolean IS
n boolean;
m integer;
differ integer;
isdigit boolean;
ischar  boolean;
ispunct boolean;
db_name varchar2(40);
digitarray varchar2(20);
punctarray varchar2(25);
chararray varchar2(52);
i_char varchar2(10);
simple_password varchar2(10);
rever_ur varchar2(32);
BEGIN
digitarray:= '0123456789';
chararray:= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';  -- Check for the minimum length of the password
IF length(password) < 8 THEN
rai_application_error(-20001, 'Password length less than 8');
END IF;
-- Check if the password is same as the urname or urname(1-100)
IF NLS_LOWER(password) = NLS_LOWER(urname) THEN
rai_application_error(-20002, 'Password same as or similar to ur');
END IF;
FOR i IN 1..四川早餐 100 LOOP
i_char := to_char(i);
if NLS_LOWER(urname)|| i_char = NLS_LOWER(password) THEN
rai_application_error(-20005, 'Password same as or similar to ur name ');
END IF;
END LOOP;
-- Check if the password is same as the urname reverd
FOR i in REVERSE 1..length(urname) LOOP
rever_ur := rever_ur || substr(urname, i, 1);
END LOOP;
IF NLS_LOWER(password) = NLS_LOWER(rever_ur) TH福建土楼介绍 EN
rai_application_error(-20003, 'Password same as urname reverd');
END IF;
-- Check if the password is the same as rver name and or rvername(1-100)
lect name into db_name from sys.v$databa;
if NLS_LOWER(db_name) = NLS_LOWER(password) THEN
rai_application_error(-20004, 'Password same as or similar to rver name');
END IF;
FOR i IN 1..100 LOOP
i_char := to_char(i);
if NLS_LOWER(db_name)|| i_char = NLS_LOWER(password) THEN
rai_application_error(-20005, 'Password same as or similar to rver name ');
END IF;
END LOOP;
-- 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 ('welcome1', 'databa1', 'account1', 'ur1234', 'password1', 'oracle123', 'computer1', 'abcdefg1', 'change_on_install') THEN      rai_application_error(-20006, 'Password too simple');
END IF;
-- Check if the password is the same as oracle (1-100)
simple_password := 'oracle';
FOR i IN 1..100 LOOP
i_char := to_char(i);
if simple_password || i_char = NLS_LOWER(password) THEN
rai_application_error(-20007, 'Pas清蒸鱼的家常做法 sword too simple ');
END IF;
END LOOP;
-- Check if the password contains at least one letter, one digit
-- 1. Check for the digit
isdigit:=FALSE;
m := length(password)赞美母爱的诗歌 ;
FOR i IN 1..10 LOOP
FOR j 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
rai_application_error(-20008, 'Password must contain at least one digit, one character');
END IF;
-- 2. Check for the character
<<findchar>>
ischar:=FALSE;
FOR i IN 1..length(chararray) LOOP
FOR j LOOP
IF substr(password,j,1) = substr(chararray,i,1) THEN
ischar:=TRUE;
GOTO endarch;
END IF;
END LOOP;
END LOOP;
IF ischar = FALSE THEN
rai_application_error(-20009, 'Password must contain at least one \
digit, and one character');
END IF;
<<endarch>>
-- Check if the password differs from the previous password by at least
-- 3 letters
IF old_password IS NOT NULL THEN
differ := length(old_password) - length(password);
differ := abs(differ);
IF differ < 3 THEN
IF length(password) < length(old_password) THEN
m := length(password);
ELSE
m := length(old_password);
END IF;
FOR i LOOP
IF substr(password,i,1) != substr(old_password,i,1) THEN
differ := differ + 1;
END IF;
END LOOP;
IF differ < 3 THEN
rai_application_error(-20011, 'Password should differ from the \
old password by at least 3 characters');
END IF;
END IF;
END IF;
-- Everything is fine; return TRUE ;
RETURN(TRUE);
END;
5.设置密码策略
SQL> alter system t resource_limit = true;
SQL> alter profile default limit password_verify_function verify_function;
6.查看密码策略是否设置成功
SQL> lect * from dba_profiles where resource_NAME='PASSWORD_VERIFY_FUNCTION';

本文发布于:2023-05-04 01:22:12,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/94778.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:密码   策略   设置   查看   是否   复杂度
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图