SV-214125r508027_rule
V-214125
SRG-APP-000098-DB-000042
PGS9-00-008800
CAT II
10
Note: The following instructions use the PGDATA and PGVER environment variables. See supplementary content APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER.
To ensure that logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging.
If logging is enabled the following configurations can be made to log the source of an event.
First, as the database administrator, edit postgresql.conf:
$ sudo su - postgres
$ vi ${PGDATA?}/postgresql.conf
###### Log Line Prefix
Extra parameters can be added to the setting log_line_prefix to log source of event:
# %a = application name
# %u = user name
# %d = database name
# %r = remote host and port
# %p = process ID
# %m = timestamp with milliseconds
For example:
log_line_prefix = '< %m %a %u %d %r %p %m >'
###### Log Hostname
By default only IP address is logged. To also log the hostname the following parameter can also be set in postgresql.conf:
log_hostname = on
Now, as the system administrator, reload the server with the new configuration:
# SYSTEMD SERVER ONLY
$ sudo systemctl reload postgresql-${PGVER?}
# INITD SERVER ONLY
$ sudo service postgresql-${PGVER?} reload
Check PostgreSQL settings and existing audit records to verify information specific to the source (origin) of the event is being captured and stored with audit records.
As the database administrator (usually postgres, check the current log_line_prefix and log_hostname setting by running the following SQL:
$ sudo su - postgres
$ psql -c "SHOW log_line_prefix"
$ psql -c "SHOW log_hostname"
For a complete list of extra information that can be added to log_line_prefix, see the official documentation: https://www.postgresql.org/docs/current/static/runtime-config-logging.html#GUC-LOG-LINE-PREFIX
If the current settings do not provide enough information regarding the source of the event, this is a finding.
V-214125
False
PGS9-00-008800
Check PostgreSQL settings and existing audit records to verify information specific to the source (origin) of the event is being captured and stored with audit records.
As the database administrator (usually postgres, check the current log_line_prefix and log_hostname setting by running the following SQL:
$ sudo su - postgres
$ psql -c "SHOW log_line_prefix"
$ psql -c "SHOW log_hostname"
For a complete list of extra information that can be added to log_line_prefix, see the official documentation: https://www.postgresql.org/docs/current/static/runtime-config-logging.html#GUC-LOG-LINE-PREFIX
If the current settings do not provide enough information regarding the source of the event, this is a finding.
M
3994