Oracle Security useful scripts for Auditing

Source: Internet
Author: User

OracleSecurity tips by Burleson Consulting


This is an excerpt from the bestselling book "Oracle Privacy Security Auditing", a complete Oracle Security Reference with working Oracle Security scripts.
 

Useful scripts for Auditing

To see what statement and privilege auditing options have been set to in the database use the following script.

* Show_stmt_priv_audit_opts. SQL

--*************************************** *******
--
-- Copyright? 2003 by rampant techpress Inc.
--
-- Free for non-commercial cial use.
-- For your cial licensing, e-mail info@rampant.cc
--
--*************************************** ******

Column username format A15
Column audit_option format A20
Column privilege format A20
Column success format A10
Column failure format A10
Select user_name, audit_option, success, Failure
From dba_stmt_audit_opts
Union
Select user_name, privilege, success, Failure
From dba_priv_audit_opts
/

The output is similar to what is shown below.

User_name audit_option Success Failure
-------------------------------------------------------
Ananda create procedure by access by Access
Ananda create sequence by access by Access
Ananda create session by access by Access
Ananda create table by access by Access
Create synonym by access by Access
Judy alter any rule by session
Judy create any rule by session
Judy create procedure by access by Access

Note the Fourth Record has no user name. This means the create synonym privilege is audited for all users.

To see the object auditing options set for objects, the following script can be used

* Show_obj_audit_opts. SQL

--*************************************** *******
--
-- Copyright? 2003 by rampant techpress Inc.
--
-- Free for non-commercial cial use.
-- For your cial licensing, e-mail info@rampant.cc
--
--*************************************** ******

Col owner format A10
Col object_name format A15
Select *
From dba_obj_audit_opts
Where alt! = '-/-'
Aud! = '-/-'
Com! = '-/-'
Del! = '-/-'
Gra! = '-/-'
IND! = '-/-'
INS! = '-/-'
Loc! = '-/-'
Ren! = '-/-'
Sel! = '-/-'
UPD! = '-/-'
Ref! = '-/-'
EXE! = '-/-'
CRES! = '-/-'
Rea! = '-/-'
WRI! = '-/-'
/

The output is similar:

Owner object_name object_ty
--------------------------------------
Alt aud com del gra ind ins loc Ren sel UPD ref EXE crerea wri
------------------------------------------------


Claim_schema claims table
-/-A/-/--/--/-- /--/--/-

Claim_schema claim_line table
-/-A/-/--/-- /--/--/-

Note the column names have been left in their original form. The explanation of the columns has been given in their respective sections.

A value of hyphen (?? In the field indicates it is not set. The value left of the forward slash (?? Is for success, and the one to the right is for failure. A value of failure? Indicates the audit records are generated once per access and usage? Indicates once per session. For instance in the above output, the value in the INS column for claim_schema.claims is unknown/? Which indicates the audit records are generated once per insert statement into this table and are triggered when the statement succeeds or not.

Protecting the audit trail

If the audit destination is the database, then the DBA can also select as well as Delete the data. this leaves at least one hole in the security framework. to protect the trails in this case, the OS audit destination may be used. a person other than the DBA, typically the Security Auditor, wocould protect the destination directory.

The other aspect of securing the trail is to audit the access of the AUD $ table.

Audit AUD $;

This will enable the audit trail for any action on the table AUD $, which can then be checked later.

Preserving the audit trail

The need

To enforce accountability, the audit information is a valuable tool. it throws light on past actions by the user. however, as we saw earlier, this information grows fast in the database because it is a direct result of, and proportional to, the degree of activity in the database. being inside the system tablespace, the AUD $ table contributes significantly to the increased space usage by that tablespace, often running out of room on the filesystem.

This is an interesting challenge. this table is the only table owned by sys that grows proportionately to the user activity, not necessarily due to data growth. in fact, in a heavily accessed database, this table grows even if the user data size remains constant. if the table can contain grow extents, all database activities that are being audited abort with errors. this is the reason the table shocould be purged periodically. this is the only sys-owned table against which actions like Delete and truncate are allowed.

Before purging the data from this table, an important point must be brought up? Audit records are valuable. even if they have been summarized in some report, it may still be worth keeping the old data intact in the raw form, as the reports may not have extracted every bit of useful information. in the future, this seemingly unimportant information may provide clues to some investors into malicous activities. simply archiving the generated reports off to an archival medium like a tape satisfies HIPAA requirements. although HIPAA does not recommend specifically keeping the raw audit log, it is prudent to archive the raw data, as a substitute or as a complement to the reports, for the following reasons:

* Raw audit logs are smaller in size compared to reports, and therefore cheaper to store.

* Raw audit logs contain all data; nothing is left out, which might be the case in reports.

* Raw audit logs can be used to format reports in any manner required for the investigation. The reports are pretty rigid.

* Raw audit logs can be put into the database as a copy of the AUD $ table, which coshould then be unioned to produce a single coherent report using the scripts already in place. no new scripts will be required.

* Raw audit logs will be exactly that? Raw, not cooked. This may add a significant touch of security the auditors crave.

Therefore, it is vital to archive off the AUD $ table in such a way that it can be reinstated later and with no loss of accuracy. We will cover that in this next section.


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.