DB2 LUW Database Auditing
Total Page:16
File Type:pdf, Size:1020Kb
Who's Knocking at Your Door? DB2 LUW Database Auditing Melanie Stopfer IBM Software Group Session Code: G15 10:30-11:30 AM May 18, 2012 | Platform: DB2 LUW Melanie Stopfer is a Consulting Learning Specialist and Developer for IBM Software Group. As a Certified DB2 9.7 Advanced Technical Expert and Certified Learning Facilitation Specialist, she has provided hands-on in-depth technical support to customers specializing in both data warehouse and transaction systems. She has worked with development labs and worldwide customers to provide DB2 solutions since 1988. She has received numerous awards for development and implementation of DB2 recovery, performance, administration and database upgrade and migration best practice solutions In 2009, Melanie was the first DB2 LUW speaker to be inducted into the IDUG Speaker Hall of Fame. She was named best overall speaker in 2012 and Top Ten Speaker at IDUG NA 2011, 2010, 2009, 2008, 2007,and IDUG EMEA 2011, 2010, 2009, 2008 and 2007. 1 Click to edit Master title style 2 Objectives • Describe the tasks for DB2 database auditing performed by the SYSADM user • List security administration tasks for DB2 databases that require the SECADM database authority in performing database level audits • Utilize the db2audit command in implement instance level auditing and to configure the audit data and archive locations • Create audit policies to enable collection of specific categories of audit data for a DB2 database • Assign audit policies to selected tables, users or database roles using the AUDIT statement • Understand auditing authority requirements Learn the configuration and management tasks required for implementation of DB2 instance or database level auditing. You will learn the specific tasks that need to be performed by a SYSADM (system administrator) or SECADM (security administrator) to setup and control auditing of DB2 environments, including use of the db2audit command. The creation of audit policies which can be assigned to specific tables, users or database roles to perform selective collection of audit records will be discussed. Objectives: •Describe tasks for DB2 database auditing performed by SYSADM user. •List security administration tasks for DB2 databases that require SECADM database authority in performing database level audits. •Utilize db2audit command to implement instance level auditing and configure audit data and archive locations. •Create audit policies to enable collection of specific categories of audit data for DB2 database. •Assign audit policies to selected tables, users or database roles using AUDIT statement. 2 DB2 Audit Facilities Prior to DB2 9.5 • Auditing facilities controlled by SYSADM user • Audit operates at the DB2 instance level • db2audit command used to manage audit processing – db2audit configure – To select audit options – db2audit describe – To display current audit status – db2audit start/stop – To control operations – db2audit extract – To extract audit records from the active audit log – db2audit prune – To remove audit records from the active audit log $HOME/sqllib/security db2audit.cfg db2audit.log audit.del checking.del objmaint.del secmaint.del sysadmin.del validate.del context.del 3 Prior to DB2 9.5, the facilities for auditing of DB2 databases were based on using the db2audit command, which required a user with SYSADM authority. The db2audit command operates at the instance level, so the types of audit data collected and the option to enable and disable auditing impacted all of the databases running under the same instance. •The audit configuration file and the audit log file were stored at a fixed location, the security subdirectory of the sqllib path for the instance. •The extract option of the db2audit command was used to extract audit records from the active audit log file for the instance. •The prune option of the db2audit command was used to remove older audit data from the active audit log file. 3 Standard DB2 Audit Data Categories • AUDIT – Generates records when audit settings are changed or when the audit log is accessed. • CHECKING – Generates records during authorization checking of attempts to access or manipulate DB2 database objects or functions. • OBJMAINT – Generates records when creating or dropping data objects. • SECMAINT – Generates records when granting or revoking: object or database privileges, or DBADM authority. Records are also generated when the database manager security configuration parameters SYSADM_GROUP, SYSCTRL_GROUP, or SYSMAINT_GROUP are modified. • SYSADMIN – Generates records when operations requiring SYSADM, SYSMAINT, or SYSCTRL authority are performed. • VALIDATE – Generates records when authenticating users or retrieving system security information. • CONTEXT – Generates supporting detailed records, like the SQL statement for dynamic SQL. 4 DB2 provides options to select the types of audit records that can be generated by a DB2 database. There are also options to choose whether an audit record should be generated by normal successful activity, like an authorized database connection request, compared to a failed request, like a connection that is rejected because the password is incorrect or expired. There are different categories of audit records that may be generated. The categories of events available for auditing are: •Audit (AUDIT). Generates records when audit settings are changed or when the audit log is accessed. •Authorization Checking (CHECKING). Generates records during authorization checking of attempts to access or manipulate DB2 database objects or functions. •Object Maintenance (OBJMAINT). Generates records when creating or dropping data objects. •Security Maintenance (SECMAINT). Generates records when granting or revoking: object or database privileges, or DBADM authority. Records are also generated when the database manager security configuration parameters SYSADM_GROUP, SYSCTRL_GROUP, or SYSMAINT_GROUP are modified. •System Administration (SYSADMIN). Generates records when operations requiring SYSADM, SYSMAINT, or SYSCTRL authority are performed. •User Validation (VALIDATE). Generates records when authenticating users or retrieving system security information. •Operation Context (CONTEXT). Generates records to show the operation context when a database operation is performed. This category allows for better interpretation of the audit log file. When used with the log's event correlation field, a group of events can be associated back to a single database operation. For example, a query statement for dynamic queries, a package identifier for static queries, or an indicator of the type of operation being performed, such as CONNECT, can provide needed context when analyzing audit results. The SQL or XQuery statement providing the operation context might be very long and is completely shown within the CONTEXT record. This can make the CONTEXT record very large. 4 Limitations for Audit Support Prior to DB2 9.5 • Lack of flexibility: – All databases in instance are controlled by a single audit configuration. – Audit log file resides in a fixed location. For DPF databases, this may be a NFS shared file system. – Can select type of audit data but no way to limit auditing to selected users or certain tables. – Dynamic SQL text only available using CONTEXT option which generates a large volume of data. • Performance impact: – Extracting audit data from the active audit log can impact database performance. – General performance issues when producing a large volume of audit data. 5 In order to address the major limitations of database auditing in previous DB2 releases, DB2 9.5 improved and extended the facilities for database auditing. For example prior to DB2 9.5: •The db2audit command set auditing option for the DB2 instance, so all of the databases in the instance are controlled by that single audit configuration. •The Audit log file resides in a fixed location. For DPF databases, this may be a NFS shared file system. •The configuration allowed the administrator to select categories of audit data but there was no method to limit auditing to selected users or certain tables •If the audit requirements included the SQL statement text, the generation of Dynamic SQL text required using the CONTEXT option which generates a large volume of data. •The EXTRACT option of the db2audit command retrieved data from the active audit file, which could impact database performance Beginning with DB2 9.5, the audit facilities were enhanced, including these options: •The location for the active audit log files can be configured. This makes it easier for DPF partitioned databases to specify a local disk on each database server to hold the audit data. •Auditing can be enabled and configured at the database or instance level. •The generation of audit records can be limited to activity for selected users or tables. 5 DB2 9.5 & 9.7 Database Audit Features – Part 1 • Two distinct and independent methods for auditing database activity: – Instance level audit: • db2audit command utilized to configure and manage instance level audit data collection Requires SYSADM authority – Database level audit: • Management requires SECADM authority for the DB2 database • SECADM creates audit policy objects in a database using CREATE AUDIT POLICY statements • SECADM uses the AUDIT statement to assign an audit policy to the database or to some specific type of activity, including a table, a defined database role or an individual user • DB2 provided Stored procedures may be used by SECADM user to archive database audit data and