3.1.6 Ensure the log file permissions are set correctly

Information

The log_file_mode setting determines the file permissions for log files when logging_collector is enabled. The parameter value is expected to be a numeric mode specification in the form accepted by the chmod and umask system calls. (To use the customary octal format, the number must start with a 0 (zero).)
The permissions should be set to allow only the necessary access to authorized personnel. In most cases the best setting is 0600, so that only the server owner can read or write the log files. The other commonly useful setting is 0640, allowing members of the owner's group to read the files, although to make use of that, you will need to alter the log_directory setting to store the log files outside the cluster data directory.
Rationale:
Log files often contain sensitive data. Allowing unnecessary access to log files may inadvertently expose sensitive data to unauthorized personnel.

Solution

Execute the following SQL statement(s) to remediate this setting (with the example assuming a desired value of 0600):
postgres=# alter system set log_file_mode = '0600';
ALTER SYSTEM
postgres=# select pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)
postgres=# show log_file_mode;
log_file_mode
---------------
0600
(1 row)
Default Value:
0600

See Also

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

Item Details

Category: ACCESS CONTROL

References: 800-53|AC-3, CSCv6|14.4, CSCv7|14.6

Plugin: PostgreSQLDB

Control ID: c455f20fccb6ca288eae6dabf916b74636e4d7e3681f3068ab833e24265be52c