DBAtlas · Database operations atlas

Create a password policy profile and assign it to users

OracleSecurity

Command

-- Hardened profile for application/human users:
CREATE PROFILE app_user_prf LIMIT
  FAILED_LOGIN_ATTEMPTS    5
  PASSWORD_LOCK_TIME       1/24          -- 1 hour lock
  PASSWORD_LIFE_TIME       90
  PASSWORD_GRACE_TIME      7
  PASSWORD_REUSE_TIME      365
  PASSWORD_REUSE_MAX       10
  INACTIVE_ACCOUNT_TIME    60            -- accounts unused for 60 days are locked
  PASSWORD_VERIFY_FUNCTION ora12c_strong_verify_function;

-- Service accounts: password never expires, gradual password rollover enabled:
CREATE PROFILE service_account_prf LIMIT
  FAILED_LOGIN_ATTEMPTS    UNLIMITED
  PASSWORD_LIFE_TIME       UNLIMITED
  PASSWORD_ROLLOVER_TIME   1;            -- old and new password both valid for 1 day

ALTER USER customer_app PROFILE app_user_prf;

-- Check:
SELECT username, profile, account_status,
       TO_CHAR(expiry_date,'YYYY-MM-DD') AS expiry_date, lock_date
FROM   dba_users
WHERE  profile IN ('APP_USER_PRF', 'SERVICE_ACCOUNT_PRF');

SELECT profile, resource_name, limit
FROM   dba_profiles
WHERE  profile = 'APP_USER_PRF' AND resource_type = 'PASSWORD'
ORDER  BY resource_name;

What it does

A profile applies failed-login lockout, password lifetime, reuse, complexity (verify function) and inactive-account locking rules to a group of users. PASSWORD_ROLLOVER_TIME lets applications switch without an outage while a service account's password is changed.

When to use it

For security audit/CIS benchmark requirements, when creating new application users, and to separate the DEFAULT profile's loose values per user group.

Caution

No extra license. A FAILED_LOGIN_ATTEMPTS limit on a service account lets one app server with a wrong password lock the account and cause a production outage. PASSWORD_LIFE_TIME on application accounts can cause unexpected EXPIRED status. The verify function must exist under SYS (otherwise @?/rdbms/admin/utlpwdmg.sql; that script also modifies the DEFAULT profile). Changing the profile does not re-validate existing passwords.

Open in DBAtlas →

Related