From PostgreSQL 9.x Security Technical Implementation Guide
Part of SRG-APP-000507-DB-000357
Associated with: CCI-000172
Without tracking all or selected types of access to all or selected objects (tables, views, procedures, functions, etc.), it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one.
Note: The following instructions use the PGDATA environment variable. See supplementary content APPENDIX-F for instructions on configuring PGDATA.
First, as the database administrator (shown here as "postgres"), create a schema, test_schema, create a table, test_table, within test_schema, and insert a value:
$ sudo su - postgres
$ psql -c "CREATE SCHEMA test_schema"
$ psql -c "CREATE TABLE test_schema.test_table(id INT)"
$ psql -c "INSERT INTO test_schema.test_table(id) VALUES (0)"
Next, create a role 'bob' and attempt to SELECT, INSERT, UPDATE, and DROP from the test table:
$ psql -c "CREATE ROLE BOB"
$ psql -c "SELECT * FROM test_schema.test_table"
$ psql -c "INSERT INTO test_schema.test_table VALUES (0)"
$ psql -c "UPDATE test_schema.test_table SET id = 1 WHERE id = 0"
$ psql -c "DROP TABLE test_schema.test_table"
$ psql -c "DROP SCHEMA test_schema"
Now, as the database administrator (shown here as "postgres"), review PostgreSQL/database security and audit settings to verify that audit records are created for unsuccessful attempts at the specified access to the specified objects:
$ sudo su - postgres
$ cat ${PGDATA?}/pg_log/
Configure PostgreSQL to produce audit records when unsuccessful attempts to access objects occur. All errors and denials are logged if logging is enabled. To ensure that logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging.
Lavender hyperlinks in small type off to the right (of CSS
class id
, if you view the page source) point to
globally unique URIs for each document and item. Copy the
link location and paste anywhere you need to talk
unambiguously about these things.
You can obtain data about documents and items in other
formats. Simply provide an HTTP header Accept:
text/turtle
or
Accept: application/rdf+xml
.
Powered by sagemincer