V-72887

Severity: Medium

Generated

2019-05-20 15:48:11.984914

Status

Passed

PostgreSQL must record time stamps, in audit records and application data, that can be mapped to Coordinated Universal Time (UTC, formerly GMT).

NIST 800-53

STIG # Description Result
AU-8 AU-8: Time Stamps passed

Guidance

If time stamps are not consistently applied and there is no common time reference, it is difficult to perform forensic analysis. Time stamps generated by PostgreSQL must include date and time. Time is commonly expressed in Coordinated Universal Time (UTC), a modern continuation of Greenwich Mean Time (GMT), or local time with an offset from UTC.

Check

Note: The following instructions use the PGDATA environment variable. See supplementary content APPENDIX-F for instructions on configuring PGDATA. When a PostgreSQL cluster is initialized using initdb, the PostgreSQL cluster will be configured to use the same time zone as the target server. As the database administrator (shown here as “postgres”), check the current log_timezone setting by running the following SQL: $ sudo su - postgres $ psql -c “SHOW log_timezone” log_timezone


UTC (1 row) If log_timezone is not set to the desired time zone, this is a finding.

Fix

Note: The following instructions use the PGDATA environment variable. See supplementary content APPENDIX-F for instructions on configuring PGDATA. To change log_timezone in postgresql.conf to use a different time zone for logs, as the database administrator (shown here as “postgres”), run the following: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf log_timezone=‘UTC’ Next, restart the database: # SYSTEMD SERVER ONLY $ sudo systemctl restart postgresql-9.5 # INITD SERVER ONLY $ sudo service postgresql-9.5 restart

Test Results

  Result
PostgreSQL query: SHOW log_timezone; output should eq "UTC" passed

Code

control "V-72887" do
  title "PostgreSQL must record time stamps, in audit records and application
  data, that can be mapped to Coordinated Universal Time (UTC, formerly GMT)."
  desc  "If time stamps are not consistently applied and there is no common time
  reference, it is difficult to perform forensic analysis.
  Time stamps generated by PostgreSQL must include date and time. Time is
  commonly expressed in Coordinated Universal Time (UTC), a modern continuation
  of Greenwich Mean Time (GMT), or local time with an offset from UTC."
  impact 0.5
  tag "severity": "medium"
  tag "gtitle": "SRG-APP-000374-DB-000322"
  tag "gid": "V-72887"
  tag "rid": "SV-87539r1_rule"
  tag "stig_id": "PGS9-00-002400"
  tag "cci": "CCI-001890"
  tag "nist": ["AU-8 b", "Rev_4"]
  tag "check": "Note: The following instructions use the PGDATA environment
  variable. See supplementary content APPENDIX-F for instructions on configuring
  PGDATA.
  When a PostgreSQL cluster is initialized using initdb, the PostgreSQL cluster
  will be configured to use the same time zone as the target server.
  As the database administrator (shown here as \"postgres\"), check the current
  log_timezone setting by running the following SQL:
  $ sudo su - postgres
  $ psql -c \"SHOW log_timezone\"
  log_timezone
  --------------
  UTC
  (1 row)
  If log_timezone is not set to the desired time zone, 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.
  To change log_timezone in postgresql.conf to use a different time zone for
  logs, as the database administrator (shown here as \"postgres\"), run the
  following:
  $ sudo su - postgres
  $ vi ${PGDATA?}/postgresql.conf
  log_timezone='UTC'
  Next, restart the database:
  # SYSTEMD SERVER ONLY
  $ sudo systemctl restart postgresql-9.5
  # INITD SERVER ONLY
  $ sudo service postgresql-9.5 restart"

  sql = postgres_session(PG_DBA, PG_DBA_PASSWORD, PG_HOST)

  describe sql.query('SHOW log_timezone;', [PG_DB]) do
    its('output') { should eq PG_TIMEZONE }
  end
end