使用指令碼utlpwdmg.sql啟用密碼管理
啟動密碼管理以前:
SQL> select * from dba_profiles where resource_type='PASSWORD';
PROFILE RESOURCE_NAME RESOURCE_TYPE LIMIT
------------------------------ -------------------------------- ------------- ----------------------------------------
DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD UNLIMITED
DEFAULT PASSWORD_LIFE_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_REUSE_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_REUSE_MAX PASSWORD UNLIMITED
DEFAULT PASSWORD_VERIFY_FUNCTION PASSWORD UNLIMITED
DEFAULT PASSWORD_LOCK_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_GRACE_TIME PASSWORD UNLIMITED
啟用密碼管理:
SQL> @c:oracleora92rdbmsadminutlpwdmg.sql
Function created
Profile altered
啟動後:
SQL> select * from dba_profiles where resource_type='PASSWORD';
PROFILE RESOURCE_NAME RESOURCE_TYPE LIMIT
------------------------------ -------------------------------- ------------- ----------------------------------------
DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD 3
DEFAULT PASSWORD_LIFE_TIME PASSWORD 60
DEFAULT PASSWORD_REUSE_TIME PASSWORD 1800
DEFAULT PASSWORD_REUSE_MAX PASSWORD UNLIMITED
DEFAULT PASSWORD_VERIFY_FUNCTION PASSWORD VERIFY_FUNCTION
DEFAULT PASSWORD_LOCK_TIME PASSWORD .0006
DEFAULT PASSWORD_GRACE_TIME PASSWORD 10
如果新設定的密碼不符合複雜性檢驗規則,就會報錯。例如:
SQL> alter user lh identified by lh;
alter user lh identified by lh
ORA-28003: password verification for the specified password failed
ORA-20001: Password same as or similar to user
取消密碼管理:
SQL>alter profile DEFAULT limit
如:SQL>alter profile DEFAULT limit password_reuse_time unlimited;
停止密碼檢驗函式:
SQL>alter profile DEFAULT limit password_verify_function null;
熟悉utlpwdmg.sql指令碼有助我們更深入瞭解oracle密碼檢查機制。我們可以修改或自定義密碼檢驗函式。附utlpwdmg.sql指令碼內容:
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/
CREATE OR REPLACE FUNCTION verify_function
(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) < 4 THEN
raise_application_error(-20002, 'Password length less than 4');
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 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;
GOTO findpunct;
END IF;
END LOOP;
END LOOP;
IF ischar = FALSE THEN
raise_application_error(-20003, 'Password should contain at least one
digit, one character and one punctuation');
END IF;
-- 3. 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 endsearch;
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;
<
-- 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 IN 1..m LOOP
IF substr(password,i,1) != substr(old_password,i,1) THEN
differ := differ + 1;
END IF;
END LOOP;
IF differ < 3 THEN
raise_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;
/
-- 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
PASSWORD_GRACE_TIME 10
PASSWORD_REUSE_TIME 1800
PASSWORD_REUSE_MAX UNLIMITED
FAILED_LOGIN_ATTEMPTS 3
PASSWORD_LOCK_TIME 1/1440
PASSWORD_VERIFY_FUNCTION verify_function;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/207/viewspace-800948/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle密碼規則及資源限制函式指令碼utlpwdmg.sqlOracle密碼函式指令碼SQL
- 密碼指令碼密碼指令碼
- 跑wordpress使用者密碼指令碼密碼指令碼
- 自動輸入密碼使用root許可權開啟shell指令碼密碼指令碼
- PowerShell 指令碼中的密碼指令碼密碼
- Windows XP 學用指令碼恢復系統的使用者密碼(轉)Windows指令碼密碼
- profile使用者密碼管理密碼
- 用LastPass管理好你的密碼AST密碼
- 使用 Mitmdump 與 Python 指令碼進行密碼嗅探MITPython指令碼密碼
- 密碼管理工具KeeWeb使用密碼Web
- 用於管理應用程式得shell指令碼指令碼
- MySQL——密碼管理MySql密碼
- MYSQL密碼管理MySql密碼
- 應用密碼學——古典密碼密碼學
- 使用shell指令碼在Linux中管理Java應用程式指令碼LinuxJava
- linux 指令碼切換使用者不用輸入密碼Linux指令碼密碼
- ssh自動輸入密碼指令碼 切換目錄指令碼密碼指令碼
- mysql學習之-密碼管理(預設密碼,修改密碼,解決忘記密碼)MySql密碼
- 使用 Bitwarden 和 Podman 管理你的密碼密碼
- 應用密碼學 - 公鑰密碼密碼學
- 應用密碼學——分組密碼密碼學
- 案例四:Shell指令碼生成隨機密碼指令碼隨機密碼
- SSH 無密碼遠端執行指令碼密碼指令碼
- ruby指令碼,隨機生成複雜密碼指令碼隨機密碼
- MySQL如何啟用密碼強度審計MySql密碼
- 啟用oracle資料庫密碼函式Oracle資料庫密碼函式
- MYSQL建立使用者時用密文密碼MySql密碼
- 密碼管理系統密碼
- oracle密碼安全管理Oracle密碼
- 密碼管理規範密碼
- httpd啟動指令碼httpd指令碼
- nginx重啟指令碼Nginx指令碼
- redis重啟指令碼Redis指令碼
- Nginx 重啟指令碼Nginx指令碼
- 【密碼】Oracle使用者密碼系列密碼Oracle
- IIS8應用池重啟指令碼指令碼
- 密碼安全:密碼設定要求,密碼爆破辦法,密碼歸類使用,密碼處置方案密碼
- 如何使用 Bitwarden 和 Podman 管理你的密碼密碼