3.1.6 Ensure the log file permissions are set correctly

Warning! Audit Deprecated

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

View Next Audit Version

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 either alter the log_directory setting to store the log files outside the cluster data directory or use PGSETUP_INITDB_OPTIONS='-k -g' when initializing the cluster.

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 the 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/benchmarks/11864

Item Details

References: CSCv7|14.6

Plugin: PostgreSQLDB

Control ID: bbf68880d7d85a8d3d76510e93b841a72d6d3b281b7534f15dd6d69ccfab731f