4.1 Ensure sudo is configured correctly

Information

It is common having more than one authorized individual administrating the PostgreSQL service. It is also quite common to permit login privileges to individuals on a PostgreSQL host who otherwise are not authorized to access the server's data cluster and files. Administrating the PostgreSQL data cluster, as opposed to its data, is to be accomplished via a localhost login of a regular UNIX user account. Access to the postgres superuser account is restricted in such a manner as to interdict unauthorized access. sudo satisfies the requirements by escalating ordinary user account privileges as the PostgreSQL RDBMS superuser.
Rationale:
Without sudo, there would not be capabilities to strictly control access to the superuser account and to securely and authoritatively audit its use.

Solution

As superuser root, execute the command visudo to edit the /etc/sudoers file so the following line is present:
%pg_wheel ALL= /bin/su - postgres

Additionally, all user accounts needing superuser access must be members of the group pg_wheel. You can check by executing something similar to the following example:
groups <username>

See Also

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

Item Details

Category: ACCESS CONTROL

References: 800-53|AC-3, CSCv6|5.8

Plugin: Unix

Control ID: 7455abd00daa4364ebd43152484bc1e138685d39ed27613c7ed8b67a7ce1d283