V-73019

Severity: Medium

Generated

2019-05-20 15:48:11.984914

Status

Passed

PostgreSQL must protect against a user falsely repudiating having performed organization-defined actions.

NIST 800-53

STIG # Description Result
AU-10 AU-10: Non-Repudiation passed

Guidance

Non-repudiation of actions taken is required in order to maintain data integrity. Examples of particular actions taken by individuals include creating information, sending a message, approving information (e.g., indicating concurrence or signing a contract), and receiving a message.

Non-repudiation protects against later claims by a user of not having created, modified, or deleted a particular data item or collection of data in the database.

In designing a database, the organization must define the types of data and the user actions that must be protected from repudiation. The implementation must then include building audit features into the application data tables, and configuring PostgreSQL’ audit tools to capture the necessary audit trail. Design and implementation also must ensure that applications pass individual user identification to PostgreSQL, even where the application connects to PostgreSQL with a standard, shared account.

Check

First, as the database administrator, review the current log_line_prefix settings by running the following SQL:

$ sudo su - postgres $ psql -c “SHOW log_line_prefix”

If log_line_prefix does not contain at least ‘< %m %a %u %d %r %p %m >‘, this is a finding.

Next, review the current shared_preload_libraries’ settings by running the following SQL:

$ psql -c “SHOW shared_preload_libraries”

If shared_preload_libraries does not contain “pgaudit”, this is a finding.

Fix

Note: The following instructions use the PGDATA environment variable. See supplementary content APPENDIX-F for instructions on configuring PGDATA.

Configure the database to supply additional auditing information to protect against a user falsely repudiating having performed organization-defined actions.

Using pgaudit PostgreSQL can be configured to audit these requests. See supplementary content APPENDIX-B for documentation on installing pgaudit.

To ensure that logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging.

Modify the configuration of audit logs to include details identifying the individual user:

First, as the database administrator (shown here as “postgres”), edit postgresql.conf:

$ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf

Extra parameters can be added to the setting log_line_prefix to identify the user:

log_line_prefix = ‘< %m %a %u %d %r %p %m >’

Now, as the system administrator, reload the server with the new configuration:

SYSTEMD SERVER ONLY

$ sudo systemctl reload postgresql-9.5

INITD SERVER ONLY

$ sudo service postgresql-9.5 reload

Use accounts assigned to individual users. Where the application connects to PostgreSQL using a standard, shared account, ensure that it also captures the individual user identification and passes it to PostgreSQL.

Test Results

  Result
PostgreSQL query: SHOW log_line_prefix; output should include "%m" passed
PostgreSQL query: SHOW log_line_prefix; output should include "%u" passed
PostgreSQL query: SHOW log_line_prefix; output should include "%d" passed
PostgreSQL query: SHOW log_line_prefix; output should include "%p" passed
PostgreSQL query: SHOW log_line_prefix; output should include "%r" passed
PostgreSQL query: SHOW log_line_prefix; output should include "%a" passed
PostgreSQL query: SHOW shared_preload_libraries; output should include "pgaudit" passed

Code

control "V-73019" do
  title "PostgreSQL must protect against a user falsely repudiating having performed
organization-defined actions."
  desc  "Non-repudiation of actions taken is required in order to maintain data
integrity. Examples of particular actions taken by individuals include creating
information, sending a message, approving information (e.g., indicating concurrence
or signing a contract), and receiving a message.

Non-repudiation protects against later claims by a user of not having created,
modified, or deleted a particular data item or collection of data in the database.

In designing a database, the organization must define the types of data and the user
actions that must be protected from repudiation. The implementation must then
include building audit features into the application data tables, and configuring
PostgreSQL' audit tools to capture the necessary audit trail. Design and
implementation also must ensure that applications pass individual user
identification to PostgreSQL, even where the application connects to PostgreSQL with
a standard, shared account."
  impact 0.5
  tag "severity": "medium"
  tag "gtitle": "SRG-APP-000080-DB-000063"
  tag "gid": "V-73019"
  tag "rid": "SV-87671r1_rule"
  tag "stig_id": "PGS9-00-009700"
  tag "cci": "CCI-000166"
  tag "nist": ["AU-10", "Rev_4"]
  tag "check": "First, as the database administrator, review the current
log_line_prefix settings by running the following SQL:

$ sudo su - postgres
$ psql -c \"SHOW log_line_prefix\"

If log_line_prefix does not contain at least '< %m %a %u %d %r %p %m >', this is a
finding.

Next, review the current shared_preload_libraries' settings by running the following
SQL:

$ psql -c \"SHOW shared_preload_libraries\"

If shared_preload_libraries does not contain \"pgaudit\", this is a finding."
  tag "fix": "Note: The following instructions use the PGDATA environment variable.
See supplementary content APPENDIX-F for instructions on configuring PGDATA.

Configure the database to supply additional auditing information to protect against
a user falsely repudiating having performed organization-defined actions.

Using pgaudit PostgreSQL can be configured to audit these requests. See
supplementary content APPENDIX-B for documentation on installing pgaudit.

To ensure that logging is enabled, review supplementary content APPENDIX-C for
instructions on enabling logging.

Modify the configuration of audit logs to include details identifying the individual
user:

First, as the database administrator (shown here as \"postgres\"), edit
postgresql.conf:

$ sudo su - postgres
$ vi ${PGDATA?}/postgresql.conf

Extra parameters can be added to the setting log_line_prefix to identify the user:

log_line_prefix = '< %m %a %u %d %r %p %m >'

Now, as the system administrator, reload the server with the new configuration:

# SYSTEMD SERVER ONLY
$ sudo systemctl reload postgresql-9.5

# INITD SERVER ONLY
$ sudo service postgresql-9.5 reload

Use accounts assigned to individual users. Where the application connects to
PostgreSQL using a standard, shared account, ensure that it also captures the
individual user identification and passes it to PostgreSQL."

  sql = postgres_session(PG_DBA, PG_DBA_PASSWORD, PG_HOST)

  log_line_prefix_escapes = %w(%m %u %d %p %r %a)

  log_line_prefix_escapes.each do |escape|
    describe sql.query('SHOW log_line_prefix;', [PG_DB]) do
      its('output') { should include escape }
    end
  end

  describe sql.query('SHOW shared_preload_libraries;', [PG_DB]) do
    its('output') { should include 'pgaudit' }
  end
end