8.2 Ensure PostgreSQL subdirectory locations are outside the data cluster

Warning! Audit Deprecated

This audit has been deprecated and will be removed in a future update.

View Next Audit Version

Information

The PostgreSQL cluster is organized to carry out specific tasks in subdirectories. For the purposes of performance, reliability, and security these subdirectories should be relocated outside the data cluster.

Rationale:

Some subdirectories contain information, such as logs, which can be of value to others such as developers. Other subdirectories can gain a performance benefit when placed on fast storage devices. Finally, relocating a subdirectory to a separate and distinct partition mitigates denial of service and involuntary server shutdown when excessive writes fill the data cluster's partition, e.g. pg_xlog and pg_log.

NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance.

Solution

Perform the following steps to remediate the subdirectory locations and permissions:

Determine appropriate data, log, and tablespace directories and locations based on your organization's security policies. If necessary, relocate all listed directories outside the data cluster.

Ensure file permissions are restricted as much as possible, i.e. only superuser read access.

When directories are relocated to other partitions, ensure that they are of sufficient size to mitigate against excessive space utilization.

Lastly, change the settings accordingly in the postgresql.conf configuration file and restart the database cluster for changes to take effect.

Default Value:

The default for data_directory is ConfigDir and the default for log_directory is log (based on absolute path of data_directory). The defaults for tablespace settings are null, or not set, upon cluster creation.

References:

https://www.postgresql.org/docs/12/static/runtime-config-file-locations.html

See Also

https://workbench.cisecurity.org/files/2536