8.2 Ensure PostgreSQL subdirectory locations are outside the data cluster

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 pg_log (based on absolute path of data_directory). The defaults for tablespace settings are null, or not set, upon cluster creation.

See Also

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

Item Details

Category: CONFIGURATION MANAGEMENT

References: 800-53|CM-2, CSCv6|18.7, CSCv7|18.11

Plugin: PostgreSQLDB

Control ID: 2a68ccc9c5c0ae50c687c91ad3bb19ebda433f3209ae531e3acba287b5d2591b