﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>FranklinFaces.com - Oracle &amp; SQL Server Database Forums for all IT Professionals / Oracle Forum / Oracle Database Administration  / Modifying DEFAULT profile. / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>FranklinFaces.com - Oracle &amp; SQL Server Database Forums for all IT Professionals</description><link>http://www.franklinfaces.com/</link><webMaster>no-reply@FranklinFaces.com</webMaster><lastBuildDate>Sat, 31 Jul 2010 07:26:42 GMT</lastBuildDate><ttl>20</ttl><item><title>Modifying DEFAULT profile.</title><link>http://www.franklinfaces.com/Topic126-97-1.aspx</link><description>There is a default password verify function under&lt;SPAN style="FONT-WEIGHT: bold; COLOR: rgb(0,153,0)"&gt; &lt;FONT color=#113333&gt;$ORACLE_HOME/rdbms/admin&lt;/FONT&gt;&lt;/SPAN&gt; with filename &lt;SPAN style="FONT-WEIGHT: bold; COLOR: rgb(0,153,0)"&gt;&lt;FONT color=#113333&gt;utlpwdmg.sql&lt;/FONT&gt;&lt;/SPAN&gt;. This script creates a password verify function named "&lt;FONT color=#113333&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: rgb(0,153,0)"&gt;&lt;FONT color=#113333&gt;verify_function&lt;/FONT&gt;&lt;/SPAN&gt;"&lt;/FONT&gt; and alters the default profile with the below attributes:&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#117777&gt;ALTER PROFILE DEFAULT LIMIT&lt;BR&gt;PASSWORD_LIFE_TIME 90&lt;BR&gt;PASSWORD_GRACE_TIME 5&lt;BR&gt;PASSWORD_REUSE_TIME 1800&lt;BR&gt;PASSWORD_REUSE_MAX UNLIMITED&lt;BR&gt;FAILED_LOGIN_ATTEMPTS 6&lt;BR&gt;PASSWORD_LOCK_TIME 1/1440&lt;BR&gt;PASSWORD_VERIFY_FUNCTION verify_function;&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;verify_function has the following attributes:&lt;BR&gt;- Check if the password is same as the username&lt;BR&gt;- Check for the minimum length of the password (default = 4)&lt;BR&gt;- 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. ('welcome', 'database', 'account', 'user', 'password', 'oracle', 'computer', 'abcd' words are not accepted as password by default)&lt;BR&gt;- Check if the password contains at least one letter, one digit and one punctuation mark.&lt;BR&gt;- Check if the password differs from the previous password by at least 3 letters.&lt;BR&gt;&lt;P&gt;&lt;FONT color=#113333&gt;&lt;STRONG&gt;Here is an example of the password verify function:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;CREATE OR REPLACE FUNCTION "SYS"."VERIFY_FUNCTION"&lt;BR&gt;(username varchar2,&lt;BR&gt;  password varchar2,&lt;BR&gt;  old_password varchar2)&lt;BR&gt;  RETURN boolean IS&lt;BR&gt;   n boolean;&lt;BR&gt;   m integer;&lt;BR&gt;   differ integer;&lt;BR&gt;   isdigit boolean;&lt;BR&gt;   ischar  boolean;&lt;BR&gt;   ispunct boolean;&lt;BR&gt;   digitarray varchar2(20);&lt;BR&gt;   punctarray varchar2(25);&lt;BR&gt;   chararray varchar2(52);&lt;/P&gt;&lt;P&gt;BEGIN&lt;BR&gt;   digitarray:= '0123456789';&lt;BR&gt;   chararray:= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';&lt;BR&gt;   punctarray:='!"#$%&amp;amp;()``*+,-/:;&amp;lt;=&amp;gt;?_';&lt;/P&gt;&lt;P&gt;   -- Check if the password is same as the username&lt;BR&gt;   IF NLS_LOWER(password) = NLS_LOWER(username) THEN&lt;BR&gt;     raise_application_error(-20001, 'Password same as or similar to user');&lt;BR&gt;   END IF;&lt;/P&gt;&lt;P&gt;   -- Check for the minimum length of the password&lt;BR&gt;   IF length(password) &amp;lt; 8 THEN&lt;BR&gt;      raise_application_error(-20002, 'Password length less than 8');&lt;BR&gt;   END IF;&lt;/P&gt;&lt;P&gt;   -- Check if the password is too simple. A dictionary of words may be&lt;BR&gt;   -- maintained and a check may be made so as not to allow the words&lt;BR&gt;   -- that are too simple for the password.&lt;BR&gt;--   IF NLS_LOWER(password) IN ('welcome', 'database', 'account', 'user', 'password', 'oracle', 'computer', 'abcd') THEN&lt;BR&gt;--      raise_application_error(-20002, 'Password too simple');&lt;BR&gt;--   END IF;&lt;/P&gt;&lt;P&gt;   -- Check if the password contains at least one letter, one digit and one&lt;BR&gt;   -- punctuation mark.&lt;BR&gt;   -- 1. Check for the digit&lt;BR&gt;   isdigit:=FALSE;&lt;BR&gt;   m := length(password);&lt;BR&gt;   FOR i IN 1..10 LOOP&lt;BR&gt;      FOR j IN 1..m LOOP&lt;BR&gt;         IF substr(password,j,1) = substr(digitarray,i,1) THEN&lt;BR&gt;            isdigit:=TRUE;&lt;BR&gt;             GOTO findchar;&lt;BR&gt;         END IF;&lt;BR&gt;      END LOOP;&lt;BR&gt;   END LOOP;&lt;BR&gt;   IF isdigit = FALSE THEN&lt;BR&gt;      raise_application_error(-20003, 'Password should contain at least one digit and one character');&lt;BR&gt;   END IF;&lt;BR&gt;   -- 2. Check for the character&lt;BR&gt;   &amp;lt;&amp;lt;findchar&amp;gt;&amp;gt;&lt;BR&gt;   ischar:=FALSE;&lt;BR&gt;   FOR i IN 1..length(chararray) LOOP&lt;BR&gt;      FOR j IN 1..m LOOP&lt;BR&gt;         IF substr(password,j,1) = substr(chararray,i,1) THEN&lt;BR&gt;            ischar:=TRUE;&lt;BR&gt;--             GOTO findpunct;&lt;BR&gt;             GOTO endsearch;&lt;BR&gt;         END IF;&lt;BR&gt;      END LOOP;&lt;BR&gt;   END LOOP;&lt;BR&gt;   IF ischar = FALSE THEN&lt;BR&gt;      raise_application_error(-20003, 'Password should contain at least one \&lt;BR&gt;              digit and one character');&lt;BR&gt;   END IF;&lt;BR&gt;   -- 3. Check for the punctuation&lt;BR&gt;--   &amp;lt;&amp;lt;findpunct&amp;gt;&amp;gt;&lt;BR&gt;--   ispunct:=FALSE;&lt;BR&gt;--   FOR i IN 1..length(punctarray) LOOP&lt;BR&gt;--      FOR j IN 1..m LOOP&lt;BR&gt;--         IF substr(password,j,1) = substr(punctarray,i,1) THEN&lt;BR&gt;--            ispunct:=TRUE;&lt;BR&gt;--             GOTO endsearch;&lt;BR&gt;--         END IF;&lt;BR&gt;--      END LOOP;&lt;BR&gt;--   END LOOP;&lt;BR&gt;--   IF ispunct = FALSE THEN&lt;BR&gt;--      raise_application_error(-20003, 'Password should contain at least one \&lt;BR&gt;--              digit, one character and one punctuation');&lt;BR&gt;--   END IF;&lt;/P&gt;&lt;P&gt;   &amp;lt;&amp;lt;endsearch&amp;gt;&amp;gt;&lt;BR&gt;   -- Check if the password differs from the previous password by at least&lt;BR&gt;   -- 3 letters&lt;BR&gt;   IF old_password IS NOT NULL THEN&lt;BR&gt;     differ := length(old_password) - length(password);&lt;/P&gt;&lt;P&gt;     IF abs(differ) &amp;lt; 3 THEN&lt;BR&gt;       IF length(password) &amp;lt; length(old_password) THEN&lt;BR&gt;         m := length(password);&lt;BR&gt;       ELSE&lt;BR&gt;         m := length(old_password);&lt;BR&gt;       END IF;&lt;/P&gt;&lt;P&gt;       differ := abs(differ);&lt;BR&gt;       FOR i IN 1..m LOOP&lt;BR&gt;         IF substr(password,i,1) != substr(old_password,i,1) THEN&lt;BR&gt;           differ := differ + 1;&lt;BR&gt;         END IF;&lt;BR&gt;       END LOOP;&lt;/P&gt;&lt;P&gt;       IF differ &amp;lt; 3 THEN&lt;BR&gt;         raise_application_error(-20004, 'Password should differ by at \&lt;BR&gt;         least 3 characters');&lt;BR&gt;       END IF;&lt;BR&gt;     END IF;&lt;BR&gt;   END IF;&lt;BR&gt;   -- Everything is fine; return TRUE ;&lt;BR&gt;   RETURN(TRUE);&lt;BR&gt;END;&lt;BR&gt;/&lt;/P&gt;&lt;P&gt;&lt;BR&gt;You can customize this script to have different password verify function attributes, profile attributes and to apply to another profile.</description><pubDate>Wed, 13 May 2009 10:35:05 GMT</pubDate><dc:creator>Admin</dc:creator></item></channel></rss>