Password expiration (sysadmin)


Job details

Name: Password expiration (sysadmin)
Platform: Sqlserver
Category: Security
Premium package: Security and compliance package
Description: Checks that CHECK_EXPIRATION option is set to ‘ON’ for all SQL authenticated logins within the sysadmin role.
Long description: Checks that CHECK_EXPIRATION option is set to ‘ON’ for all SQL authenticated logins within the sysadmin role.
Version: 1.2
Default schedule: 20 1 1 *
Requires engine install: Yes
Compatibility tag: .[type=‘instance’ & databasetype=‘sqlserver’]/instance[maj_version > ‘2005′ & hasengine=‘YES’ & eng_inst_priv = 0 & (engine_edition = ‘Microsoft SQL Server’ engine_edition = ‘Azure SQL Managed Instance’)]

Parameters

Name Default value Description
return status 1 Return status value (ALARM – 2, WARNING – 1, or OK – 0) when CHECK_EXPIRATION option is set to “OFF“.
enable check expiration NO If set to “YES“ the alert will alter the login by running “ALTER LOGIN [login_name] ] WITH CHECK_EXPIRATION = ON”.
history threshold 365 The maximum number of days to keep statistics for in the historic tables.

Job Summary

SELECT name, is_expiration_checked FROM sys.sql_logins WHERE IS_SRVROLEMEMBER('sysadmin', name) = 1;

Job Details

Execution & Dependencies

Implementation

The job involves creating tables for capturing real-time login status and history, and a stored procedure to check, log, and potentially alter the expiration status of each login found without proper expiration settings:

CREATE PROCEDURE dbw_pwd_expiration_sysadmin_proc
CREATE TABLE dbw_pwd_expiration_sysadmin_info
CREATE TABLE dbw_pwd_expiration_sysadmin_histr

Tables are indexed based on the history date to optimize data retrieval and management operations. The procedure checks each SQL login within the sysadmin role, verifies if the check expiration is on, and logs the information. If directed by the parameters, it alters the login to enforce password expiration.

Parameters

Reporting & Compliance Alignment

The process is aligned with compliance requirements:

Upgrades and Compatibility

The monitoring job supports upgrades from version 1.1 and is designed to work with Microsoft SQL Server instances version 2005 and above, including Azure SQL Managed Instances. It ensures that only valid instances are selected for execution, enhancing performance and reducing unnecessary workload.