SlideShare a Scribd company logo
1 of 3
Download to read offline
Forcing Users to Change their Passwords                                         Administration Tips




Forcing Users to change their passwords

It's good general security practice to force Users to change their passwords (although if
you're too vigorous about it, you'll soon discover that Users, unable to remember
constantly changing passwords, start writing them down on scraps of paper -which is a
rather worse security outcome than simply doing nothing in the first place!).

Until Oracle version 8.0, however, there was no automatic way of doing this. The best I
can think of for Oracle 7 is to run the following sort of query:

SET HEAD OFF TERMOUT OFF VERIFY OFF FEEDBACK OFF ECHO OFF PAGESIZE 0
SPOOL CHANGEPWD.SQL
SELECT 'ALTER USER ' || USERNAME || ' PASSWORD EXPIRE;' FROM DBA_USERS
WHERE USERNAME<>'SYS' AND USERNAME <> 'SYSTEM';
SPOOL OFF
/

That will produce a text file output (called, in this case, "changepwd.sql") containing the
following sort of output:

SQL> SELECT 'ALTER USER ' || USERNAME || ' PASSWORD EXPIRE;'          FROM DBA_USERS
  2 WHERE USERNAME<>'SYS' AND USERNAME <> 'SYSTEM';
ALTER USER DBSNMP PASSWORD EXPIRE;
ALTER USER HOWARD PASSWORD EXPIRE;
ALTER USER OUTLN PASSWORD EXPIRE;
ALTER USER SCOTT PASSWORD EXPIRE;
SQL> SPOOL OFF

You need just to trim out the first few lines containing the actual select statement, and
the last line. Then you are left with a script which can be executed (in this case, it would
be done by typing @changepwd within SQL Plus), and which will have the effect of
expiring the existing password for all Users apart from SYS or SYSTEM.

Note that the fact the password has expired does not mean that Users will automatically
be forced to change their password. All that happens is that the next time they attempt
to log on using their old passwords, they will generate an error condition. The error state
is ORA-28001: the password has expired. Provided your application traps that error and
responds appropriately, they'll be able to change their passwords; otherwise they'll just be
unable to connect. SQL Plus is capable of trapping the error automatically and prompting
for a new password; Server Manager is not.

In Oracle 8.0 and above, things are much easier. The trick is to use resource profiles to
limit the lifetime of passwords, and specifically to use the 'password_life_time' attribute of
profiles.

Every User starts off with a profile called DEFAULT, unless you explicitly assign them a
profile as part of the 'create user...' command, or subsequently assign them one with the
'alter user...' command. A quick way to enforce password limits would therefore be to
issue the following:

ALTER PROFILE DEFAULT LIMIT

Copyright © Howard Rogers 2001            10/18/2001                                     Page 1 of 3
Forcing Users to Change their Passwords                                         Administration Tips


PASSWORD_LIFE_TIME            30;

That means that anyone using the default profile now has their password automatically
expired every 30 days. The change takes place immediately, and there is no need to
switch profiles on with the 'alter system set resource_limit=true' command.

If you want some people to have passwords expire every 30 days, and some after 60 days,
then you'll need to create named profiles to do the deed, and then assign the right profile
to the right Users. For example:

CREATE PROFILE HIGHSECURE LIMIT
PASSWORD_LIFE_TIME 30;

CREATE PROFILE LOWSECURE LIMIT
PASSWORD_LIFE_TIME 60;

ALTER USER FRED PROFILE HIGHSECURE;
ALTER USER MARY LOWSECURE;

Once again, be aware that all the profile does is to expire the password automatically.
That simply puts the User into the ORA-28001 error state, and your application needs to
trap that error and respond appropriately (by prompting for a password change) before the
User can log on again.

Also note that profiles can contain all sorts of other limits for passwords which can help
tighten security.

For example, failed_login_attempts can be used to prevent an unlimited number of
attempts to connect, testing all sorts of possible passwords each time. You either manage
to get it right within the specified number of attempts, or your account is locked out.

Password_reuse_time can be used to stop a user changing a password into itself, by
specifying how many days must elapse between successive uses of the same password.

If you'd rather not have passwords reused at all, then password_reuse_max allows you to
specify a maximum number of times a password can be set as the account password. Set it
to 1, and every password someone uses to connect must be unique.

Finally, there's password_verify_function, which can be set to the name of a function you
write yourself to perform password complexity checks (for example, the password
minimum length, whether it must contains numbers as well as letters and so on). You can
write your own function, and call it anything you like (though the function must be created
in the SYS schema), or you can take a look at the utlpwdmg.sql script in the
ORACLE_HOME/rdbms/admin directory, which is supplied by Oracle and (when run) creates
a sample function for you called "verify_function". The sample script tests that passwords
are at least 4 characters long, contain at least one alphabetic character, one numeric
character, and one special character (such as "$",'%" or "!") -which strikes me as being just
a tad too enthusiastic. It also checks that the password cannot be equal to the username
(a good test to perform, I think), and that the new password must differ from the old one
by at least three characters (which, in my experience, almost guarantees that requests to
change a password fail for no obvious reason, and thus causes Users to start writing their


Copyright © Howard Rogers 2001            10/18/2001                                     Page 2 of 3
Forcing Users to Change their Passwords                                           Administration Tips


passwords down in an attempt to make sure the requisite differences are present... and
passwords which are written down are NOT good passwords!).

I suggest you use the utlpwdmg.sql script as an example of how to do the tests -but then
write your own that makes a bit more sense.

If you utilise all these profile attributes, you might end up with something that looks like
this (I've shown the units of measure for each one, in case there's any confusion):

CREATE PROFILE SECURITY LIMIT
FAILED_LOGIN_ATTEMPTS 3                          --[MEASURED IN NUMBER OF ATTEMPTS]
PASSWORD_LIFE_TIME 30                            --[MEASURED IN DAYS]
PASSWORD_REUSE_TIME 30                           --[MEASURED IN DAYS]
PASSWORD_REUSE_MAX 3                             --[MEASURED IN NUMBER OF REUSES]
PASSWORD_VERIFY_FUNCTION MY_FUNCTION;            --[NAME OF PASSWORD VERIFICATION
FUNCTION]

This is not a complete listing of all possible password attributes for profiles, but it covers
the most important and useful ones.

Just bear in mind that a User can only have one profile at a time, so if you want to
combine this sort of password-limiting functionality with resource-limiting functionality
(such as restricting the number of sessions a User can have at a time), then both sorts of
profile attribute needs to be set within the one profile.




Copyright © Howard Rogers 2001             10/18/2001                                      Page 3 of 3

More Related Content

Similar to Userpasswrd

Getting Started with IBM i Security: User Privileges
Getting Started with IBM i Security: User PrivilegesGetting Started with IBM i Security: User Privileges
Getting Started with IBM i Security: User PrivilegesHelpSystems
 
Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013Jayasree Veliyath
 
Racf psw enhancement
Racf psw enhancementRacf psw enhancement
Racf psw enhancementLuigi Perrone
 
126611584 sap-password
126611584 sap-password126611584 sap-password
126611584 sap-passwordDavid Chan
 
Southeast Linuxfest -- MySQL User Admin Tips & Tricks
Southeast Linuxfest -- MySQL User Admin Tips & TricksSoutheast Linuxfest -- MySQL User Admin Tips & Tricks
Southeast Linuxfest -- MySQL User Admin Tips & TricksDave Stokes
 
security-checklist-database
security-checklist-databasesecurity-checklist-database
security-checklist-databaseMohsen B
 
A Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionA Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionSina Manavi
 
Oracle Security Presentation
Oracle Security PresentationOracle Security Presentation
Oracle Security PresentationFrancisco Alvarez
 
Introduction to SAP Security
Introduction to SAP SecurityIntroduction to SAP Security
Introduction to SAP SecurityNasir Gondal
 
Problems with Password Change Lockout Periods in Password Policies
Problems with Password Change Lockout Periods in Password PoliciesProblems with Password Change Lockout Periods in Password Policies
Problems with Password Change Lockout Periods in Password PoliciesMichael J Geiser
 
Sever-based Password Synchronization: Managing Multiple Passwords
Sever-based Password Synchronization: Managing Multiple PasswordsSever-based Password Synchronization: Managing Multiple Passwords
Sever-based Password Synchronization: Managing Multiple PasswordsPortalGuard
 
MySQL's new Secure by Default Install -- All Things Open October 20th 2015
MySQL's new Secure by Default Install -- All Things Open October 20th 2015MySQL's new Secure by Default Install -- All Things Open October 20th 2015
MySQL's new Secure by Default Install -- All Things Open October 20th 2015Dave Stokes
 
Configurable Password Management: Balancing Usability and Compliance
Configurable Password Management: Balancing Usability and ComplianceConfigurable Password Management: Balancing Usability and Compliance
Configurable Password Management: Balancing Usability and CompliancePortalGuard
 
Website Security
Website SecurityWebsite Security
Website SecurityCarlos Z
 
Website Security
Website SecurityWebsite Security
Website SecurityMODxpo
 
OER - UNIT 2 USER PROFILE
OER - UNIT 2 USER PROFILEOER - UNIT 2 USER PROFILE
OER - UNIT 2 USER PROFILEGirija Muscut
 
Stored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayiStored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayiMuhammed Thanveer M
 
OTech magazine article - Principle of Least Privilege
OTech magazine article - Principle of Least PrivilegeOTech magazine article - Principle of Least Privilege
OTech magazine article - Principle of Least PrivilegeBiju Thomas
 

Similar to Userpasswrd (20)

Getting Started with IBM i Security: User Privileges
Getting Started with IBM i Security: User PrivilegesGetting Started with IBM i Security: User Privileges
Getting Started with IBM i Security: User Privileges
 
Fortress SQL Server
Fortress SQL ServerFortress SQL Server
Fortress SQL Server
 
Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013Steps to mitigate Top 5 OWASP Vulnerabilities 2013
Steps to mitigate Top 5 OWASP Vulnerabilities 2013
 
Racf psw enhancement
Racf psw enhancementRacf psw enhancement
Racf psw enhancement
 
126611584 sap-password
126611584 sap-password126611584 sap-password
126611584 sap-password
 
Southeast Linuxfest -- MySQL User Admin Tips & Tricks
Southeast Linuxfest -- MySQL User Admin Tips & TricksSoutheast Linuxfest -- MySQL User Admin Tips & Tricks
Southeast Linuxfest -- MySQL User Admin Tips & Tricks
 
security-checklist-database
security-checklist-databasesecurity-checklist-database
security-checklist-database
 
A Brief Introduction in SQL Injection
A Brief Introduction in SQL InjectionA Brief Introduction in SQL Injection
A Brief Introduction in SQL Injection
 
Oracle Security Presentation
Oracle Security PresentationOracle Security Presentation
Oracle Security Presentation
 
Introduction to SAP Security
Introduction to SAP SecurityIntroduction to SAP Security
Introduction to SAP Security
 
Problems with Password Change Lockout Periods in Password Policies
Problems with Password Change Lockout Periods in Password PoliciesProblems with Password Change Lockout Periods in Password Policies
Problems with Password Change Lockout Periods in Password Policies
 
Userlimit
UserlimitUserlimit
Userlimit
 
Sever-based Password Synchronization: Managing Multiple Passwords
Sever-based Password Synchronization: Managing Multiple PasswordsSever-based Password Synchronization: Managing Multiple Passwords
Sever-based Password Synchronization: Managing Multiple Passwords
 
MySQL's new Secure by Default Install -- All Things Open October 20th 2015
MySQL's new Secure by Default Install -- All Things Open October 20th 2015MySQL's new Secure by Default Install -- All Things Open October 20th 2015
MySQL's new Secure by Default Install -- All Things Open October 20th 2015
 
Configurable Password Management: Balancing Usability and Compliance
Configurable Password Management: Balancing Usability and ComplianceConfigurable Password Management: Balancing Usability and Compliance
Configurable Password Management: Balancing Usability and Compliance
 
Website Security
Website SecurityWebsite Security
Website Security
 
Website Security
Website SecurityWebsite Security
Website Security
 
OER - UNIT 2 USER PROFILE
OER - UNIT 2 USER PROFILEOER - UNIT 2 USER PROFILE
OER - UNIT 2 USER PROFILE
 
Stored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayiStored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayi
 
OTech magazine article - Principle of Least Privilege
OTech magazine article - Principle of Least PrivilegeOTech magazine article - Principle of Least Privilege
OTech magazine article - Principle of Least Privilege
 

More from oracle documents (20)

Applyinga blockcentricapproachtotuning
Applyinga blockcentricapproachtotuningApplyinga blockcentricapproachtotuning
Applyinga blockcentricapproachtotuning
 
Windowsosauthent
WindowsosauthentWindowsosauthent
Windowsosauthent
 
Whatistnsnames
WhatistnsnamesWhatistnsnames
Whatistnsnames
 
Whatisadatabaselink
WhatisadatabaselinkWhatisadatabaselink
Whatisadatabaselink
 
Varraysandnestedtables
VarraysandnestedtablesVarraysandnestedtables
Varraysandnestedtables
 
Usertracing
UsertracingUsertracing
Usertracing
 
Undo internalspresentation
Undo internalspresentationUndo internalspresentation
Undo internalspresentation
 
Undo internals paper
Undo internals paperUndo internals paper
Undo internals paper
 
Tablespacelmt
TablespacelmtTablespacelmt
Tablespacelmt
 
Tablerename
TablerenameTablerename
Tablerename
 
Sql scripting sorcerypaper
Sql scripting sorcerypaperSql scripting sorcerypaper
Sql scripting sorcerypaper
 
Sql for dbaspresentation
Sql for dbaspresentationSql for dbaspresentation
Sql for dbaspresentation
 
Sequencereset
SequenceresetSequencereset
Sequencereset
 
Rollbacksizes
RollbacksizesRollbacksizes
Rollbacksizes
 
Rollbackshrinks
RollbackshrinksRollbackshrinks
Rollbackshrinks
 
Rollbacklmt
RollbacklmtRollbacklmt
Rollbacklmt
 
Rollbackblocking
RollbackblockingRollbackblocking
Rollbackblocking
 
Rollback1555s
Rollback1555sRollback1555s
Rollback1555s
 
Redosize
RedosizeRedosize
Redosize
 
Real liferecoverypresentation
Real liferecoverypresentationReal liferecoverypresentation
Real liferecoverypresentation
 

Userpasswrd

  • 1. Forcing Users to Change their Passwords Administration Tips Forcing Users to change their passwords It's good general security practice to force Users to change their passwords (although if you're too vigorous about it, you'll soon discover that Users, unable to remember constantly changing passwords, start writing them down on scraps of paper -which is a rather worse security outcome than simply doing nothing in the first place!). Until Oracle version 8.0, however, there was no automatic way of doing this. The best I can think of for Oracle 7 is to run the following sort of query: SET HEAD OFF TERMOUT OFF VERIFY OFF FEEDBACK OFF ECHO OFF PAGESIZE 0 SPOOL CHANGEPWD.SQL SELECT 'ALTER USER ' || USERNAME || ' PASSWORD EXPIRE;' FROM DBA_USERS WHERE USERNAME<>'SYS' AND USERNAME <> 'SYSTEM'; SPOOL OFF / That will produce a text file output (called, in this case, "changepwd.sql") containing the following sort of output: SQL> SELECT 'ALTER USER ' || USERNAME || ' PASSWORD EXPIRE;' FROM DBA_USERS 2 WHERE USERNAME<>'SYS' AND USERNAME <> 'SYSTEM'; ALTER USER DBSNMP PASSWORD EXPIRE; ALTER USER HOWARD PASSWORD EXPIRE; ALTER USER OUTLN PASSWORD EXPIRE; ALTER USER SCOTT PASSWORD EXPIRE; SQL> SPOOL OFF You need just to trim out the first few lines containing the actual select statement, and the last line. Then you are left with a script which can be executed (in this case, it would be done by typing @changepwd within SQL Plus), and which will have the effect of expiring the existing password for all Users apart from SYS or SYSTEM. Note that the fact the password has expired does not mean that Users will automatically be forced to change their password. All that happens is that the next time they attempt to log on using their old passwords, they will generate an error condition. The error state is ORA-28001: the password has expired. Provided your application traps that error and responds appropriately, they'll be able to change their passwords; otherwise they'll just be unable to connect. SQL Plus is capable of trapping the error automatically and prompting for a new password; Server Manager is not. In Oracle 8.0 and above, things are much easier. The trick is to use resource profiles to limit the lifetime of passwords, and specifically to use the 'password_life_time' attribute of profiles. Every User starts off with a profile called DEFAULT, unless you explicitly assign them a profile as part of the 'create user...' command, or subsequently assign them one with the 'alter user...' command. A quick way to enforce password limits would therefore be to issue the following: ALTER PROFILE DEFAULT LIMIT Copyright © Howard Rogers 2001 10/18/2001 Page 1 of 3
  • 2. Forcing Users to Change their Passwords Administration Tips PASSWORD_LIFE_TIME 30; That means that anyone using the default profile now has their password automatically expired every 30 days. The change takes place immediately, and there is no need to switch profiles on with the 'alter system set resource_limit=true' command. If you want some people to have passwords expire every 30 days, and some after 60 days, then you'll need to create named profiles to do the deed, and then assign the right profile to the right Users. For example: CREATE PROFILE HIGHSECURE LIMIT PASSWORD_LIFE_TIME 30; CREATE PROFILE LOWSECURE LIMIT PASSWORD_LIFE_TIME 60; ALTER USER FRED PROFILE HIGHSECURE; ALTER USER MARY LOWSECURE; Once again, be aware that all the profile does is to expire the password automatically. That simply puts the User into the ORA-28001 error state, and your application needs to trap that error and respond appropriately (by prompting for a password change) before the User can log on again. Also note that profiles can contain all sorts of other limits for passwords which can help tighten security. For example, failed_login_attempts can be used to prevent an unlimited number of attempts to connect, testing all sorts of possible passwords each time. You either manage to get it right within the specified number of attempts, or your account is locked out. Password_reuse_time can be used to stop a user changing a password into itself, by specifying how many days must elapse between successive uses of the same password. If you'd rather not have passwords reused at all, then password_reuse_max allows you to specify a maximum number of times a password can be set as the account password. Set it to 1, and every password someone uses to connect must be unique. Finally, there's password_verify_function, which can be set to the name of a function you write yourself to perform password complexity checks (for example, the password minimum length, whether it must contains numbers as well as letters and so on). You can write your own function, and call it anything you like (though the function must be created in the SYS schema), or you can take a look at the utlpwdmg.sql script in the ORACLE_HOME/rdbms/admin directory, which is supplied by Oracle and (when run) creates a sample function for you called "verify_function". The sample script tests that passwords are at least 4 characters long, contain at least one alphabetic character, one numeric character, and one special character (such as "$",'%" or "!") -which strikes me as being just a tad too enthusiastic. It also checks that the password cannot be equal to the username (a good test to perform, I think), and that the new password must differ from the old one by at least three characters (which, in my experience, almost guarantees that requests to change a password fail for no obvious reason, and thus causes Users to start writing their Copyright © Howard Rogers 2001 10/18/2001 Page 2 of 3
  • 3. Forcing Users to Change their Passwords Administration Tips passwords down in an attempt to make sure the requisite differences are present... and passwords which are written down are NOT good passwords!). I suggest you use the utlpwdmg.sql script as an example of how to do the tests -but then write your own that makes a bit more sense. If you utilise all these profile attributes, you might end up with something that looks like this (I've shown the units of measure for each one, in case there's any confusion): CREATE PROFILE SECURITY LIMIT FAILED_LOGIN_ATTEMPTS 3 --[MEASURED IN NUMBER OF ATTEMPTS] PASSWORD_LIFE_TIME 30 --[MEASURED IN DAYS] PASSWORD_REUSE_TIME 30 --[MEASURED IN DAYS] PASSWORD_REUSE_MAX 3 --[MEASURED IN NUMBER OF REUSES] PASSWORD_VERIFY_FUNCTION MY_FUNCTION; --[NAME OF PASSWORD VERIFICATION FUNCTION] This is not a complete listing of all possible password attributes for profiles, but it covers the most important and useful ones. Just bear in mind that a User can only have one profile at a time, so if you want to combine this sort of password-limiting functionality with resource-limiting functionality (such as restricting the number of sessions a User can have at a time), then both sorts of profile attribute needs to be set within the one profile. Copyright © Howard Rogers 2001 10/18/2001 Page 3 of 3