STIGQter STIGQter: STIG Summary: EDB Postgres Advanced Server v11 on Windows Security Technical Implementation Guide Version: 2 Release: 1 Benchmark Date: 23 Oct 2020:

The EDB Postgres Advanced Server must reveal detailed error messages only to the ISSO, ISSM, SA, and DBA.

DISA Rule

SV-224186r508023_rule

Vulnerability Number

V-224186

Group Title

SRG-APP-000267-DB-000163

Rule Version

EP11-00-006600

Severity

CAT II

CCI(s)

Weight

10

Fix Recommendation

# Set client_min_messages
To set the level of detail for errors messages exposed to clients, connect to the database as a database superuser using psql and execute the following commands:

ALTER SYSTEM SET client_min_messages = notice;
SELECT pg_reload_conf();

# Update EDB Postgres Advanced Server database log permissions.
If the EDB Postgres Advanced Server log_destination parameter is set to "stderr" or "csvlog":

1) Change ownership of EDB Postgres Advanced Server database log directory and its contents to the database service account if they are not owned by the database service account.

If the EDB Postgres Advanced Server database log directory and its contents are not owned by the database service account, change ownership to the service account responsible for running the Advanced Server database service.

This may be done using Windows Explorer:
Browse to the directory where the log directory folder is located.
Select and right-click on the folder, select "Properties", select the "Securities" tab, and select the "Advanced" button.
Select the "Change" link shown next to the owner of the folder to change the folder's owner.

Alternatively, the Windows TAKEOWN command or the ICACLS command (with the /SETOWNER option) may be used to change ownership of folders and files using the Windows command prompt.

2) Modify permissions on the EDB Postgres Advanced Server database log directory and its contents to meet the requirement to protect against unauthorized access.

This may be done using Windows Explorer:
Browse to the directory where the log directory folder is located.
Select and right-click on the folder, select "Properties", and select the "Security" tab.
Modify the security permissions to:
NT AUTHORITY/NetworkService (or configured database service account) (Full Control)
Administrators (Read)
Users (none)

Alternatively, the Windows ICACLS command may be used to modify permissions on folders and files using the Windows command prompt.

If the EDB Postgres Advanced Server log_destination parameter is set to "eventlog", update the Windows policy settings to only allow access to the Windows Application event log to authorized users.

If other permissions have been granted to other users or groups, ensure that the system documentation is updated to note the organizationally approved permission setting and corresponding justification of the permission settings for this requirement.

# Update EDB Audit log permissions.
1) Change ownership of EDB Audit directory and its contents to the database service account if they are not owned by the database service account.

If the EDB Audit directory and its contents are not owned by the database service account, change ownership to the service account responsible for running the Advanced Server database service.

This may be done using Windows Explorer:
Browse to the directory where the EDB audit directory folder is located.
Select and right-click on the folder, select "Properties", select the "Securities" tab, and select the "Advanced" button.
Select the "Change" link shown next to the owner of the folder to change the folder's owner.

Alternatively, the Windows TAKEOWN command or the ICACLS command (with the /SETOWNER option) may be used to change ownership of folders and files using the Windows command prompt.

2) Modify permissions on the EDB Audit directory and its contents to meet the requirement to protect against unauthorized access.

This may be done using Windows Explorer:
Browse to the directory where the EDB audit directory folder is located.
Select and right-click on the folder, select "Properties", and select the "Security" tab.
Modify the security permissions to:
NT AUTHORITY/NetworkService (or configured database service account) (Full Control)
Administrators (Read)
Users (none)

Alternatively, the Windows ICACLS command may be used to modify permissions on folders and files using the Windows command prompt.

If other permissions have been granted to other users or groups, ensure that the system documentation is updated to note the organizationally approved permission setting and corresponding justification of the permission settings for this requirement.

# Update custom database code and application code
Configure custom database code and associated application code not to display detailed error messages to those not authorized to view them.

Check Contents

# Verify client_min_messages setting
Check the level of detail for errors exposed to clients, connect to the database as a database superuser using psql and execute the following psql command:

SHOW client_min_messages

If client_min_messages is set to LOG or DEBUG, this is a finding.

# Verify access to database logs and audit log restricted to authorized users
Verify that only authorized users are able to access EDB Postgres Advanced Server database and audit logs that may contain detailed error messages. By default, these logs are written to directories under the EDB Postgres Advanced Server data directory. The full path of the data directory can be determined by connecting to the database as a database superuser using psql and execute the following psql command:

SHOW data_directory

To check the access permissions assigned to the database logs, first determine where the logs are being written by connecting to the database as a database superuser using psql and execute the following psql command:

SHOW log_destination

# Verify access to database logs (stderr or csvlog)
If the log_destination parameter is set to "stderr" or "csvlog", next determine the directory on the files system where the logs are being written by connecting to the database as a database superuser using psql and execute the following psql command:

SHOW log_directory

If the log_directory parameter is set to a relative path, database logs have been configured to be written to the named directory under the EDB Postgres Advanced Server data directory.

If the log_directory parameter is set to an absolute path, database logs have been configured to be written to that location.

Next, determine ownership of the log directory folder. This can be done using Windows Explorer or via a Windows command prompt.

Using Windows Explorer:
Browse to the directory where the log directory folder is located.
Select and right-click on the folder, select "Properties", select the "Security" tab, and select the "Advanced" button.
Note the Value of the Owner field.

Using the Windows command prompt, enter the following command, replacing <EDB log directory> with the correct path for the log directory:

dir "<EDB log directory>" /Q /S

Note: The above command will list all of the files and folders under the audit directory. To make the output of this command easier to review, it may be redirected to a text file.

Review the system security documentation. If the owner listed for the folder and any of the files and subfolders in the EDB log directory and its content is not the service account responsible for running the Advanced Server database service this is a finding.

Next, check the permissions assigned to the EDB log directory folder and its content. Again, this can be done using Windows Explorer or via a Windows command prompt.

Using Windows Explorer:
Browse to the directory where the EDB log directory folder is located.
Select and right-click on the folder, select "Properties", and select the "Security" tab.
Review the users and groups and permissions assigned to them for the folder.

Using a Windows command prompt, the following command may be used to list file permissions:

icacls "<EDB log directory>"
icacls "<EDB log directory>\*"
Review the users and groups and permissions assigned to them for the file(s).

Note: The above commands will list the permissions for all files and folders under the log directory. To make the output of this command easier to review, it may be redirected to a text file.

Review the system security documentation.
If read or greater permissions are granted to Everyone or to the Users group, this is a finding.
If any account other than the database service account, Administrators, or other documented users are listed as having Read permission, this is a finding.
If any account other than the database service account or other documented users are listed as having the Full Control permission, this is a finding.
If any permissions are listed for any account other than the database service account that are not identified in the system documentation as being approved for the permission, this is a finding.

# Verify access to database logs (eventlog)
If the log_destination parameter is set to "eventlog", logs are written to the Windows Application event log. Review system security documentation and the Windows event log local and group policy settings. If the configured Windows Event Log policies give access to the Windows Application event log to any system users who are not documented as approved to view EDB Postgres Advanced Server logs, this is a finding.

# Verify access to audit logs
First determine the directory on the files system where the EDB Audit logs are being written by connecting to the database as a database superuser using psql and execute the following psql command:

SHOW edb_audit_directory

If the edb_audit_directory parameter is set to a relative path, database logs have been configured to be written to the named directory under the EDB Postgres Advanced Server data directory.

If the log_directory parameter is set to an absolute path, database logs have been configured to be written to that location.

Next, determine ownership of the EDB audit directory folder. This can be done using Windows Explorer or via a Windows command prompt.

Using Windows Explorer:
Browse to the directory where the EDB audit directory folder is located.
Select and right-click on the folder, select "Properties", select the "Security" tab, and select the "Advanced" button.
Note the Value of the Owner field.

Using the Windows command prompt, enter the following command, replacing <EDB Audit directory> with the correct path for the EDB audit directory:

dir "<EDB Audit directory>" /Q /S

Note: The above command will list all of the files and folders under the audit directory. To make the output of this command easier to review, it may be redirected to a text file.

Review the system security documentation. If the owner listed for the folder and any of the files and subfolders in the EDB audit directory and its content is not the service account responsible for running the Advanced Server database service this is a finding.

Next, check the permissions assigned to the EDB audit directory folder and its content. Again, this can be done using Windows Explorer or via a Windows command prompt.

Using Windows Explorer:
Browse to the directory where the EDB audit directory folder is located.
Select and right-click on the folder, select "Properties", and select the "Security" tab.
Review the users and groups and permissions assigned to them for the folder.

Using a Windows command prompt, the following command may be used to list file permissions:

icacls "<EDB Audit directory>"
icacls "<EDB Audit directory>\*"
Review the users and groups and permissions assigned to them for the file(s).

Note: The above commands will list the permissions for all files and folders under the data directory. To make the output of this command easier to review, it may be redirected to a text file.

Review the system security documentation.
If read or greater permissions are granted to Everyone or to the Users group, this is a finding.
If any account other than the database service account, Administrators, or other documented users are listed as having Read permission, this is a finding.
If any account other than the database service account or other documented users are listed as having the Full Control permission, this is a finding.
If any permissions are listed for any account other than the database service account that are not identified in the system documentation as being approved for the permission, this is a finding.

# Verify custom database code and application does not display detailed error messages
Check custom database code and application code to determine if detailed error messages are ever displayed to unauthorized individuals.

If detailed error messages are displayed to individuals not authorized to view them, this is a finding.

Vulnerability Number

V-224186

Documentable

False

Rule Version

EP11-00-006600

Severity Override Guidance

# Verify client_min_messages setting
Check the level of detail for errors exposed to clients, connect to the database as a database superuser using psql and execute the following psql command:

SHOW client_min_messages

If client_min_messages is set to LOG or DEBUG, this is a finding.

# Verify access to database logs and audit log restricted to authorized users
Verify that only authorized users are able to access EDB Postgres Advanced Server database and audit logs that may contain detailed error messages. By default, these logs are written to directories under the EDB Postgres Advanced Server data directory. The full path of the data directory can be determined by connecting to the database as a database superuser using psql and execute the following psql command:

SHOW data_directory

To check the access permissions assigned to the database logs, first determine where the logs are being written by connecting to the database as a database superuser using psql and execute the following psql command:

SHOW log_destination

# Verify access to database logs (stderr or csvlog)
If the log_destination parameter is set to "stderr" or "csvlog", next determine the directory on the files system where the logs are being written by connecting to the database as a database superuser using psql and execute the following psql command:

SHOW log_directory

If the log_directory parameter is set to a relative path, database logs have been configured to be written to the named directory under the EDB Postgres Advanced Server data directory.

If the log_directory parameter is set to an absolute path, database logs have been configured to be written to that location.

Next, determine ownership of the log directory folder. This can be done using Windows Explorer or via a Windows command prompt.

Using Windows Explorer:
Browse to the directory where the log directory folder is located.
Select and right-click on the folder, select "Properties", select the "Security" tab, and select the "Advanced" button.
Note the Value of the Owner field.

Using the Windows command prompt, enter the following command, replacing <EDB log directory> with the correct path for the log directory:

dir "<EDB log directory>" /Q /S

Note: The above command will list all of the files and folders under the audit directory. To make the output of this command easier to review, it may be redirected to a text file.

Review the system security documentation. If the owner listed for the folder and any of the files and subfolders in the EDB log directory and its content is not the service account responsible for running the Advanced Server database service this is a finding.

Next, check the permissions assigned to the EDB log directory folder and its content. Again, this can be done using Windows Explorer or via a Windows command prompt.

Using Windows Explorer:
Browse to the directory where the EDB log directory folder is located.
Select and right-click on the folder, select "Properties", and select the "Security" tab.
Review the users and groups and permissions assigned to them for the folder.

Using a Windows command prompt, the following command may be used to list file permissions:

icacls "<EDB log directory>"
icacls "<EDB log directory>\*"
Review the users and groups and permissions assigned to them for the file(s).

Note: The above commands will list the permissions for all files and folders under the log directory. To make the output of this command easier to review, it may be redirected to a text file.

Review the system security documentation.
If read or greater permissions are granted to Everyone or to the Users group, this is a finding.
If any account other than the database service account, Administrators, or other documented users are listed as having Read permission, this is a finding.
If any account other than the database service account or other documented users are listed as having the Full Control permission, this is a finding.
If any permissions are listed for any account other than the database service account that are not identified in the system documentation as being approved for the permission, this is a finding.

# Verify access to database logs (eventlog)
If the log_destination parameter is set to "eventlog", logs are written to the Windows Application event log. Review system security documentation and the Windows event log local and group policy settings. If the configured Windows Event Log policies give access to the Windows Application event log to any system users who are not documented as approved to view EDB Postgres Advanced Server logs, this is a finding.

# Verify access to audit logs
First determine the directory on the files system where the EDB Audit logs are being written by connecting to the database as a database superuser using psql and execute the following psql command:

SHOW edb_audit_directory

If the edb_audit_directory parameter is set to a relative path, database logs have been configured to be written to the named directory under the EDB Postgres Advanced Server data directory.

If the log_directory parameter is set to an absolute path, database logs have been configured to be written to that location.

Next, determine ownership of the EDB audit directory folder. This can be done using Windows Explorer or via a Windows command prompt.

Using Windows Explorer:
Browse to the directory where the EDB audit directory folder is located.
Select and right-click on the folder, select "Properties", select the "Security" tab, and select the "Advanced" button.
Note the Value of the Owner field.

Using the Windows command prompt, enter the following command, replacing <EDB Audit directory> with the correct path for the EDB audit directory:

dir "<EDB Audit directory>" /Q /S

Note: The above command will list all of the files and folders under the audit directory. To make the output of this command easier to review, it may be redirected to a text file.

Review the system security documentation. If the owner listed for the folder and any of the files and subfolders in the EDB audit directory and its content is not the service account responsible for running the Advanced Server database service this is a finding.

Next, check the permissions assigned to the EDB audit directory folder and its content. Again, this can be done using Windows Explorer or via a Windows command prompt.

Using Windows Explorer:
Browse to the directory where the EDB audit directory folder is located.
Select and right-click on the folder, select "Properties", and select the "Security" tab.
Review the users and groups and permissions assigned to them for the folder.

Using a Windows command prompt, the following command may be used to list file permissions:

icacls "<EDB Audit directory>"
icacls "<EDB Audit directory>\*"
Review the users and groups and permissions assigned to them for the file(s).

Note: The above commands will list the permissions for all files and folders under the data directory. To make the output of this command easier to review, it may be redirected to a text file.

Review the system security documentation.
If read or greater permissions are granted to Everyone or to the Users group, this is a finding.
If any account other than the database service account, Administrators, or other documented users are listed as having Read permission, this is a finding.
If any account other than the database service account or other documented users are listed as having the Full Control permission, this is a finding.
If any permissions are listed for any account other than the database service account that are not identified in the system documentation as being approved for the permission, this is a finding.

# Verify custom database code and application does not display detailed error messages
Check custom database code and application code to determine if detailed error messages are ever displayed to unauthorized individuals.

If detailed error messages are displayed to individuals not authorized to view them, this is a finding.

Check Content Reference

M

Target Key

4107

Comments