Ensuring the security of database users’ credentials is critical in any database environment. For Oracle databases , enforcing strong password policies and profile settings is a key component of maintaining a secure and compliant system. This article explores how you can enforce password strength and configure profiles to manage database user authentication settings effectively.
Understanding Profiles in Oracle Database
Profiles in Oracle Database are a collection of parameters that define limits and rules for user accounts. They allow administrators to enforce password complexity, control resource usage, and set other user-specific policies. By default, every user in Oracle is assigned a profile. Oracle Database supports the use of custom profiles to define password management rules.
Steps to Enforce Password Strength in Oracle Databases
Follow these steps to implement password strength policies and other profile settings:
Step 1: Create a Custom Profile
A custom profile can define specific password policies. Use the CREATE PROFILE statement to set up a profile with the desired rules. Below is an example:
CREATE PROFILE secure_profile
LIMIT
PASSWORD_LIFE_TIME 90 -- Password expires after 90 days
PASSWORD_GRACE_TIME 10 -- Grace period of 10 days before account lock
PASSWORD_REUSE_TIME 365 -- Prevent reuse of passwords for 1 year
PASSWORD_REUSE_MAX 5 -- Allow reuse only after 5 unique passwords
PASSWORD_LOCK_TIME 1 -- Lock account for 1 day after failed attempts
FAILED_LOGIN_ATTEMPTS 5 -- Lock account after 5 failed attempts
PASSWORD_VERIFY_FUNCTION VERIFY_FUNCTION; -- Enforce custom password rules
Step 2: Assign the Profile to Users
Assign the profile to users to enforce the policies defined within it:
ALTER USER test_user PROFILE secure_profile;
This ensures that the user test_user must adhere to the rules specified in the secure_profile.
Step 3: Use Password Verify Functions
Oracle Database supports custom password verify functions to enforce strong password policies. A password verify function can validate the complexity of passwords, such as requiring uppercase, lowercase, numbers, special characters, and minimum length.
Here’s an example of a simple password verification function:
CREATE OR REPLACE FUNCTION VERIFY_FUNCTION
RETURN BOOLEAN IS
BEGIN
IF LENGTH(password) < 12 THEN
RAISE_APPLICATION_ERROR(-20001, 'Password must be at least 12 characters long');
ELSIF password NOT LIKE '%[A-Z]%' THEN
RAISE_APPLICATION_ERROR(-20002, 'Password must contain at least one uppercase letter');
ELSIF password NOT LIKE '%[a-z]%' THEN
RAISE_APPLICATION_ERROR(-20003, 'Password must contain at least one lowercase letter');
ELSIF password NOT LIKE '%[0-9]%' THEN
RAISE_APPLICATION_ERROR(-20004, 'Password must contain at least one number');
ELSIF password NOT LIKE '%[@#$%^&*()]%' THEN
RAISE_APPLICATION_ERROR(-20005, 'Password must contain at least one special character');
END IF;
RETURN TRUE;
END;
You can then associate this function with a profile:
ALTER PROFILE secure_profile PASSWORD_VERIFY_FUNCTION VERIFY_FUNCTION;
Step 4: Monitor and Audit User Activity
To ensure compliance, regularly monitor and audit user activities:
- Use Oracle’s DBA_USERS and DBA_PROFILES views to check user accounts and their assigned profiles:
SELECT username, profile FROM dba_users;SELECT profile, resource_name, limit FROM dba_profiles WHERE profile = 'SECURE_PROFILE';- Leverage Oracle’s AUDIT commands to track failed login attempts and other security-relevant activities:
AUDIT SESSION; AUDIT USER BY ACCESS;
Step 5: Automate Alerts and Notifications
Set some alert event notifications to alert you about unusual activity, such as multiple failed login attempts or account locks. These alerts help in proactively addressing potential security threats.
Best Practices for Password Management in RDS for Oracle
- Regularly Review Profiles: Periodically update profiles to align with evolving security requirements.
- Enable Multi-Factor Authentication (MFA): Combine strong passwords with MFA for an additional layer of security.
- Implement Role-Based Access Control: Minimize the number of privileged users by adhering to the principle of least privilege.
- Rotate Credentials Frequently: Regularly update database credentials to reduce the risk of compromise.
Conclusion
By leveraging Oracle’s robust profile management features on Oracle Database, you can enforce stringent password policies and improve the overall security posture of your database environment. The ability to define custom profiles and verify functions ensures that database users adhere to strong authentication standards, protecting sensitive data from unauthorized access.







