Select any two versions of this STIG to compare the individual requirements
Select any old version/release of this STIG to view the previous requirements
Determine whether the system documentation specifies limits on the number of concurrent DBMS sessions per account by type of user. If it does not, assume a limit of 10 for database administrators and 2 for all other users. Execute the following SQL as enterprisedb: SELECT rolname, rolconnlimit FROM pg_roles; If rolconnlimit is -1 or larger than the system documentation limits for any rolname, this is a finding.
Execute the following SQL as enterprisedb: SELECT rolname, rolconnlimit FROM pg_roles; For any roles where rolconnlimit is -1 or larger than the system documentation limits, execute this SQL as enterprisedb: ALTER USER <role> WITH CONNECTION LIMIT <desired connection limit>;
Verify that the Postgres host-based authentication file (i.e., pg_hba.conf) has been configured so that database users are authenticated using credentials supplied by the organization-level authentication/access system. If it has been configured correctly, this is not a finding. Actions to verify: Verify none of the uncommented entries in the pg_hba.conf include: "trust", "sha-256-scram", "md5", "ident", "peer”, or "password" as allowable access methods. Verify options are set to the correct values for the specific environment. Note: The default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW hba_file" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). To verify the pg_hba.conf file is not using the access methods listed above, open the pg_hba.conf file in a text editor and inspect the contents of the file, looking for uncommented lines with these methods. Optionally, the following command can be run from a Windows command prompt to identify any uncommented lines in the pg_hba.conf file that may be using these methods: type <postgresql pg_hba.conf directory>\pg_hba.conf | findstr /N "scram-sha-256 md5 trust password peer ident" | find /V /N "#" Note: For the command above, if the path to the pg_hba.conf file contains spaces in it, the path to the file (including the file name) must be placed in double quotes. If any uncommented lines are identified, verify that the users are documented as being authorized to use one of these access methods. If the users are not authorized to use these access methods, this is a finding.
Identify any user using "trust", "sha-256-scram", md5", "ident", "peer" or "password" as allowable access methods. To identify users in the pg_hba.conf file using the methods listed above, open the pg_hba.conf file in a text editor, and inspect the contents of the file, looking for uncommented lines with these methods. Optionally, the following command can be run from a Windows command prompt to identify any uncommented lines in the pg_hba.conf file that may be using these methods: type <postgresql pg_hba.conf directory>\pg_hba.conf | findstr /N "scram-sha-256 md5 trust password peer ident" | find /V /N "#" Note: If the path to the pg_hba.conf file contains spaces in it, the path to the file (including the file name) should be placed in double quotes. Document any rows that have "trust", "sha-256-scram", "md5", "ident", "peer”, or "password" specified for the "METHOD" column and obtain appropriate approval for each user specified in the "USER" column (i.e., all DBMS managed accounts). For any users not documented and approved as DBMS managed accounts, change the "METHOD" column to one of the externally managed (not "trust", "sha-256-scram", "md5", "ident", "peer" or "password") options defined here: https://www.postgresql.org/docs/current/static/auth-methods.html
Review the system security plan or equivalent documentation to determine the allowed permissions on database objects for each database role or user as well as the database authentication methods that are allowed for each role or user. If this documentation is missing, this is a finding. Review the permissions actually in place for the EDB postgres cluster (i.e., instance). First check the privileges of all users and roles in the database by running the following command from the Windows command prompt: psql -d <database name> -U <database superuser name> -c "\du" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If any users or roles have privileges that exceed those that are documented, this is a finding. Next check the privileges that have been granted on the tables, views, and sequences in the database by running the following command from the Windows command prompt for each database in the EDB postgres instance: psql -d <database name> -U <database superuser name> -c "\dp" If the privileges assigned to these objects for any users or roles exceeds those that have been documented, this is a finding. Next as a user that has permission to view the contents of the pg_hba.conf file, review the authentication settings that are configured in that file. Note that the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running EDB postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW hba_file" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If any entries do not match the documented authentication requirements, this is a finding.
Use GRANT, REVOKE, ALTER statements to add and remove permissions on database objects, bringing them into line with the documented requirements. To change authentication requirements for the database, as a user with permissions to edit the pg_hba.conf, edit the entries in the file to comply with the documented organizational authentication requirements. See the official PostgreSQL documentation for the complete list of options for authentication: http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html
If there are no shared accounts available to more than one user, this is not a finding. If a shared account is used by an application to interact with the database, review the System Security Plan, the tables in the database, and the application source code/documentation to determine whether the application captures the individual user's identity and stores that identity in the audit log or along with all data inserted and updated (also with all records of reads and/or deletions, if these are required to be logged). The EDB audit feature provides the ability to include application user information with the database audit log using the edb_audit_tag session parameter. If all database shared accounts are accessed via an application that uses the edb_audit_tag parameter to identify individual applications users, this is not a finding. If there are gaps in the application's ability to capture an individual user's identity, and the gaps and the risk are not defined in the system documentation and accepted by the AO, this is a finding. If users are sharing a group account to log on to EDB Postgres tools or third-party products that access the database, this is a finding. To ensure EDB auditing is enabled, execute the following SQL as enterprisedb: SHOW edb_audit; If the result is not "csv" or "xml", this is a finding.
Use accounts assigned to individual users where feasible. Configure the DBMS to provide individual accountability at the DBMS level, and in audit logs, for actions performed under a shared database account. Modify any applications that use a shared database account to capture individual application user identities to the audit log using the edb_audit_tag or to the data tables. Create and enforce the use of individual user IDs for logging on to EDB Postgres tools and third-party products. If EDB auditing is not already enabled, enable it. Execute the following SQL as enterprisedb: ALTER SYSTEM SET edb_audit = csv; SELECT pg_reload_conf(); or ALTER SYSTEM SET edb_audit = xml; SELECT pg_reload_conf();
Verify, using vendor and system documentation if necessary, that the DBMS is configured to use EDB's auditing features and configured to satisfy this requirement. Execute the following SQL as the enterprisedb database user or another database superuser to check if EDB auditing is enabled: SHOW edb_audit; If the result is not "csv" or "xml", this is a finding. If organization-defined auditable events are not being audited, this is a finding.
Configure the DBMS's auditing to audit organization-defined auditable events. Execute the following SQL as enterprisedb to ensure that EDB Auditing is enabled: ALTER SYSTEM SET edb_audit = csv; SELECT pg_reload_conf(); or ALTER SYSTEM SET edb_audit = xml; SELECT pg_reload_conf(); Configure EDB audit settings to audit organization-defined auditable events in accordance with the information documented in the EDB Postgres Advanced Server Guide.
Check DBMS settings and documentation to determine whether designated personnel can select which auditable events are being audited. If designated personnel are not able to configure auditable events, this is a finding. If EDB Audit is being used, the EDB Audit settings may only be configured by Operating System users authorized to edit the cluster's postgresql.conf file or by database superusers. As such, the permissions associated with the postgresql.conf file must be checked as well as the database roles assigned to database users. In addition, database parameters, including the EDB Audit settings, may be specified via server startup command options. Users assigned "Modify" permission or greater on the postgresql data directory and its contents will be able to start the postgres database cluster. Therefore, only authorized users should be assigned these permissions. 1) Check Postgresql Data Directory Ownership and Permissions: First, determine ownership of the postgresql data directory folder. This can be done using Windows Explorer or via a Windows command prompt. Note: The default location for the EDB postgresql data directory is found in the directory where EDB Postgres Advanced Server is installed. The location of the data directory for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW data_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). Using Windows Explorer: Browse to the directory where the postgresql data 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: dir "<postgresql data directory>" /Q /S Note: The above command will list all of the 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 the owner listed for the folder and any of the files and subfolders in the data directory is not authorized to own the folder and its content, this is a finding. Next, check the permissions assigned to the postgresql data 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 postgresql data 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 "<postgresql data directory>" icacls "<postgresql data 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 permissions are granted to Everyone or to the Users group, this is a finding. If any account other than the database service account, software owner accounts, Administrators, DBAs, System group, or other documented users authorized to start a postgresql database cluster are listed, this is a finding. 2) Check Postgresql Configuration File Ownership and Permissions: First, determine ownership of the postresql.conf file(s). This can be done using Windows Explorer or via a Windows command prompt. Note that the default location for the postgresql.conf file is in the postgresql data directory. The location of the postgresql.conf file for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW config_file" Using Windows Explorer: Browse to the directory where the postgresql.conf file is located. Select and right-click on the postgresql.conf file, select "Properties", and select the "Details" tab. Note the Value of the Owner field. Using the Windows command prompt, enter the following command: dir "<directory where postgresql.conf is located>\postgresql*.conf" /Q Review the system security documentation. If the owner listed for the file(s) is not authorized to own the file(s) this is a finding. Next, check the permissions assigned to the postgresql configuration files. This can be done using Windows Explorer or via a Windows command prompt. Using Windows Explorer: Browse to the directory where the postgresql.conf file is located. Select and right-click on the postgresql.conf file, select "Properties", and select the "Security" tab. Review the users and groups and permissions assigned to them for the file. Using a Windows command prompt, the following command may be used to list file permissions: icacls "<directory where postgresql.conf is located>\postgresql*.conf" Review the users and groups and permissions assigned to them for the file(s). Review the system security documentation. If permissions are granted to Everyone or to the Users group, this is a finding. If any account other than the database service account, software owner accounts, Administrators, DBAs, System group, or other documented users authorized to make changes to the configuration parameters of this database are listed, this is a finding. Note: Since the postgresql.conf file may utilize include and include_dir statements to include additional parameter organizational specified configuration files, review the contents of the postgresql.conf file to determine if any uncommented include or include_dir statements are specified in the file. If these statements are found, the file ownership and permissions assigned to the files specified by these statements should also be checked. If any unauthorized users are owners of the files or have permission to edit the files this is a finding. 3) Check Database Users Assigned Superuser Privileges: Use psql to connect to the db as enterprisedb and run this command: \du If any unauthorized users/roles are listed as a superuser, this is a finding.
If a non-EDB provided database auditing solution or a custom auditing solution is being used, configure the DBMS's settings according to the documentation provided for those solutions to allow designated personnel to select which auditable events are audited. If EDB Auditing is being used, perform the following actions as necessary to address any findings: 1) Postgresql Data Directory Ownership and Permissions: If the postgresql data directory and its contents are owned by unauthorized users, change ownership to an authorized user. Restrict access on the postgresql data directory to the database service account, software owner accounts, Administrators, DBAs, System group, or other documented users authorized to start a postgresql database cluster. 2) Postgresql Configuration File Ownership and Permissions: If the postgresql configuration file(s) is owned by an unauthorized user, change ownership to an authorized user. Restrict write access on Postgres configuration file(s) the database service account, software owner accounts, Administrators, DBAs, System group, or other documented users authorized to edit the file(s). 3) Database Users Assigned Superuser Privileges: Remove superuser rights from unauthorized database users via the ALTER ROLE or ALTER USER SQL command. The syntax is: ALTER ROLE <role> NOSUPERUSER or ALTER USER <user> NOSUPERUSER Example: ALTER ROLE testuser NOSUPERUSER; OR ALTER USER testuser NOSUPERUSER; See PostgreSQL and/or EDB Postgres Advanced Server documentation for details.
Execute the following SQL as enterprisedb: SHOW edb_audit_statement; If the result is not "all" or if the current setting for this requirement has not been noted and approved by the organization in the system documentation, this is a finding.
Execute the following SQL as enterprisedb: ALTER SYSTEM SET edb_audit_statement = 'all'; SELECT pg_reload_conf(); or Update the system documentation to note the organizationally approved setting and corresponding justification of the setting for this requirement.
Execute the following SQL as enterprisedb to ensure auditing is enabled: SHOW edb_audit; If the result is not "csv" or "xml", this is a finding. Execute the following SQL as enterprisedb to check which events are configured to be audited: SHOW edb_audit_statement; If the result is not "all" or if the current setting for this requirement has not been noted and approved by the organization in the system documentation, this is a finding.
If EDB Auditing is not enabled, execute the following SQL as enterprisedb: ALTER SYSTEM SET edb_audit = csv; SELECT pg_reload_conf(); or ALTER SYSTEM SET edb_audit = xml; SELECT pg_reload_conf(); If the edb_audit_statement parameter values is not set to "all" or if the current setting for this requirement has not been noted and approved by the organization in the system documentation, execute the following SQL as enterprisedb: ALTER SYSTEM SET edb_audit_statement = 'all'; SELECT pg_reload_conf(); or Update the system documentation to note the organizationally approved setting and corresponding justification of the setting for this requirement.
Review the system documentation to identify what additional information the organization has determined necessary. Check application and database design, and existing audit records to verify that all organization-defined additional, more detailed information is in the audit records for audit events identified by type, location, or subject. If any additional information is defined and is not included in the audit records, this is a finding.
Execute the following SQL to set additional detailed information for the audit records in the session: set edb_audit_tag = '<information>'; Replace <information> with a character string holding the additional data that must be captured. To set this in a trigger, an example is included below. Keep in mind that the edb_audit_tag is set for the life of the session, not just the life of the insert command: CREATE OR REPLACE FUNCTION add_audit_info() RETURNS trigger AS $BODY $BEGIN SET edb_audit_tag = '<information>'; RETURN NEW; END; $BODY $LANGUAGE plpgsql; CREATE TRIGGER add_audit_info_trigger BEFORE INSERT ON <table> FOR EACH ROW EXECUTE PROCEDURE add_audit_info();
If Postgres Enterprise Manager (PEM) is installed and configured to shut down the database when the audit log is full, this is not a finding. Otherwise, review the procedures, manual and/or automated, for monitoring the space used by audit trail(s) and for off-loading audit records to a centralized log management system. If the procedures do not exist, this is a finding. If the procedures exist, request evidence that they are followed. If the evidence indicates that the procedures are not followed, this is a finding. If the procedures exist, inquire if the system has ever run out of audit trail space in the last two years or since the last system upgrade, whichever is more recent. If it has run out of space in this period, and the procedures have not been updated to compensate, this is a finding.
Modify DBMS, OS, or third-party logging application settings to alert appropriate personnel when a specific percentage of log storage capacity is reached. If EDB Postgres Enterprise Manager (PEM) is in use, it may be configured to issue an alert, send an email to designated personnel, and shut down the EDB Postgres Advanced Server instance when the audit log mount point is at 99 percent full. Refer to the Supplemental Procedures document, supplied with this STIG, for guidance on configuring PEM alerts.
If the system documentation indicates audit trail completeness takes precedence over availability this is not applicable (NA). If an externally managed and monitored partition or logical volume that can be grown dynamically is being used for logging, this is not a finding. If EDB Postgres Advanced Server (EPAS) is auditing to a directory that is not being actively checked for availability of disk space, and if a tool, utility, script, or other mechanism is not being used to ensure sufficient disk space is available for the creation of new audit logs, this is a finding. If a tool, utility, script, or other mechanism is being used to rotate audit logs and oldest logs are not being removed to ensure sufficient space for newest logs or oldest logs are not being replaced by newest logs, this is a finding.
Establish a process with accompanying tools for monitoring available disk space and ensuring that sufficient disk space is maintained in order to continue generating audit logs, overwriting the oldest existing records if necessary. If the organization does not employ an existing log management utility, the following example identifies one approach that may be followed to rotate EDB audit log files on Windows. Determine the maximum size of the audit log directory. For this example fix, assume the audit log directory must have a maximum size of 100MB. Divide the maximum size of the directory by 10 to determine the size of the log files for rotation. For this example, the audit log file size will be set to 10Mb. Perform the following steps to ensure that the audit log directory is never more than 90% full and the oldest logs are removed to make room for new logs: 1) Execute the following SQL statements to review current auditing related settings and to configure EPAS to generate a new audit log file when the current log file has reached the log file size determined above (10 Mb): -- List current EDB Audit settings SELECT name, setting FROM pg_settings WHERE category LIKE 'EnterpriseDB Audit%' ORDER BY name; /* * Note: If edb_audit is not set to 'csv' or 'xml', auditing is not enabled. * To enable EDB auditing, issue one of the following SQL statements: * * ALTER SYSTEM SET edb_audit TO 'xml'; * * or * * ALTER SYSTEM SET edb_audit TO 'csv'; * */ -- Set edb_audit_filename parameter to ensure unique name for each log file that is generated ALTER SYSTEM SET edb_audit_filename TO 'audit-%Y%m%d_%H%M%S'; -- Set edb_audit_rotation_size to desired maximum file size (e.g., 10 Mb) ALTER SYSTEM SET edb_audit_rotation_size TO 10; -- Reload configuration settings to put the updated settings into effect SELECT pg_reload_conf(); -- List current EDB Audit settings to confirm updates are in place SELECT name, setting FROM pg_settings WHERE category LIKE 'EnterpriseDB Audit%' ORDER BY name; 2) Using a text editor, create a Windows batch file with the following content: @ECHO OFF SETLOCAL SET "targetdir=<Path to edb_audit Directory>" SET /a retain=8 FOR /f "skip=%retain%delims=" %%a IN ( 'dir /b /a-d /o-d "%targetdir%\audit-????????_??????.xml" ' ) DO DEL "%targetdir%\%%a" GOTO :EOF 3) Replace "<Path to edb_audit Directory>" for "targetdir" variable in the batch file (3rd line) to correspond to the EDB audit log directory configured for your EPAS instance. Note that the EDB audit log directory is configured by the edb_audit_directory parameter. By default, the edb_audit_directory is set to "edb_audit", which results in an "edb_audit" directory being created under the EPAS cluster's data directory for audit logs if auditing is enabled. The location of the data directory for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW data_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If default setting of "edb_audit" is used for the edb_audit_directory parameter, the path to the EDB audit directory would be <EDB Postgres data directory>\edb_audit. 4) Update the "retain" variable in the batch file (4th line) to correspond to the desired minimum number of audit log files that should be retained in the directory. It should be set so that sufficient headroom is maintained in the directory for log files generated between runs of the batch file. 5) Save the batch file to a location that would be accessible to the Windows Task Scheduler. For this example, save the file to "C:\Windows\System32\Manage_EDB_Audit_Logs.bat". 6) Using the Windows Task Scheduler, create a scheduled task to execute the Manage_EDB_Audit_Logs.bat file on a periodic basis. At a minimum, it is recommended that the task be scheduled to perform this action at least on an hourly basis. Depending on the various audit log settings and database activity, it may be necessary to configure the task to be run more frequently.
The location of the EDB audit directory is specified via the edb_audit_directory parameter. By default, this parameter is set to "edb_audit", which results in a directory name "edb_audit" being created under the postgresql data directory. The location of the EDB Audit directory for a running EDB Postgres Advanced Server instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW edb_audit_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). Note that the default location for the EDB postgresql data directory is found in the directory where EDB Postgres Advanced Server is installed. The location of the data directory for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW data_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If the default path is used for the postgresql data directory and the default setting of "edb_audit" is used for the edb_audit_directory parameter, the path to the EDB audit directory would be <EDB Postgres data directory>\edb_audit. Depending on the version of EPAS that is installed, the options that were selected during installation, and the edb_audit_directory parameter setting, the path to the data directory and the EDB audit directory may be different. First, 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 not identified in the system documentation as being approved for the permission, this is a finding.
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.
The location of the EDB audit directory is specified via the edb_audit_directory parameter. By default, this parameter is set to "edb_audit", which results in a directory name "edb_audit" being created under the postgresql data directory. The location of the EDB Audit directory for a running EDB Postgres Advanced Server instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW edb_audit_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). Note that the default location for the EDB postgresql data directory is found in the directory where EDB Postgres Advanced Server is installed. The location of the data directory for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW data_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If the default path is used for the postgresql data directory and the default setting of "edb_audit" is used for the edb_audit_directory parameter, the path to the EDB audit directory would be <EDB Postgres data directory>\edb_audit. Depending on the version of EPAS that is installed, the options that were selected during installation, and the edb_audit_directory parameter setting, the path to the data directory and the EDB audit directory may be different. First, 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. 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.
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 the system documentation is updated to note the organizationally approved permission setting and corresponding justification of the permission settings for this requirement.
The location of the EDB audit directory is specified via the edb_audit_directory parameter. By default, this parameter is set to "edb_audit", which results in a directory name "edb_audit" being created under the postgresql data directory. The location of the EDB Audit directory for a running EDB Postgres Advanced Server instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW edb_audit_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). Note that the default location for the EDB postgresql data directory is found in the directory where EDB Postgres Advanced Server is installed. The location of the data directory for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW data_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If the default path is used for the postgresql data directory and the default setting of "edb_audit" is used for the edb_audit_directory parameter, the path to the EDB audit directory would be <EDB Postgres data directory>\edb_audit. Depending on the version of EPAS that is installed, the options that were selected during installation, and the edb_audit_directory parameter setting, the path to the data directory and the EDB audit directory may be different. First, 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.
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.
The location of the EDB audit directory is specified via the edb_audit_directory parameter. By default, this parameter is set to "edb_audit", which results in a directory name "edb_audit" being created under the postgresql data directory. The location of the EDB Audit directory for a running EDB Postgres Advanced Server instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW edb_audit_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). Note that the default location for the EDB postgresql data directory is found in the directory where EDB Postgres Advanced Server is installed. The location of the data directory for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW data_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If the default path is used for the postgresql data directory and the default setting of "edb_audit" is used for the edb_audit_directory parameter, the path to the EDB audit directory would be <EDB Postgres data directory>\edb_audit. Depending on the version of EPAS that is installed, the options that were selected during installation, and the edb_audit_directory parameter setting, the path to the data directory and the EDB audit directory may be different. First, 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.
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.
The location of the EDB audit directory is specified via the edb_audit_directory parameter. By default, this parameter is set to "edb_audit", which results in a directory name "edb_audit" being created under the postgresql data directory. The location of the EDB Audit directory for a running EDB Postgres Advanced Server instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW edb_audit_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). Note that the default location for the EDB postgresql data directory is found in the directory where EDB Postgres Advanced Server is installed. The location of the data directory for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW data_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If the default path is used for the postgresql data directory and the default setting of "edb_audit" is used for the edb_audit_directory parameter, the path to the EDB audit directory would be <EDB Postgres data directory>\edb_audit. Depending on the version of EPAS that is installed, the options that were selected during installation, and the edb_audit_directory parameter setting, the path to the data directory and the EDB audit directory may be different. First, 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. 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.
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.
The location of the EDB audit directory is specified via the edb_audit_directory parameter. By default, this parameter is set to "edb_audit", which results in a directory name "edb_audit" being created under the postgresql data directory. The location of the EDB Audit directory for a running EDB Postgres Advanced Server instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW edb_audit_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). Note that the default location for the EDB postgresql data directory is found in the directory where EDB Postgres Advanced Server is installed. The location of the data directory for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW data_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If the default path is used for the postgresql data directory and the default setting of "edb_audit" is used for the edb_audit_directory parameter, the path to the EDB audit directory would be <EDB Postgres data directory>\edb_audit. Depending on the version of EPAS that is installed, the options that were selected during installation, and the edb_audit_directory parameter setting, the path to the data directory and the EDB audit directory may be different. First, 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.
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.
Review monitoring procedures and implementation evidence to verify monitoring of changes to database software libraries, related applications, and configuration files is done. Verify the list of files and directories being monitored is complete. If monitoring does not occur or is not complete, this is a finding.
Implement procedures to monitor for unauthorized changes to DBMS software libraries, related software application libraries, and configuration files. If a third-party automated tool is not employed, an automated job that reports file information on the directories and files of interest and compares them to the baseline report for the same will meet the requirement. Use file hashes or checksums for comparisons, as file dates may be manipulated by malicious users.
Review monitoring procedures and implementation evidence to verify monitoring of changes to database software libraries, related applications, and configuration files is being performed. If the database schema (includes functions, procedures, schemas, extensions, etc.) is not being regularly checked for changes, this is a finding.
Regularly run a check similar to this: move <postgresql data directory>\latest.schema <postgresql data directory>\previous.schema C:\Program Files\edb\as<version>\bin\pg_dump -s -d edb -f <postgresql data directory>\latest.schema FC <postgresql data directory>\previous.schema <postgresql data directory>\latest.schema If any differences are shown, ensure the differences are expected.
Review procedures for controlling, granting access to, and tracking use of the DBMS software installation account. If access or use of this account is not restricted to the minimum number of personnel required or if unauthorized access to the account has been granted, this is a finding.
Develop, document, and implement procedures to restrict and track use of the DBMS software installation account.
Review the DBMS software library directory and note other root directories located on the same disk directory or any subdirectories. If any non-DBMS software directories exist on the disk directory, examine or investigate their use. If any of the directories are used by other applications, including third-party applications that use the DBMS, this is a finding. Only applications that are required for the functioning and administration, not use, of the DBMS should be located in the same disk directory as the DBMS software libraries. If other applications are located in the same directory as the DBMS, this is a finding.
Install all applications on directories separate from the DBMS software library directory. Relocate any directories or reinstall other application software that currently shares the DBMS software library directory.
Review system documentation to identify accounts authorized to own database objects. Review accounts that own objects in the database(s) by running this SQL command: select * from sys.all_objects; If any database objects are found to be owned by users not authorized to own database objects, this is a finding.
Assign ownership of authorized objects to authorized object owner accounts by running this SQL command for each object to be changed: ALTER <type> <object name> OWNER TO <new owner>; For example: ALTER TABLE my_table OWNER TO APP_USER;
Use psql to connect to the db as enterprisedb and run this command: \dp *.* If any unauthorized roles have unauthorized accesses, this is a finding. Definitions of the access privileges are defined here: http://www.postgresql.org/docs/current/static/sql-grant.html
Revoke unauthorized privileges. The syntax is: REVOKE <privilege> ON <object> FROM <role>. Example: REVOKE INSERT ON a FROM PUBLIC; See PostgreSQL documentation for details.
If EDB Postgres Advanced Server (EPAS) is hosted on a server that does not support production systems, and is designated for the deployment of samples and demonstrations, this is not applicable (NA). Review documentation and websites from EnterpriseDB and any other relevant vendors for vendor-provided demonstration or sample databases, database applications, schemas, objects, and files. Review the EPAS DBMS to determine if any of the demonstration and sample databases, schemas, database applications, or objects are installed in the database or are included with the DBMS application. If any are present in the database or are included with the DBMS application, this is a finding. Check for the existence of EDB Postgres sample databases: postgres and edb. To check Execute the following SQL as enterprisedb: SELECT datname FROM pg_database WHERE datistemplate = false; If any databases are listed here that are not documented as being used by the application, this is a finding. EDB Postgres provides the ability to install a set of sample tables and related objects in a postgres database via the installer or via the edb-sample.sql script installed with EDB Postgres Advanced Server (located in the <EDB Postgres Installation Directory>\installer\server directory by default). To check whether these sample tables have been installed, execute the following SQL as enterprisedb: SELECT * FROM dba_tables WHERE table_name IN ('EMP', 'DEPT', 'JOBHIST'); If any rows are returned that do not correspond to application tables, this is a finding. Postgres provides the ability to install a set of tables for benchmark purposes using the pgbench utility. To check whether these pgbench tables have been installed, execute the following SQL as enterprisedb: SELECT * FROM dba_tables WHERE table_name LIKE 'PGBENCH%'; If any rows are returned that do not correspond to application tables, this is a finding.
Remove any unused sample databases or sample objects within a database from the DBMS. To remove a database, execute the follow SQL: DROP DATABASE <database>; To remove objects within a database, use the appropriate DROP statement (DROP TABLE, DROP VIEW, etc.).
Open Control Program >> Programs >> Programs and Features. Look specifically for publishers of EnterpriseDB, pgAdmin, or PostgreSQL. If any programs are installed which are not documented as needed by the government program, this is a finding.
Open Control Program >> Programs >> Programs and Features. Select any programs that should not be installed, click "uninstall", and then follow the prompts to uninstall the software.
Open Control Program >> Programs >> Programs and Features. Look specifically for publishers of EnterpriseDB, pgAdmin, or PostgreSQL. If any programs are installed which are not documented as needed by the government program, this is a finding.
Open Control Program >> Programs >> Programs and Features. Select any programs that should not be installed, click "uninstall", and then follow the prompts to uninstall the software.
Check for EDB Postgres Advanced Server related programs that have been installed but not documented as approved. Open Control Program >> Programs >> Programs and Features. Look specifically for publishers of EnterpriseDB, pgAdmin, or PostgreSQL. If any programs are installed which are not documented as needed by the organization for the system, this is a finding. The Postgres COPY command provides options for reading or writing files or running a program that the server has privileges to access. These options are only allowed for users who have been granted superuser privilege or have been granted the pg_read_server_files, pg_write_server_files, or pg_execute_server_program roles. The SUPERUSER privilege and the roles that provide access to files on the underlying server should only be granted to approved users. To check for user and group roles that have been granted the SUPERUSER privilege, execute the following SQL statement in psql or another Postgres SQL client as enterprisedb: WITH RECURSIVE roles( granted_role_id, granted_role_name, role_id, role_name, can_login, how_superuser, root_role_name ) AS ( SELECT NULL::oid granted_role_id , NULL::name granted_role_name , r1.oid role_id , r1.rolname role_name , r1.rolcanlogin can_login , 'Assigned Superuser Privilege' how_superuser , r1.rolname root_role_name FROM pg_authid r1 WHERE r1.rolsuper = 't' UNION SELECT m.roleid , r3.rolname , m.member , r2.rolname , r2.rolcanlogin , 'Granted Role with Superuser Privilege' , r1.root_role_name FROM pg_auth_members m JOIN pg_authid r2 ON r2.oid = m.member JOIN pg_authid r3 ON r3.oid = m.roleid JOIN roles r1 ON m.roleid = r1.role_id ) SELECT DISTINCT r.role_name, r.can_login, hs.how_superuser, gr.granted_roles, rr.root_superuser_roles FROM roles r JOIN ( SELECT role_name, string_agg(how_superuser, ', ') how_superuser FROM ( SELECT DISTINCT role_name, how_superuser FROM roles ORDER BY 2 ) GROUP BY role_name ) hs ON r.role_name = hs.role_name JOIN ( SELECT role_name, string_agg(granted_role_name, ', ') granted_roles FROM ( SELECT DISTINCT role_name, granted_role_name FROM roles ORDER BY 2 ) GROUP BY role_name ) gr ON r.role_name = gr.role_name JOIN ( SELECT role_name, string_agg(root_role_name, ', ') root_superuser_roles FROM ( SELECT DISTINCT role_name, root_role_name FROM roles ORDER BY 2 ) GROUP BY role_name ) rr ON r.role_name = rr.role_name ORDER BY 3,1; The above query will list all user and group roles that have either been granted the SUPERUSER privilege explicitly or via one of the roles in the hierarchy of roles they have been granted. If a user or group roles has the SUPERUSER privilege either directly or via one of the roles in the hierarchy of roles it has been granted, and the role is not documented as being approved to have this privilege, this is a finding. To check for user and group roles that have been granted any of the pg_read_server_files, pg_write_server_files, or pg_execute_server_program roles, execute the following SQL statement in psql or another Postgres SQL client as enterprisedb: WITH RECURSIVE roles( granted_role_id, granted_role_name, role_id, role_name, can_login, root_role_name ) AS ( SELECT NULL::oid granted_role_id , NULL::name granted_role_name , r1.oid role_id , r1.rolname role_name , r1.rolcanlogin can_login , r1.rolname root_role_name FROM pg_authid r1 WHERE r1.rolname IN ( 'pg_read_server_files', 'pg_write_server_files', 'pg_execute_server_program' ) UNION SELECT m.roleid , r3.rolname , m.member , r2.rolname , r2.rolcanlogin , r1.root_role_name FROM pg_auth_members m JOIN pg_authid r2 ON r2.oid = m.member JOIN pg_authid r3 ON r3.oid = m.roleid JOIN roles r1 ON m.roleid = r1.role_id ) SELECT DISTINCT r.role_name, r.can_login, gr.granted_roles, rr.server_os_access_roles FROM roles r JOIN ( SELECT role_name, string_agg(granted_role_name, ', ') granted_roles FROM ( SELECT DISTINCT role_name, granted_role_name FROM roles ORDER BY 2 ) GROUP BY role_name ) gr ON r.role_name = gr.role_name JOIN ( SELECT role_name, string_agg(root_role_name, ', ') server_os_access_roles FROM ( SELECT DISTINCT role_name, root_role_name FROM roles ORDER BY 2 ) GROUP BY role_name ) rr ON r.role_name = rr.role_name WHERE gr.granted_roles IS NOT NULL ORDER BY 1; The above query will list all user and group roles that have been granted one of these roles either explicitly or via one of the roles in the hierarchy of roles they have been granted. If a user or group roles has been granted one of these roles either explicitly or via one of the roles in the hierarchy of roles they have been granted, and the role is not documented as being approved to have this role, this is a finding. It is possible for a Postgres database extension to contain code that could access external executables via SQL. To list all installed extensions, execute the following SQL statement in psql or another Postgres SQL client as enterprisedb: SELECT * FROM pg_available_extensions WHERE installed_version IS NOT NULL ORDER BY 1; If any extensions are installed that are not documented as being approved, this is a finding. It is possible to create database functions that are written in C or other procedural languages that reference code in externally loaded modules that may enable interaction with the OS. To list such functions, execute the following SQL statement in psql or another Postgres SQL client as enterprisedb: SELECT n.nspname "Schema", p.proname "Function", p.prosrc "Source", p.probin "Library", l.lanname "Language" FROM pg_proc p JOIN pg_namespace n ON p.pronamespace = n.oid JOIN pg_language l on p.prolang = l.oid WHERE n.nspname NOT IN ('pg_catalog', 'sys', 'information_schema') AND (l .lanpltrusted = 'f' AND l.lanname != 'internal' ) ORDER BY 4, 1, 2, 3; If any C-language or other procedural language function is listed that is not documented as being approved, this is a finding.
To uninstall programs that are not approved, open Control Program | Programs | Programs and Features. Select any programs that should not be installed, click the "uninstall" button, and follow the prompts to uninstall the software. To remove the SUPERUSER privilege from a role, execute the following SQL statement in psql or another Postgres SQL client as enterprisedb: ALTER ROLE <role name> WITH NOSUPERUSER; To remove a role that has been granted to another role, execute the following SQL statement in psql or another Postgres SQL client as enterprisedb: REVOKE ROLE <name of role to be removed> FROM <role name>; To remove an extension from a Postgres database, execute the following SQL statement in psql or another Postgres SQL client as enterprisedb: DROP EXTENSION <name of extension to be removed>; To remove a function from a Postgres database, execute the following SQL statement in psql or another Postgres SQL client as enterprisedb: DROP FUNCTION <name of function to be removed>; If the unapproved function is contained in an EDB-SPL database package, drop the package specification and body or replace the package specification and package body source with an updated version of the source that does not include the unapproved function. To drop a package, execute the following SQL statements in psql or another EDB Postgres Advanced Server SQL client as enterprisedb: DROP PACKAGE BODY <name of package to be dropped>; DROP PACKAGE <name of package to be dropped>; To update a package, execute the "CREATE OR REPLACE PACKAGE <package name>" and "CREATE OR REPLACE PACKAGE BODY <package name>" SQL statements in psql or another EDB Postgres Advanced Server SQL client. See the EnterpriseDB "Database Compatibility for Oracle Developers Reference Guide" for more information about the commands for creating, replacing, and dropping database packages.
Review documentation for approved list of ports, protocols, and addresses. To list the port that is being used, execute the following SQL as enterprisedb: SHOW port; If the port returned by the above command is not approved, this is a finding. To list the interface addresses that are being used, execute the following SQL as enterprisedb: SHOW listen_addresses; For the above statement, a return value of "*" indicates that the database cluster (i.e., instance) is configured to listen on all interfaces on the database host. If the addresses returned are not approved, this is a finding.
Execute the following SQL as enterprisedb: ALTER SYSTEM SET port = <port>; ALTER SYSTEM SET listen_addresses = <comma separated addresses>; Restart the database service. For EDB Postgres Advanced Server, the default service name is "edb-as-<EDB Version #>" with a default display name of "edb-as-<EDB Version #> - Advanced Server <EDB Version #>": To restart the database service, using the Windows Services Control Manager: 1. Open the Windows Services Control Manager. 2. Select the database service from the list of services, right-click it, and select "Restart". Alternatively, the database can be restarted via the Windows command line using either the NET or SC command as follows: NET STOP <service name> NET START <service name> or SC STOP <service name> SC START <service name> Note that if pgAgent is installed and running, the corresponding pgAgent service is dependent on the EDB Postgres database service and will first need to be stopped in order to restart the database service. After restarting the database service, the pgAgent service may be started again.
Verify that the pg_hba.conf is not using the "trust" authentication method. Note that the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW hba_file" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). To verify that the pg_hba.conf file is not using the methods listed above, open the pg_hba.conf file in a text editor and inspect the contents of the file. If any uncommented lines have "trust" specified for the "METHOD" column and the setting has not been documented with sufficient justification and approved, this is a finding. Optionally, the following command can be run from a Windows command prompt to identify any uncommented lines in the pg_hba.conf file that may be using these methods: type <postgresql data directory>\pg_hba.conf | findstr /N "trust" | find /V /N "#" Note: For the command above, if the path to the pg_hba.conf file contains spaces in it, the path to the file (including the file name) should be placed in double quotes. If any uncommented lines showing that the "trust" authentication method has been specified are reported via the above command and the setting has not been documented with sufficient justification and approved, this is a finding.
Open "<postgresql data directory>\pg_hba.conf" in an editor. Note that the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW hba_file" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If any rows have "trust" specified for the "METHOD" column that are not documented and approved, delete the rows or change them to other authentication methods. Permitted methods in preferred order are: peer (local only), cert, ldap, sspi, pam, sha-256-scram, md5
If DBMS authentication, using passwords, is not employed, this is not a finding. In a SQL window, run this command: select * from dba_profiles; If there are UNLIMITED or NULL values in the "limit" column, this is a finding. Review the password verification functions specified for the PASSWORD_VERIFY_FUNCTION settings for each profile. Determine whether the following rules are enforced by the code in those functions. If any are not, this is a finding. a. minimum of 15 characters, including at least one of each of the following character sets: - Upper-case - Lower-case - Numerics - Special characters (e.g., ~ ! @ # $ % ^ & * ( ) _ + = - ' [ ] / ? > <) b. Minimum number of characters changed from previous password: 50 percent of the minimum password length; that is, eight Review the DBMS settings relating to password lifetime. Determine whether the following rules are enforced. If any are not, this is a finding. a. Password lifetime limits for interactive accounts: Minimum 24 hours, maximum 60 days b. Password lifetime limits for non-interactive accounts: Minimum 24 hours, maximum 365 days c. Number of password changes before an old one may be reused: Minimum of five
After creating a password verification function, configure the default profile to use it and to the other required password related settings. To facilitate checking that a new password is sufficiently different from a previously used one, the dod_verify_password function uses the Levenshtein function, which is available as part of the PostgreSQL fuzzystrmatch extension. Before creating the password verification function, check whether the fuzzystrmatch extension is installed by executing the following SQL query as enterprisedb: SELECT extname FROM pg_extension; If "fuzzystrmatch" is not listed, execute the following SQL to install the extension as enterprisedb: CREATE EXTENSION fuzzystrmatch; With the fuzzystrmatch extension installed, execute the following SQL statements as enterprisedb: CREATE OR REPLACE FUNCTION sys.dod_verify_password(user_name varchar2, new_password varchar2, old_password varchar2) RETURN boolean IMMUTABLE IS pwd_length integer := NVL( length(new_password), 0 ); min_length integer := 15; min_lower integer := 1; min_upper integer := 1; min_numeric integer := 1; min_special integer := 1; min_diff integer := ceil(min_length::numeric / 2); cnt_lower integer := 0; cnt_upper integer := 0; cnt_numeric integer := 0; cnt_special integer := 0; cnt_diff integer := 0; i integer ; curr_char CHAR(1); BEGIN -- -- Check Length of new password -- IF ( pwd_length < min_length ) THEN raise_application_error(-20001, 'Password is too short. Password must be at least '||min_length||' characters long.'); END IF; -- -- Get count of each character type in new password. -- FOR i in 1..pwd_length LOOP curr_char := substr(new_password, i, 1); IF ( curr_char SIMILAR TO '[a-z]' ) THEN cnt_lower := cnt_lower + 1; ELSIF ( curr_char SIMILAR TO '[A-Z]' ) THEN cnt_upper := cnt_upper + 1; ELSIF ( curr_char SIMILAR TO '[0-9]' ) THEN cnt_numeric := cnt_numeric + 1; ELSE cnt_special := cnt_special + 1; END IF; END LOOP; -- -- Calculate Levenshtein difference between old and new password -- cnt_diff := levenshtein( old_password, new_password ); -- Check if new password has minimum number of lowercase characters IF cnt_lower < min_lower THEN raise_application_error(-20004, 'Password must contain at least '||min_lower||' lowercase character(s)'); END IF; -- Check if new password has minimum number of uppercase characters IF cnt_upper < min_upper THEN raise_application_error(-20003, 'Password must contain at least '||min_upper||' uppercase character(s)'); END IF; -- Check if new password has minimum number of numeric characters IF cnt_numeric < min_numeric THEN raise_application_error(-20005, 'Password must contain at least '||min_numeric||' numeric character(s)'); END IF; -- Check if new password has minimum number of special characters IF cnt_special < min_special THEN raise_application_error(-20006, 'Password must contain at least '||min_special||' special character(s)'); END IF; -- Check if new password differs from old password by minimum number of required characters IF cnt_diff < min_diff THEN raise_application_error(-20007, 'Password must differ from old password by at least '||min_diff||' character(s)'); END IF; RETURN true; END; ALTER FUNCTION sys.dod_verify_password(varchar2, varchar2, varchar2) OWNER TO enterprisedb; Next, execute the following statement (or a variant of this) to set the default profile for DoD standards: ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS 3 PASSWORD_LOCK_TIME 1 PASSWORD_LIFE_TIME 60 PASSWORD_GRACE_TIME 3 PASSWORD_REUSE_TIME 180 PASSWORD_REUSE_MAX 5 PASSWORD_VERIFY_FUNCTION dod_verify_password; Note that the above statement assumes that the password verification function is named "dod_verify_password". If the function was created with a different name, update the ALTER PROFILE statement above as appropriate.
Execute the following SQL as enterprisedb: SHOW password_encryption; If the value returned for the password_encryption parameter is not "scram-sha-256", this is a finding unless otherwise documented as approved for the system.
Execute the following SQL as enterprisedb: ALTER SYSTEM SET password_encryption = "scram-sha-256"; SELECT pg_reload_conf();
Verify that the pg_hba.conf is not using the "password" authentication method. Note that the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW hba_file" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). To verify that the pg_hba.conf file is not using the methods listed above, open the pg_hba.conf file in a text editor and inspect the contents of the file. If any uncommented lines have "password" specified for the "METHOD" column, this is a finding. Optionally, the following command can be run from a Windows command prompt to identify any uncommented lines in the pg_hba.conf file that may be using these methods: type <postgresql data directory>\pg_hba.conf | findstr /N "password" | find /V /N "#" Note: For the command above, if the path to the pg_hba.conf file contains spaces in it, the path to the file (including the file name) should be placed in double quotes. If any uncommented lines showing that the "password" authentication method has been specified are reported via the above command, this is a finding.
Open "<postgresql data directory>\pg_hba.conf" in an editor. Note that the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW hba_file" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). For any rows that have "password" specified for the "METHOD" column, change the value to "sha-256-scram" or "md5".
Verify that hostssl entries in pg_hba.conf have "clientcert=1" enabled. Note that the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW hba_file" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). Open the pg_hba.conf file in a text editor and inspect the contents of the file. If any uncommented lines have TYPE of "hostssl" but do not include "clientcert=1" in the OPTIONS column at the end of the line, this is a finding. Optionally, the following command can be run from a Windows command prompt to identify any uncommented lines in the pg_hba.conf file that may be using these methods: type <postgresql data directory>\pg_hba.conf | findstr /N "hostssl" | find /V /N "#" Note: For the command above, if the path to the pg_hba.conf file contains spaces in it, the path to the file (including the file name) should be placed in double quotes. If any uncommented lines are reported using the above command that show a TYPE of "hostssl" but do not include "clientcert=1" in the OPTIONS column at the end of the line, this is a finding.
Open the "<postgresql data directory>\pg_hba.conf" in an editor. Note that the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW hba_file" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). For any rows that have TYPE of "hostssl", append "clientcert=1" in the OPTIONS column at the end of the line.
Verify User ownership, Group ownership, and permissions on the "server.key" file: Right-click and select "Properties" on <postgresql data directory>\server.key If any users other than the database administrator user (enterprisedb by default) or other users documented in the program security guide have any permissions on this file, this is a finding.
Right-click and select "Properties" on <postgresql data directory>\server.key Give the database administrator (default "enterprisedb") full control of the file.
Determine whether any applications that access the database allow for entry of the account name and password or PIN. If any do, determine whether these applications obfuscate authentication data. If they do not, this is a finding.
Configure or modify applications to prohibit display of passwords in clear text.
For psql, which cannot be configured not to accept a plain-text password, and any other essential tool with the same limitation, verify that the system documentation explains the need for the tool, who uses it, and any relevant mitigations and that AO approval has been obtained. If not, this is a finding. Request evidence that all users of the tool are trained in the importance of using the "-W" option (and not using the plain-text password option), how to keep the password hidden, and that they adhere to this practice. If not, this is a finding.
For psql, which can accept a plain-text password, and any other essential tool with the same limitation: 1) Document the need for it, who uses it, and any relevant mitigations, and obtain AO approval. 2) Train all users of the tool in the importance of not using the plain-text password option and in how to keep the password hidden by using the "-W" option.
Check DBMS settings to determine whether a password file is being used. On Windows the default file name and location is: %APPDATA%\postgresql\pgpass.conf (where %APPDATA% refers to the Application Data subdirectory in the user's profile). Alternatively, a password file can be specified using the connection parameter passfile or the environment variable PGPASSFILE. If a password file exists, this is a finding. If a password file is not in use, this is not a finding.
Remove any password files present on the server and implement a more secure form of authentication. The DoD standard for authentication is DoD-approved PKI certificates.
If any uncommented lines in <postgresql data dir>\pg_hba.conf do not start with "hostssl", this is a finding. The "ssleay32_dll" and "libeay32.dll" files in <EDB Postgres Advanced Server Home>\bin should be FIPS 140-2 or 140-3 compliant DLLs from EnterpriseDB. These are included in EDB Postgres Advanced Server v11 update 6 (i.e., 11.6) and greater. If the installed EDB v11 is not update 11.6 or greater, this is a finding. If C:\usr\local\ssl\openssl.cnf does not exist with these contents, or if an System Environment variable called OPENSSL_CONF pointing to a file with these contents has not been created, this is a finding: HOME = . RANDFILE = $ENV::HOME/.rnd openssl_conf=openssl_conf_section [openssl_conf_section] alg_section=evp_settings [evp_settings] fips_mode=yes
Edit <postgresql data dir>\pg_hba.conf so that each uncommented line starts with "hostssl" If the EDB Postgres Advanced Server minor version is less than version 11.6, install the 11.6 update or later version or contact EnterpriseDB to obtain a copy of the FIPS 140 compliant versions of the "ssleay32.dll" and "libeay32.dll" files and replace the "ssleay32.dll" and "libeay32.dll" files in <EDB Postgres Advanced Server Home>\bin with FIPS 140 compliant DLLs from EnterpriseDB. If the EDB Postgres Advanced Server minor version is 11.6 or greater, the FIPS 140 compliant versions of these DLLs are installed by default and do not need to be replaced. Create C:\usr\local\ssl\openssl.cnf or another file referenced by a System Environment variable called OPENSSL_CONF with these contents: HOME = . RANDFILE = $ENV::HOME/.rnd openssl_conf=openssl_conf_section [openssl_conf_section] alg_section=evp_settings [evp_settings] fips_mode=yes Restart the Postgres server via the Services administration GUI.
Review documentation, EDB Postgres Advanced Server settings, and authentication system settings to determine if non-organizational users are individually identified and authenticated when logging onto the system. EDB Postgres Advanced Server uniquely identifies and authenticates Postgres users through the use of DBMS roles. To list the user and group roles in an EDB Postgres Advanced Server instance, execute the following command in psql as the enterprisedb user: \du If accounts are determined to be shared, determine if individuals are first individually authenticated. Where an application connects to EDB Postgres Advanced Server using a standard, shared account, ensure it also captures the individual user identification, and passes it to EDB Postgres Advanced Server. If the EDB session audit log tagging feature is being used to capture individual user identification and organizational affiliation, review the EDB audit log to verify that the information documented as being required is logged to the "audit_tag" field. If the required information is not logged, this is a finding. If the documentation indicates that this is a public-facing, read-only (from the point of view of public users) database that does not require individual authentication, this is not a finding. If non-organizational users are not uniquely identified and authenticated, this is a finding.
Ensure all logins are uniquely identifiable and authenticate all non-organizational users who log onto the system. This likely would be done via a combination of application, operating system, and EDB Postgres Advanced Server configuration settings. Verify server documentation to ensure accounts are documented and unique.
Check EDB Postgres Advanced Server permission settings to verify that administrative functionality is kept separate from user functionality. As a database superuser user (e.g., enterprisedb), list the user and group roles and their permissions in an EDB Postgres Advanced Server instance; execute the following command in psql: \du If any non-administrative role has the attribute "Superuser", "Create role", "Create DB" or "Bypass RLS", this is a finding. If administrator and general user functionality is not separated either physically or logically, this is a finding.
Configure EDB Postgres Advanced Server to separate database administration and general user functionality. Use the ALTER ROLE SQL command to remove "SUPERUSER", "CREATE Role", "Create DB", or "Bypass RLS" privileges from user and group roles that are not authorized for those roles. For example: ALTER ROLE <username> NOSUPERUSER NOCREATEDB NOCREATEROLE NOBYPASSRLS;
To check whether fsync() has been enabled for the EDB Postgres Advanced Server cluster, connect to the database as a database superuser using psql and execute the following psql command: SHOW fsync If the parameter is set to "off" and this setting has not been documented as approved with justification, this is a finding.
To set the fsync parameter to "on", connect to the database as a database superuser using psql and execute the following SQL commands: ALTER SYSTEM SET fsync = on; SELECT pg_reload_conf();
If the application owner and Authorizing Official have determined that encryption of data at rest is NOT required, this is not a finding. Right-click on <postgresql data directory>, select properties, then select the General tab and the Advanced button. If the "Encrypt contents to secure data" check box is not checked, this is a finding.
Complete these steps as the Windows user that serves as the user who is configure to run the EDB Postgres database service. If done as a different user, the Windows database service user will be unable to view this folder and therefore unable to start the database. By default, the service is configured to be run by the NetworkService account, which is a special Windows account that may not have the ability to encrypt the data directory. As a result, it may be necessary to change the service to run under a different account that can access the directory and encrypt it. Use the following steps, to update the service, encrypt the data directory, and restart the service: 1. Change the edb-as-11 service to run as a local user account that is the same domain user that will be used to encrypt the data directory (ex. "administrator"). Open Computer Management >> Services. Highlight the "edb-as-11 service". Stop the service. Select the service properties. Select the "Log On" tab, and update the "Log on as" setting to an account such as "Administrator". 2. Encrypt the data directory by following these instructions (logged in as the user who runs the service): Right-click on <postgresql data directory>, select properties, select the Advanced button in the General tab, and then select the "Encrypt contents to secure data" checkbox in the "Advanced Attributes" window. Select the option to apply to subfolders and files when prompted. 3. Restart the EDB service after encrypting the drive.
All PPAS built-in security packages are in the sys, pg_catalog, information_schema, and dbo schemas. If any application-specific packages have been added to these schemas, this is a finding.
Remove all application-specific packages that were added to the sys, pg_catalog, information_schema, and dbo schemas.
Review the procedures for the refreshing of development/test data from production. Review any scripts or code that exist for the movement of production data to development/test systems or to any other location or for any other purpose. Verify that copies of production data are not left in unprotected locations. If the code that exists for data movement does not comply with the organization-defined data transfer policy and/or fails to remove any copies of production data from unprotected locations, this is a finding.
Modify any code used for moving data from production to development/test systems to comply with the organization-defined data transfer policy and to ensure copies of production data are not left in unsecured locations.
Verify User ownership, Group ownership, and permissions on the <postgressql data directory> directory. Note that the default location for the EDB postgresql data directory is found in the directory where EDB Postgres Advanced Server is installed. The location of the data directory for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW data_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). 1) Check Ownership of Postgresql Data Directory: First, determine ownership of the postgresql data directory folder. This can be done using Windows Explorer or via a Windows command prompt. Using Windows Explorer: Browse to the directory where the postgresql data directory folder is located. Select and right-click on the folder, select "Properties", and select the "Details" tab. Note the Value of the Owner field. Using the Windows command prompt, enter the following command: dir "<postgresql data directory>" /Q /S Note: The above command will list all of the 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 the owner listed for the folder and any of the files and subfolders in the data directory is not the database service account and the configuration has not been documented and approved, this is a finding. 2) Check Permissions on Postgresql Data Directory Check the permissions assigned to the postgresql data directory folder and its content. This can be done using Windows Explorer or via a Windows command prompt. Using Windows Explorer: Browse to the directory where the postgresql data 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 "<postgresql data directory>" icacls "<postgresql data 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. Verify that at most the following permissions are applied: NT AUTHORITY/NetworkService (or configured database service account) (Full Control) Administrators (Full Control) Users (none) If other permissions have been granted to other users or groups and the permission setting has not been documented with sufficient documentation and approved, this is a finding.
If the postgresql data directory and its contents are not owned by the database service account or other user as documented and approved in the system documentation, change ownership to an authorized user. Modify permissions on the data 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 (Full Control) 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.
Review DBMS code (trigger procedures, functions), application code, settings, column and field definitions, and constraints to determine whether the database is protected against invalid input. If code exists that allows invalid data to be acted upon or input into the database, this is a finding. If column/field definitions do not exist in the database, this is a finding. If columns/fields do not contain constraints and validity checking where required, this is a finding. Where a column/field is noted in the system documentation as necessarily free-form, even though its name and context suggest that it should be strongly typed and constrained, the absence of these protections is not a finding. Where a column/field is clearly identified by name, caption, or context as Notes, Comments, Description, Text, etc., the absence of these protections is not a finding. Check application code that interacts with the EDB Postgres Advanced Server database for the use of prepared statements. If prepared statements are not used, this is a finding. If EDB SQL/Protect is being used to monitor and protect the EDB Postgres Advanced Server database from possible SQL injection attacks, verify that it has been configured according to documented organizational needs. 1) Execute the following SQL as enterprisedb: SELECT name, setting FROM pg_settings WHERE name LIKE 'edb\_sql\_protect.%' ESCAPE '\'; If the results of the above query show that the edb_sql_protect.enabled parameter is set to 'off' or if the edb_sql_protect.level is not set to an approved value, this is a finding. 2) In all the databases that are to be monitored with EDB SQL/Protect, execute the following SQL as enterprisedb: \dn If the "sqlprotect" schema is not listed, this is a finding. 3) In all the databases that are to be monitored with EDB SQL/Protect, execute the following SQL as enterprisedb: SELECT * FROM sqlprotect.list_protected_users; If the database and user that handles user input is not listed, or the remaining settings are not set to approved values, this is a finding.
Modify database code to properly validate data before it is put into the database or acted upon by the database. Modify the database to contain column/field definitions for each column/field in the database. Modify the database to contain constraints and validity checking on database columns and tables that require them for data integrity. Use prepared statements for user supplied inputs. Do not allow general users direct console access to the EDB Postgres Advanced Server database. If EDB SQL/Protect is being used to monitor and protect the EDB Postgres Advanced Server database from possible SQL injection attacks, install and configure SQL/Protect as documented here: https://www.enterprisedb.com/docs/en/11.0/EPAS_Guide_v11/EDB_Postgres_Advanced_Server_Guide.1.048.html#
Review DBMS source code (stored procedures, functions, triggers) and application source code, to identify cases of dynamic code execution. Any user input should be handled through prepared statements. If dynamic code execution is employed in circumstances where the objective could practically be satisfied by static execution with strongly typed parameters, this is a finding. If EDB SQL/Protect is being used to monitor and protect the EDB Postgres Advanced Server database from possible SQL injection attacks, verify that it has been configured according to documented organizational needs. 1) Execute the following SQL as enterprisedb: SELECT name, setting FROM pg_settings WHERE name LIKE 'edb\_sql\_protect.%' ESCAPE '\'; If the results of the above query show that the edb_sql_protect.enabled parameter is set to 'off' or if the edb_sql_protect.level is not set to an approved value, this is a finding. 2) In all the databases that are to be monitored with EDB SQL/Protect, execute the following SQL as enterprisedb: \dn If the "sqlprotect" schema is not listed, this is a finding. 3) In all the databases that are to be monitored with EDB SQL/Protect, execute the following SQL as enterprisedb: SELECT * FROM sqlprotect.list_protected_users; If the database and user that handles user input is not listed or the remaining settings are not set to approved values, this is a finding.
Where dynamic code execution is employed in circumstances where the objective could practically be satisfied by static execution with strongly typed parameters, modify the code to do so. If EDB SQL/Protect is being used to monitor and protect the EDB Postgres Advanced Server database from possible SQL injection attacks, install and configure SQL/Protect as documented here: https://www.enterprisedb.com/docs/en/11.0/EPAS_Guide_v11/EDB_Postgres_Advanced_Server_Guide.1.048.html#
Review DBMS source code (stored procedures, functions, triggers) and application source code to identify cases of dynamic code execution. If dynamic code execution is employed without protective measures against code injection, this is a finding. If EDB SQL/Protect is being used to monitor and protect the EDB Postgres Advanced Server database from possible SQL injection attacks, verify that it has been configured according to documented organizational needs. 1) Execute the following SQL as enterprisedb: SELECT name, setting FROM pg_settings WHERE name LIKE 'edb\_sql\_protect.%' ESCAPE '\'; If the results of the above query show that the edb_sql_protect.enabled parameter is set to 'off' or if the edb_sql_protect.level is not set to an approved value, this is a finding. 2) In all the databases that are to be monitored with EDB SQL/Protect, execute the following SQL as enterprisedb: \dn If the "sqlprotect" schema is not listed, this is a finding. 3) In all the databases that are to be monitored with EDB SQL/Protect, execute the following SQL as enterprisedb: SELECT * FROM sqlprotect.list_protected_users; If the database and user that handles user input is not listed or the remaining settings are not set to approved values, this is a finding.
Where dynamic code execution is used, modify the code to implement protections against code injection (i.e., prepared statements). If EDB SQL/Protect is being used to monitor and protect the EDB Postgres Advanced Server database from possible SQL injection attacks, install and configure SQL/Protect as documented here: https://www.enterprisedb.com/docs/en/11.0/EPAS_Guide_v11/EDB_Postgres_Advanced_Server_Guide.1.048.html#
Check custom database code to verify that error messages do not contain information beyond what is needed for troubleshooting the issue. If custom database errors contain PII data, sensitive business data, or information useful for identifying the host system or database structure, this is a finding.
Configure custom database code and associated application code not to divulge sensitive information or information useful for system identification in error messages.
# 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.
# 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.
Review system documentation to obtain the organization's definition of circumstances requiring automatic session termination. If the documentation explicitly states that such termination is not required or is prohibited, this is not a finding. If the documentation requires automatic session termination but the DBMS is not configured via triggers, scripts, or other organization-defined manners to terminate sessions when required, this is a finding.
Execute this SQL command in the places where the documentation requires automatic session termination: SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE usename = '<username>'
If security labeling is not required, this is not a finding. If security labeling requirements have been specified, execute the following SQL as enterprisedb: SELECT * from ALL_POLICIES where OBJECT_NAME = '<table name>'; If a policy is not enabled for the table requiring security labeling, this is a finding. If security labeling is required and not implemented according to the system documentation, this is a finding. If security labeling requirements have been specified, but neither a third-party solution nor an EDB Postgres Advanced Server Row-Level security solution is implemented that reliably maintains labels on information in storage, this is a finding.
Deploy EDB Postgres Advanced Server Row-Level Security (see link below) or a third-party software, or add custom data structures, data elements, and application code, to provide reliable security labeling of information in storage. https://www.enterprisedb.com/docs/en/11.0/EPAS_BIP_Guide_v11/Database_Compatibility_for_Oracle_Developers_Built-in_Package_Guide.1.31.html#pID0E0UUD0HA
If security labeling is not required, this is not applicable (NA). If security labeling requirements have been specified, execute the following SQL as enterprisedb: SELECT * from ALL_POLICIES where OBJECT_NAME = '<table name>'; If a policy is not enabled for the table requiring security labeling, this is a finding. If security labeling is required and not implemented according to the system documentation, this is a finding. If security labeling requirements have been specified, but neither a third-party solution nor an EDB Postgres Advanced Server Row-Level security solution is implemented that reliably maintains labels on information in process, this is a finding.
Deploy EDB Postgres Advanced Server Row-Level Security (see link below) or a third-party software, or add custom data structures, data elements and application code, to provide reliable security labeling of information in process. https://www.enterprisedb.com/docs/en/11.0/EPAS_BIP_Guide_v11/Database_Compatibility_for_Oracle_Developers_Built-in_Package_Guide.1.31.html#pID0E0UUD0HA
If security labeling is not required, this is not applicable (NA). If security labeling requirements have been specified, execute the following SQL as enterprisedb: SELECT * from ALL_POLICIES where OBJECT_NAME = '<table name>'; If a policy is not enabled for the table requiring security labeling, this is a finding. If security labeling is required and not implemented according to the system documentation, this is a finding. If security labeling requirements have been specified, but neither a third-party solution nor an EDB Postgres Advanced Server Row-Level security solution is implemented that reliably maintains labels on information in transmission, this is a finding.
Deploy EDB Postgres Advanced Server Row-Level Security (see link below) or a third-party software, or add custom data structures, data elements and application code, to provide reliable security labeling of information in transmission. https://www.enterprisedb.com/docs/en/11.0/EPAS_BIP_Guide_v11/Database_Compatibility_for_Oracle_Developers_Built-in_Package_Guide.1.31.html#pID0E0UUD0HA
Review system documentation to identify the required discretionary access control (DAC). Review the security configuration of the database and EDB Postgres Advanced Server. If applicable, review the security configuration of the application(s) using the database. If the discretionary access control defined in the documentation is not implemented in the security configuration, this is a finding. Check the EDB Postgres instance for the ownership and privileges assigned to database objects. # Check for object ownership and privileges # Check for database owners and granted privileges To list all the databases contained in an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the databases, connect to a database as a database superuser using psql and execute the following psql command: \l Review the results of the above command. If any database is owned by a user or group role that is not documented as being approved to own the database, this is a finding. If any user or group role has been granted privileges on a database that is not documented and approved, this is a finding. # Check for schema owners and granted privileges To list all the schemas contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the schemas, connect to the database as a database superuser using psql and execute the following psql command: \dn+ * Review the results of the above command. If any schema is owned by a user or group role that is not documented as being approved to own the schema, this is a finding. If any user or group role has been granted privileges on a schema that is not documented and approved, this is a finding. # Check for table, sequence, and view owners To list all the tables, sequences, and views contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners, connect to the database as a database superuser using psql and execute the following psql commands: \dt *.* \ds *.* \dv *.* Review the results of the above commands. If any table, sequence, or view is owned by a user or group role that is not documented as being approved to own the object, this is a finding. # Check for table, sequence, and view access privileges To list all the privileges that have been granted on the tables, sequences, and views in a database, connect to the database as a database superuser using psql and execute the following psql command: \dp *.* Review the results of the above command. If any user or group role has been granted privileges on an object that is not documented and approved, this is a finding. # Check for function/procedure owners and access privileges To list all the functions and procedures contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the schemas, connect to the database as a database superuser using psql and execute the following SQL statement: SELECT r.rolname as owner , n.nspname as namespace , p.proname as name , pg_get_function_identity_arguments(p.oid) , p.prokind as kind , p.proacl as access_privileges FROM pg_proc p JOIN pg_namespace n ON p.pronamespace = n.oid JOIN pg_authid r ON p.proowner = r.oid ORDER BY 1, 2, 3, 4; Review the results of the above query. If any function or procedure is owned by a user or group role that is not documented as being approved to own the object, this is a finding. If any user or group role has been granted privileges on a function or procedure that is not documented and approved, this is a finding.
Implement the organization's DAC policy in the security configuration of the database and EDB Postgres Advanced Server, and, if applicable, the security configuration of the application(s) using the database. If an unapproved user or group role is the owner of a database object, change the owner to an approved user or group role using one of the following ALTER SQL commands as appropriate: The syntax is: ALTER DATABASE <database name> OWNER TO <new_owner> ALTER SCHEMA <schema name> OWNER TO <new_owner> ALTER TABLE <table name> OWNER TO <new_owner> ALTER SEQUENCE <sequence name> OWNER TO <new_owner> ALTER VIEW <view name> OWNER TO <new_owner> ALTER FUNCTION <function name> (<args>) OWNER TO <new_owner> ALTER PROCEDURE <procedure name> (<args>) OWNER TO <new_owner> Examples: ALTER DATABASE test_db OWNER TO app_admin ALTER SCHEMA test_schema OWNER TO app_admin ALTER TABLE test_tbl OWNER TO app_admin ALTER SEQUENCE test_seq OWNER TO app_admin ALTER VIEW test_vw OWNER TO app_admin ALTER FUNCTION test_func (p1 numeric, p2 text) OWNER TO app_admin ALTER PROCEDURE test_proc (p1 numeric, p2 text) OWNER TO app_admin If a user or group role has been granted an unapproved role or object privilege, execute the appropriate REVOKE command as documented here: http://www.postgresql.org/docs/current/static/sql-revoke.html
Review the system documentation to obtain the definition of the EDB Postgres Advanced Server functionality considered privileged in the context of the system in question. Review the EDB Postgres Advanced Server security configuration and/or other means used to protect privileged functionality from unauthorized use. If the configuration does not protect all of the actions defined as privileged, this is a finding. To list the user and group roles in an EDB Postgres Advanced Server along with the privileges that have been assigned to each role and the roles that have been granted to each role, execute the following command in psql as a database superuser: \du+ If any user or group role is assigned a privilege or is a member of a role that provides the ability to perform an action that is considered privileged and is not documented as being approved to have these privileges or roles, this is a finding. # Check for SUPERUSER privilege To check for user and group roles that have been granted the SUPERUSER privilege, execute the following SQL statement in psql or another Postgres SQL client as enterprisedb: WITH RECURSIVE roles( granted_role_id, granted_role_name, role_id, role_name, can_login, how_superuser, root_role_name ) AS ( SELECT NULL::oid granted_role_id , NULL::name granted_role_name , r1.oid role_id , r1.rolname role_name , r1.rolcanlogin can_login , 'Assigned Superuser Privilege' how_superuser , r1.rolname root_role_name FROM pg_authid r1 WHERE r1.rolsuper = 't' UNION SELECT m.roleid , r3.rolname , m.member , r2.rolname , r2.rolcanlogin , 'Granted Role with Superuser Privilege' , r1.root_role_name FROM pg_auth_members m JOIN pg_authid r2 ON r2.oid = m.member JOIN pg_authid r3 ON r3.oid = m.roleid JOIN roles r1 ON m.roleid = r1.role_id ) SELECT DISTINCT r.role_name, r.can_login, hs.how_superuser, gr.granted_roles, rr.root_superuser_roles FROM roles r JOIN ( SELECT role_name, string_agg(how_superuser, ', ') how_superuser FROM ( SELECT DISTINCT role_name, how_superuser FROM roles ORDER BY 2 ) GROUP BY role_name ) hs ON r.role_name = hs.role_name JOIN ( SELECT role_name, string_agg(granted_role_name, ', ') granted_roles FROM ( SELECT DISTINCT role_name, granted_role_name FROM roles ORDER BY 2 ) GROUP BY role_name ) gr ON r.role_name = gr.role_name JOIN ( SELECT role_name, string_agg(root_role_name, ', ') root_superuser_roles FROM ( SELECT DISTINCT role_name, root_role_name FROM roles ORDER BY 2 ) GROUP BY role_name ) rr ON r.role_name = rr.role_name ORDER BY 3,1; The above query will list all user and group roles that have either been granted the SUPERUSER privilege explicitly, or via one of the roles in the hierarchy of roles they have been granted. If a user or group role has the SUPERUSER privilege either directly or via one of the roles in the hierarchy of roles it has been granted and the role is not documented as being approved to have this privilege, this is a finding. # Check for CREATEROLE, CREATEDB, REPLICATION, and BYPASSURLS privileges To check for user and group roles that have been granted the CREATEROLE, CREATEDB, REPLICATION, or BYPASSSRLS privileges, execute the following SQL statement in psql or another Postgres SQL client as enterprisedb: WITH RECURSIVE roles( granted_role_id, granted_role_name, role_id, role_name, can_login, how_privileged, root_role_name ) AS ( SELECT NULL::oid granted_role_id , NULL::name granted_role_name , r1.oid role_id , r1.rolname role_name , r1.rolcanlogin can_login , 'Assigned Privilege' how_privileged , r1.rolname root_role_name , pr.privilege , pr.sortkey FROM ( SELECT 1 sortkey, oid, 'CREATEROLE' privilege FROM pg_authid WHERE rolcreaterole = 't' UNION SELECT 2 sortkey, oid, 'CREATEDB' privilege FROM pg_authid WHERE rolcreatedb = 't' UNION SELECT 3 sortkey, oid, 'REPLICATION' privilege FROM pg_authid WHERE rolreplication = 't' UNION SELECT 4 sortkey, oid, 'BYPASSRLS' privilege FROM pg_authid WHERE rolbypassrls = 't' ) pr JOIN pg_authid r1 ON pr.oid = r1.oid UNION SELECT m.roleid , r3.rolname , m.member , r2.rolname , r2.rolcanlogin , 'Granted Role with Privilege' , r1.root_role_name , r1.privilege , r1.sortkey FROM pg_auth_members m JOIN pg_authid r2 ON r2.oid = m.member JOIN pg_authid r3 ON r3.oid = m.roleid JOIN roles r1 ON m.roleid = r1.role_id ) SELECT DISTINCT r.sortkey, r.privilege, r.role_name, r.can_login, hs.how_privileged, gr.granted_roles, rr.root_roles_with_priv FROM roles r JOIN ( SELECT role_name, string_agg(how_privileged, ', ') how_privileged FROM ( SELECT DISTINCT role_name, how_privileged FROM roles ORDER BY 2 ) GROUP BY role_name ) hs ON r.role_name = hs.role_name JOIN ( SELECT role_name, string_agg(granted_role_name, ', ') granted_roles FROM ( SELECT DISTINCT role_name, granted_role_name FROM roles ORDER BY 2 ) GROUP BY role_name ) gr ON r.role_name = gr.role_name JOIN ( SELECT role_name, string_agg(root_role_name, ', ') root_roles_with_priv FROM ( SELECT DISTINCT role_name, root_role_name FROM roles ORDER BY 2 ) GROUP BY role_name ) rr ON r.role_name = rr.role_name ORDER BY r.sortkey, r.privilege, hs.how_privileged, r.role_name; The above query will list all user and group roles that have either been granted the CREATEROLE, CREATEDB, REPLICATION, or BYPASSRLS privileges explicitly or via one of the roles in the hierarchy of roles they have been granted. If a user or group role has one of these privileges either directly or via one of the roles in the hierarchy of roles it has been granted and the role is not documented as being approved to have this privilege, this is a finding. # Check for default role assignments In addition to the SUPERUSER, CREATEDB, and CREATEROLE privileges, a user may be granted one or more default roles that provide access to certain privileged capabilities and activities. A listing and description of the default roles provided with Postgres is documented at the following link: https://www.postgresql.org/docs/current/default-roles.html To check for user and group roles that have been granted a role, execute the following SQL statement in psql or another Postgres SQL client as a database administrator, replacing <ROLE NAME> with the name of the role to be checked: WITH RECURSIVE roles( granted_role_id, granted_role_name, role_id, role_name, can_login, root_role_name ) AS ( SELECT NULL::oid granted_role_id , NULL::name granted_role_name , r1.oid role_id , r1.rolname role_name , r1.rolcanlogin can_login , r1.rolname root_role_name FROM pg_authid r1 WHERE r1.rolname = '<ROLE NAME>' UNION SELECT m.roleid , r3.rolname , m.member , r2.rolname , r2.rolcanlogin , r1.root_role_name FROM pg_auth_members m JOIN pg_authid r2 ON r2.oid = m.member JOIN pg_authid r3 ON r3.oid = m.roleid JOIN roles r1 ON m.roleid = r1.role_id ) SELECT DISTINCT r.role_name, r.can_login, gr.granted_roles, rr.server_os_access_roles FROM roles r JOIN ( SELECT role_name, string_agg(granted_role_name, ', ') granted_roles FROM ( SELECT DISTINCT role_name, granted_role_name FROM roles ORDER BY 2 ) GROUP BY role_name ) gr ON r.role_name = gr.role_name JOIN ( SELECT role_name, string_agg(root_role_name, ', ') server_os_access_roles FROM ( SELECT DISTINCT role_name, root_role_name FROM roles ORDER BY 2 ) GROUP BY role_name ) rr ON r.role_name = rr.role_name WHERE gr.granted_roles IS NOT NULL ORDER BY 1; Note that in the above query, to do a check for more than one role in a single query, replace "r1.rolname = '<ROLE NAME>'" with a comma separated list of roles in an SQL "IN" clause (e.g., "r1.rolname IN ( '<ROLE 1 NAME>', '<ROLE 2 NAME>', <'ROLE N NAME'> )"). The above query will list all user and group roles that have been granted the specified role(s) either explicitly or via one of the roles in the hierarchy of roles they have been granted. If a user or group role has been granted one of the default privileged roles explicitly or via one of the roles in the hierarchy of roles they have been granted, and the role is not documented as being approved to have this role, this is a finding. # Check for object ownership and privileges # Check for database owners and granted privileges To list all the databases contained in an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the databases, connect to a database as a database superuser using psql and execute the following psql command: \l Review the results of the above command. If any database is owned by a user or group role that is not documented as being approved to own the database, this is a finding. If any user or group role has been granted privileges on a database that is not documented and approved, this is a finding. # Check for schema owners and granted privileges To list all the schemas contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the schemas, connect to the database as a database superuser using psql and execute the following psql command: \dn+ * Review the results of the above command. If any schema is owned by a user or group role that is not documented as being approved to own the schema, this is a finding. If any user or group role has been granted privileges on a schema that is not documented and approved, this is a finding. # Check for table, sequence, and view owners To list all the tables, sequences, and views contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners, connect to the database as a database superuser using psql and execute the following psql commands: \dt *.* \ds *.* \dv *.* Review the results of the above commands. If any table, sequence, or view is owned by a user or group role that is not documented as being approved to own the object, this is a finding. # Check for table, sequence, and view access privileges To list all the privileges that have been granted on the tables, sequences, and views in a database, connect to the database as a database superuser using psql and execute the following psql command: \dp *.* Review the results of the above command. If any user or group role has been granted privileges on an object that is not documented and approved, this is a finding. # Check for function/procedure owners and access privileges To list all the functions and procedures contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the schemas, connect to the database as a database superuser using psql and execute the following SQL statement: SELECT r.rolname as owner , n.nspname as namespace , p.proname as name , pg_get_function_identity_arguments(p.oid) , p.prokind as kind , p.proacl as access_privileges FROM pg_proc p JOIN pg_namespace n ON p.pronamespace = n.oid JOIN pg_authid r ON p.proowner = r.oid ORDER BY 1, 2, 3, 4; Review the results of the above query. If any function or procedure is owned by a user or group role that is not documented as being approved to own the object, this is a finding. If any user or group role has been granted privileges on a function or procedure that is not documented and approved, this is a finding. # Check for additional installed procedural languages To list the procedural languages that are available for use in a database within an EDB Postgres Advanced Server database, connect to the database as a database superuser using psql and execute the following psql command: \dL+ Review the results of the above command. A value of "f" in the "Trusted" column of the results indicates that the language is defined as an "untrusted" language. If no Access Privileges are listed for a particular language, this means that default privileges are assigned. In Postgres, unless overridden by using the ALTER DEFAULT PRIVILEGES command, the USAGE privilege on languages is assigned to PUBLIC by default. If any "untrusted" language is listed in the results of the above command and not approved for use by the system, this is finding. If any user or group role has been granted USAGE on an "untrusted" language that is not documented and approved, this is a finding. # Check for functions that are written in untrusted procedural languages To check whether any user defined functions contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) are written in an untrusted procedural language, connect to the database as a database superuser using psql and execute the following SQL statement: SELECT n.nspname "Schema", p.proname "Function", p.prosrc "Source", p.probin "Library", l.lanname "Language", p.proacl "Access Privileges" FROM pg_proc p JOIN pg_namespace n ON p.pronamespace = n.oid JOIN pg_language l on p.prolang = l.oid WHERE (l .lanpltrusted = 'f' AND l.lanname != 'internal' ) AND n.nspname NOT IN ('pg_catalog', 'sys', 'information_schema') ORDER BY 5, 1, 2; Review the results of the above query. Note that if no Access Privileges are listed for a particular function, this means that default privileges are assigned. In Postgres, unless overridden by using the ALTER DEFAULT PRIVILEGES command, the EXECUTE privilege on functions is assigned to PUBLIC by default. If any user defined function is listed and is not documented as being approved for use, this is a finding. If any user defined function is listed and is documented as being approved, but has execute privilege granted to a user or group role that has not been documented as having been approved for this permission, this is a finding.
Update system documentation to accurately identify all user and group roles that are authorized to perform privileged actions. If the SUPERUSER, CREATEROLE, CREATEDB, REPLICATION, or BYPASSRLS privileges have been assigned to a user or group role that is not approved to have these privileges, remove the privilege using the ALTER ROLE SQL command as necessary. The syntax is: ALTER ROLE <role> NOSUPERUSER ALTER ROLE <role> NOCREATEROLE ALTER ROLE <role> NOCREATEDB ALTER ROLE <role> NOREPLICATION ALTER ROLE <role> NOBYPASSURLS Examples: ALTER ROLE testuser NOSUPERUSER ALTER ROLE testuser NOCREATEROLE ALTER ROLE testuser NOCREATEDB ALTER ROLE testuser NOREPLICATION ALTER ROLE testuser NOBYPASSURLS If an unapproved user or group role is the owner of a database object, change the owner to an approved user or group role using one of the following ALTER SQL commands as appropriate: The syntax is: ALTER DATABASE <database name> OWNER TO <new_owner> ALTER SCHEMA <schema name> OWNER TO <new_owner> ALTER TABLE <table name> OWNER TO <new_owner> ALTER SEQUENCE <sequence name> OWNER TO <new_owner> ALTER VIEW <view name> OWNER TO <new_owner> ALTER FUNCTION <function name> (<args>) OWNER TO <new_owner> ALTER PROCEDURE <procedure name> (<args>) OWNER TO <new_owner> Examples: ALTER DATABASE test_db OWNER TO app_admin ALTER SCHEMA test_schema OWNER TO app_admin ALTER TABLE test_tbl OWNER TO app_admin ALTER SEQUENCE test_seq OWNER TO app_admin ALTER VIEW test_vw OWNER TO app_admin ALTER FUNCTION test_func (p1 numeric, p2 text) OWNER TO app_admin ALTER PROCEDURE test_proc (p1 numeric, p2 text) OWNER TO app_admin If a user or group role has been granted an unapproved role or object privilege, execute the appropriate REVOKE command as documented here: http://www.postgresql.org/docs/current/static/sql-revoke.html Update the system documentation to identify the intended use, scope, and justification for any "untrusted" procedural languages that are being used for user defined functions as well as the users who are approved to use these languages and corresponding functions. If an unapproved user defined function exists, remove it from the database by executing the DROP FUNCTION SQL command as documented here: https://www.postgresql.org/docs/current/sql-dropfunction.html If an unapproved procedural language is installed, remove it from the database by executing the following SQL command: DROP EXTENSION <extension_name>
Review the system documentation and source code of the application(s) using the database. If elevation of DBMS privileges is used but not documented, this is a finding. If elevation of DBMS privileges is documented but not implemented as described in the documentation, this is a finding. If the privilege-elevation logic can be invoked in ways other than intended, in contexts other than intended, or by subjects/principals other than intended, this is a finding. Execute the following SQL to find any SECURITY DEFINER functions (meaning they are executed as owner rather than invoker): select proname from pg_proc where prosecdef = true; If any of these functions should not be SECURITY DEFINER, this is a finding.
Determine where, when, how, and by what principals/subjects elevated privilege is needed. Modify the system and the application(s) using the database to ensure privilege elevation is used only as required. To alter a function to use SECURITY INVOKER instead of SECURITY DEFINER, execute the following SQL: ALTER FUNCTION <function()> SECURITY INVOKER;
Review the system documentation and source code of the application(s) using the database. If elevation of DBMS privileges is used but not documented, this is a finding. If elevation of DBMS privileges is documented but not implemented as described in the documentation, this is a finding. If the privilege-elevation logic can be invoked in ways other than intended, in contexts other than intended, or by subjects/principals other than intended, this is a finding. Execute the following SQL to find any users with BYPASS RLS permissions: select rolname from pg_roles where rolbypassrls = true; If any of these users are not superusers that should bypass RLS, this is a finding.
Determine where, when, how, and by what principals/subjects elevated privilege is needed. Modify the system and the application(s) using the database to ensure privilege elevation is used only as required. To alter a user to not allow bypassing RLS, execute the following SQL: ALTER USER <user> NOBYPASSRLS;
If a centralized log collecting tool such as Postgres Enterprise Manager (PEM) is not installed and configured to automatically collect audit logs, this is a finding. Review the system documentation for a description of how audit records are off-loaded and how local audit log space is managed.
Install a centralized log collecting tool and configure it as instructed in its documentation. If using PEM, find the instructions at https://www.enterprisedb.com/docs/en/7.0/pemgetstarted/toc.html
If managing only single EDB Postgres Advanced Server clusters, this is not a finding. If managing multiple EDB Postgres Advanced Server clusters and a unified tool for audit configuration such as PEM (Postgres Enterprise Manager) is not installed to configure and manage audit logs, this is a finding. Review the system documentation for a description of how audit records are off-loaded and how local audit log space is managed.
If managing multiple EDB Postgres Advanced Server clusters (i.e., instances), install a centralized audit log management tool and configure it as instructed in its documentation. If using PEM, find the instructions at https://www.enterprisedb.com/docs/en/7.0/pemgetstarted/toc.html
Investigate whether there have been any incidents where the DBMS ran out of audit log space since the last time the space was allocated or other corrective measures were taken. If there have been incidents, this is a finding. To check how much storage capacity is available for audit records, first determine the location where the EDB audit logs are being written by executing the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW edb_audit_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). Note that the default location for the EDB postgresql data directory is found in the directory where EDB Postgres Advanced Server is installed. The location of the data directory for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW data_directory" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If the default path is used for the postgresql data directory and the default setting of "edb_audit" is used for the edb_audit_directory parameter, the path to the EDB audit directory would be <EDB Postgres data directory>\edb_audit. Depending on the version of EPAS installed, the options selected during installation, and the edb_audit_directory parameter setting, the path to the data directory and the EDB audit directory may be different. With the EDB audit directory identified, note the disk on which this directory exists. Use the Windows Disk Management panel to determine how much space has been allocated to the disk and how much space remains. The Disk Management panel can be opened via "Start > Run > diskmgmt.msc". To determine the capacity, used, and free space on the disk via the Windows Explorer, right click to select the disk, and then select the "Properties" menu option. To determine how much space is currently being consumed by the audit log using Windows Explorer, right click select the audit directory and then select the "Properties" menu option. If the remaining storage on the disk does not meet organizationally defined audit record storage requirements, this is a finding.
Allocate sufficient audit file space to the partition containing the EDB Audit directory to support peak demand. Note that the EDB audit log directory is configured by the edb_audit_directory parameter. By default, the edb_audit_directory is set to "edb_audit", which results in an "edb_audit" directory being created under the EPAS cluster's data directory for audit logs if auditing is enabled.
If Postgres Enterprise Manager (PEM) or another similar monitoring capability is not installed and configured to probe storage volume utilization of "<postgresql data directory>" and notify appropriate support staff upon storage volume utilization reaching 75 percent, this is a finding. (The default path for the postgresql data directory is C:\Program Files\edb\as<version>\data, but this will vary according to local circumstances.)
Install PEM (or similar tool) and configure a probe to monitor "<postgresql data directory>" and notify appropriate support staff upon storage volume utilization reaching 75 percent. (The default path for the postgresql data directory is C:\Program Files\edb\as<version>\data, but this will vary according to local circumstances.) Example steps for creating a probe are below, using the thin client (browser) PEM interface. Refer also to the Supplemental Procedures document, supplied with this STIG. Open the PEM web console in a browser. - Log in. - Click on the agent for the machine to be monitored. - Select "Management | Probe Configuration". - Select "Disk Space" and set the check interval as you like. - Select "Management | Alerting". - Name the definition "Audit Log Full". - Select Template "Disk Consumption Percentage". - Set Frequency, Comparison Operator, and Thresholds (1 minute, >, 74/75/76 for example). - Enter the Location for the audit log. - Click Notification tab. - Click Email all alerts. - Click Add/Change to save, click "OK" to exit dialog box.
If Postgres Enterprise Manager (PEM) or another similar monitoring capability is not installed and configured to probe storage volume utilization of "<postgresql data directory>" and notify appropriate support staff upon storage volume utilization reaching capacity, this is a finding. (The default path for the postgresql data directory is C:\Program Files\edb\as<version>\data, but this will vary according to local circumstances.)
Install PEM (or similar tool) and configure a probe to monitor "<postgresql data directory>" and notify appropriate support staff upon storage volume utilization reaching capacity. (The default path for the postgresql data directory is C:\Program Files\edb\as<version>\data, but this will vary according to local circumstances.) Example steps for creating a probe are below, using the thin client (browser) PEM interface. Refer also to the Supplemental Procedures document, supplied with this STIG. Open the PEM web console in a browser. - Log in. - Click on the agent for the machine to be monitored. - Select "Management | Probe Configuration". - Select "Disk Space" and set the check interval as you like. - Select "Management | Alerting". - Name the definition "Audit Log Full". - Select Template "Disk Consumption Percentage". - Set Frequency, Comparison Operator, and Thresholds (1 minute, >, 90/95/98 for example). - Enter the Location for the audit log. - Click Notification tab. - Click Email all alerts. - Click Add/Change to save, click "OK" to exit dialog box.
If EDB Postgres supports only software development, experimentation, and/or developer-level testing (that is, excluding production systems, integration testing, stress testing, and user acceptance testing), this is not a finding. Review the EDB Postgres security settings with respect to non-administrative users' ability to create, alter, or replace logic modules, to include but not necessarily only stored procedures, functions, triggers, and views. These following commands, which are run using psql, can help with showing existing permissions of databases and schemas: \l \dn+ Permissions of concern in this respect include the following, and possibly others: - any database or schema with "C" (create) or "w" (update) privileges that are not necessary If any such permissions exist and are not documented and approved, this is a finding.
Document and obtain approval for any non-administrative users who require the ability to create, alter, or replace logic modules. Implement the approved permissions. Revoke (or deny) any unapproved permissions and remove any unauthorized role memberships. Use the REVOKE SQL command to remove privileges from databases and schemas. For example, to revoke create privileges on a database: REVOKE CREATE ON DATABASE <database_name > FROM <role_name>; To revoke create privileges on a database: REVOKE CREATE ON SCHEMA <schema_name> FROM <role_name>;
Review the security configuration of the EDB Postgres database(s). If EDB Postgres Advanced Server does not enforce access restrictions associated with changes to the configuration of the database(s), this is a finding. - - - - - To assist in conducting reviews of permissions, the following commands, which are run using psql, describe permissions of databases, schemas, and users: \l \dn+ \du Permissions of concern in this respect include the following, and possibly others: - any user with SUPERUSER privileges - any database or schema with "C" (create) or "w" (update) privileges that are not necessary If any users are listed that have SUPERUSER privileges who are not authorized for these privileges, this is a finding. If any user has create or update privileges on a database and schema who is not authorized for these privileges, this is a finding.
Configure EDB Postgres Advanced Server to enforce access restrictions associated with changes to the configuration of the EDB Postgres database(s). Remove superuser rights from unauthorized database users via the ALTER ROLE or ALTER USER SQL command. The syntax is: ALTER ROLE <role> NOSUPERUSER or ALTER USER <user> NOSUPERUSER Example: ALTER ROLE testuser NOSUPERUSER; OR ALTER USER testuser NOSUPERUSER; Use the REVOKE SQL command to remove privileges from databases and schemas. For example: REVOKE ALL PRIVILEGES ON <table> FROM <role_name>;
Review the network functions, ports, protocols, and services supported by the DBMS. If any protocol is prohibited by the PPSM guidance and is enabled, this is a finding. Open the pg_hba.conf file in an editor and verify that none of the uncommented rows have a TYPE of "host" or "hostnossl". Note that the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW hba_file" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). If any rows in the pg_hba.conf file have a TYPE that is "host" or "hostnossl" and not documented as approved in the system security documentation, this is a finding. Execute the following SQL as enterprisedb: SHOW port; If the displayed port is not allowed, this is a finding.
Disable each prohibited network function, port, protocol, or service prohibited by the PPSM guidance. Open the pg_hba.conf file in an editor and change the TYPE of any rows not starting with a "#" to be "hostssl". The METHOD for the hostssl rows should be one of these (in preferred order): cert, sspi, ldap, scram-sha-256 Note that the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running postgres instance can be found using the following command run from a Windows command prompt: psql -d <database name> -U <database superuser name> -c "SHOW hba_file" where, <database name> is any database in the EDB postgres instance and <database superuser name> is a database superuser. By default, a database named "edb" and a superuser named "enterprisedb" are installed with EDB Postgres Advanced Server (EPAS). Execute the following SQL as enterprisedb: ALTER SYSTEM SET port = <port>; Restart the database service. For EDB Postgres Advanced Server, the default service name for an instance will be "edb-as-<version>" with a default display name of "edb-as-<version> - Advanced Server <version>", where "<version>" is the major version number of the EDB Postgres Advanced Server that is installed: To restart the database service, using the Windows Services Control Manager: 1. Open the Windows Services Control Manager. 2. Select the database service from the list of services, right-click it, and select "Restart". Alternatively, the database can be restarted via the Windows command line using either the NET or SC command as follows: NET STOP <service name> NET START <service name> or SC STOP <service name> SC START <service name> In the above commands, replace <service name> with the actual service name corresponding to the EDB Postgres instance. Note that if pgAgent is installed and running, the corresponding pgAgent service is dependent on the EDB Postgres database service and must first be stopped to restart the database service. After restarting the database service, the pgAgent service may be started again.
Determine all situations where a user must re-authenticate. Check if the mechanisms that handle such situations use the following SQL: To make a single user re-authenticate, the following must be present: SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE user='<username>' To make all users re-authenticate, run the following: SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE user LIKE '%' If the provided SQL does not force re-authentication, this is a finding.
Determine the organization-defined circumstances or situations that require re-authentication and ensure the following SQL is executed in those situations. To require a single user to re-authenticate, use this SQL: SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE user = '<username>'; To require all users to re-authenticate, use this SQL: SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE user LIKE '%';
In a Windows CMD prompt, run this command: CertUtil <postgresql data directory>\server.crt If the "Issuer" that is printed out is not a DoD entity, this is a finding.
Contact your program security office to request DoD issued certificates: root.crt (CA Certificate) server.crt server.key
If the application owner and Authorizing Official have determined that encryption of data at rest is not required, this is not a finding. Right-click on <postgresql data directory>, select properties, then select the General tab and the Advanced button. If the "Encrypt contents to secure data" check box is not checked, this is a finding.
Do these steps as the Windows user that is the database administrators (default is enterprisedb), if done as a different user, the Windows database administration user will be unable to view this folder and therefore unable to start the database: Right-click on <postgresql data directory>, select properties, then select the General tab and the Advanced button. Select option to apply to subfolders and files when prompted.
If the application owner and Authorizing Official have determined that encryption of data at rest is not required, this is not a finding. Right-click on <postgresql data directory>, select properties, then select the General tab and the Advanced button. If the "Encrypt contents to secure data" check box is not checked, this is a finding.
Do these steps as the Windows user that is the database administrators (default is enterprisedb). If done as a different user, the Windows database administration user will be unable to view this folder and therefore unable to start the database: Right-click on <postgresql data directory>, select properties, then select the General tab and the Advanced button. Select option to apply to subfolders and files when prompted.
If the data owner does not have a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process, this is not a finding. First, check if SSL is enabled for the database instance by connecting to the database as a database superuser using psql and executing the following command: SHOW ssl; If the result is not "on", this is a finding. Next, review the host based authentication settings by connecting to the database as a database superuser using psql and executing the following command: SELECT * FROM pg_hba_file_rules; Alternatively, open the pg_hba.conf file in a viewer or editor and review the authentication settings that are configured in that file. Note the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running EDB postgres instance can be found by connecting to the database as a database superuser using psql and executing the following command: SHOW hba_file; If any uncommented lines are not of TYPE "hostssl" and do not include the "clientcert=1" authentication option and are not documented in the system security plan or equivalent document as being approved, this is a finding.
To configure EDB Postgres Advanced Server to use SSL, open the ”postgresql.conf" file in an editor. Note the default location for the postgresql.conf file is in the postgresql data directory. The location of the postgresql.conf for a running EDB Postgres instance can be found by connecting to the database as a database superuser using psql and executing the following command: SHOW config_file; In the postgresql.conf file, set the “ssl” parameter as follows: ssl = on Make sure the parameter is uncommented. In order to start an EDB Postgres Advance Server instance in SSL mode, files containing the server certificate and private key must exist. By default, these files are expected to exist in the Postgres data directory and are expected to be named server.crt and server.key, respectively. Update the ssl_cert_file and ssl_cert_key parameters in the postgresql.conf file if the files are placed in a different location or are named differently. Note that changes to the ssl parameter setting and any of the other ssl related parameters require a reload of the database server configuration to put the changes into effect. To reload the database server configuration, connect to the database as a database superuser using psql and execute the following command: SELECT pg_reload_conf(); After verifying that SSL is enabled for the database, open the pg_hba.conf file in an editor to configure the host-based authentication settings. Note the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running EDB postgres instance can be found by connecting to the database as a database superuser using psql and execute the following command: SHOW hba_file; Obtain approval and document any uncommented entries with corresponding justification that are not of type hostssl and do not include the “clientcert=1” option. For any entries that are not of type hostssl authentication with the “clientcert=1” option and not documented and approved, change the "TYPE" column to “hostssl” and add the “clientcert=1” authentication method option. Note on Microsoft Windows systems, changes to the host-based authentication settings in the pg_hba.conf file are immediately applied by subsequent new connections. For more information on configuring PostgreSQL to use SSL, consult the following documentation: https://www.postgresql.org/docs/current/ssl-tcp.html For more information on configuring the postgresql pg_hba.conf file, consult the following documentation: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
If the data owner does not have a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process, this is not a finding. First, check if ssl is enabled for the database instance, connect to the database as a database superuser using psql and executing the following command: SHOW ssl; If the result is not "on", this is a finding. Next, review the host based authentication settings by connecting to the database as a database superuser using psql and executing the following command: SELECT * FROM pg_hba_file_rules; Alternatively, open the pg_hba.conf file in a viewer or editor and review the authentication settings that are configured in that file. Note the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running EDB postgres instance can be found by connecting to the database as a database superuser using psql and executing the following command: SHOW hba_file; If any uncommented lines are not of TYPE "hostssl" and do not include the "clientcert=1" authentication option and are not documented in the system security plan or equivalent document as being approved, this is a finding.
To configure EDB Postgres Advanced Server to use SSL, open the ”postgresql.conf" file in an editor. Note the default location for the postgresql.conf file is in the postgresql data directory. The location of the postgresql.conf for a running EDB Postgres instance can be found by connecting to the database as a database superuser using psql and executing the following command: SHOW config_file; In the postgresql.conf file, set the “ssl” parameter as follows: ssl = on Make sure the parameter is uncommented. In order to start an EDB Postgres Advanced Server instance in SSL mode, files containing the server certificate and private key must exist. By default, these files are expected to exist in the Postgres data directory and are expected to be named server.crt and server.key, respectively. Update the ssl_cert_file and ssl_cert_key parameters in the postgresql.conf file if the files are placed in a different location or are named differently. Note changes to the ssl parameter setting and any of the other ssl related parameters require a reload of the database server configuration to put the changes into effect. To reload the database server configuration, connect to the database as a database superuser using psql and execute the following command: SELECT pg_reload_conf(); After verifying SSL is enabled for the database, open the pg_hba.conf file in an editor to configure the host-based authentication settings. Note the default location for the pg_hba.conf file is in the postgresql data directory. The location of the pg_hba.conf file for a running EDB postgres instance can be found by connecting to the database as a database superuser using psql and execute the following command: SHOW hba_file; Obtain approval and document any uncommented entries with corresponding justification that are not of type hostssl and do not include the “clientcert=1” option. For any entries that are not of type hostssl authentication with the “clientcert=1” option and not documented and approved, change the "TYPE" column to “hostssl” and add the “clientcert=1” authentication method option. Note that on Microsoft Windows systems, changes to the host-based authentication settings in the pg_hba.conf file are immediately applied by subsequent new connections. For more information on configuring PostgreSQL to use SSL, consult the following documentation: https://www.postgresql.org/docs/current/ssl-tcp.html For more information on configuring the postgresql pg_hba.conf file, consult the following documentation: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
Review system documentation to determine how input errors are to be handled in general and if any special handling is defined for specific circumstances. Review the source code for database program objects (stored procedures, functions, triggers) and application source code to identify how the system responds to invalid input. If it does not implement the documented behavior, this is a finding. Verify that EDB auditing is enabled. Execute the following SQL as enterprisedb: SHOW edb_audit; If the result is not "csv" or "xml", this is a finding. Verify that EDB Audit is logging errors at a minimum, and unless otherwise documented and approved, also logging DDL and DML actions performed on the EDB Postgres Advanced Server database. Execute the following SQL as enterprisedb: SHOW edb_audit_statement; If the result is "all", this is not a finding. Otherwise, if the result is not at least "error,ddl,dml" and if the current setting for this requirement has not been noted and approved by the organization in the system documentation, this is a finding. If EDB SQL/Protect is being used to monitor and protect the EDB Postgres Advanced Server database from unexpected or unauthorized actions performed on database tables, verify that it has been configured according to documented organizational needs. 1) Execute the following SQL as enterprisedb: SELECT name, setting FROM pg_settings WHERE name LIKE 'edb\_sql\_protect.%' ESCAPE '\'; If the results of the above query show that the edb_sql_protect.enabled parameter is set to 'off' or if the edb_sql_protect.level is not set to an approved value, this is a finding. 2) In all the databases that are to be monitored with EDB SQL/Protect, execute the following SQL as enterprisedb: \dn If the "sqlprotect" schema is not listed, this is a finding. 3) In all the databases that are to be monitored with EDB SQL/Protect, execute the following SQL as enterprisedb: SELECT * FROM sqlprotect.list_protected_users; If the database and user that handles user input is not listed or the remaining settings are not set to approved values, this is a finding.
Revise and deploy the source code for database program objects (stored procedures, functions, triggers) and application source code, to implement the documented behavior. To enable EDB Auditing, execute the following SQL statements as the enterprisedb user: ALTER SYSTEM SET edb_audit = csv; SELECT pg_reload_conf(); or ALTER SYSTEM SET edb_audit = xml; SELECT pg_reload_conf(); To configure the edb_audit_statement parameter, execute the following SQL statements as the enterprisedb user: ALTER SYSTEM SET edb_audit_statement = 'all'; SELECT pg_reload_conf(); or Update the system documentation to note the organizationally approved setting and corresponding justification of the setting for this requirement. If EDB SQL/Protect is being used to monitor and protect the EDB Postgres Advanced Server database from unexpected or unauthorized actions performed on database tables, install and configure SQL/Protect as documented in section "Protecting Against SQL Injection Attacks" in the EDB Postgres Advanced Server Guide available at the following link: https://www.enterprisedb.com/edb-docs/p/edb-postgres-advanced-server
Obtain evidence that software patches are obtained from EnterpriseDB and are consistently applied to the DBMS within the timeframe defined for each patch. If such evidence cannot be obtained, or the evidence that is obtained indicates a pattern of noncompliance, this is a finding. To check which version of EDB Postgres Advanced Server is installed, execute the following SQL statement: SELECT version(); If the version returned by the above query is at a lower version level than required, this is a finding. If an administrator is not registered on the EDB Support Portal with an email address for monitoring technical alerts, this is a finding.
Institute and adhere to policies and procedures to ensure that patches are consistently obtained from EnterpriseDB and applied to the DBMS within the time allowed. Ensure that a monitored email address is registered as a user on the EDB support portal and is receiving technical alerts.
Execute the following SQL as enterprisedb: SHOW edb_audit_connect; If the result is not "all" or if the current setting for this requirement has not been noted and approved by the organization in the system documentation, this is a finding.
Execute the following SQL as enterprisedb: ALTER SYSTEM SET edb_audit_connect = 'all'; SELECT pg_reload_conf(); or Update the system documentation to note the organizationally approved setting and corresponding justification of the setting for this requirement.
Execute the following SQL as enterprisedb: SHOW edb_audit_connect; If the result is not "all" or if the current setting for this requirement has not been noted and approved by the organization in the system documentation, this is a finding. Execute the following SQL as enterprisedb: SHOW edb_audit_disconnect; If the result is not "all" or if the current setting for this requirement has not been noted and approved by the organization in the system documentation, this is a finding.
Execute the following SQL as enterprisedb: ALTER SYSTEM SET edb_audit_connect = 'all'; ALTER SYSTEM SET edb_audit_disconnect = 'all'; SELECT pg_reload_conf(); or Update the system documentation to note the organizationally approved setting and corresponding justification of the setting for this requirement.
Execute the following SQL as enterprisedb: SHOW edb_audit_statement; SHOW edb_audit_connect; SHOW edb_audit_disconnect; If the result is not "all" for any or if the current settings for this requirement have not been noted and approved by the organization in the system documentation, this is a finding.
Execute the following SQL as enterprisedb: ALTER SYSTEM SET edb_audit_statement = 'all'; ALTER SYSTEM SET edb_audit_connect = 'all'; ALTER SYSTEM SET edb_audit_disconnect = 'all'; SELECT pg_reload_conf(); or Update the system documentation to note the organizationally approved setting and corresponding justification of the setting for this requirement.
If any uncommented lines in <postgresql data dir>\pg_hba.conf do not start with "hostssl", this is a finding. The "ssleay32_dll" and "libeay32.dll" files in <EDB Postgres Advanced Server Home>\bin should be FIPS 140-2 compliant DLLs from EnterpriseDB. These are included in EDB Postgres Advanced Server v11 update 6 (i.e., 11.6) and greater. If the installed EDB v11 is not update 11.6 or greater, this is a finding. If C:\usr\local\ssl\openssl.cnf does not exist with these contents, or if an System Environment variable called OPENSSL_CONF pointing to a file with these contents has not been created, this is a finding: HOME = . RANDFILE = $ENV::HOME/.rnd openssl_conf=openssl_conf_section [openssl_conf_section] alg_section=evp_settings [evp_settings] fips_mode=yes
Edit <postgresql data dir>\pg_hba.conf so that each uncommented line starts with "hostssl". If the EDB Postgres Advanced Server minor version is less than version 11.6, install the 11.6 update or later version or contact EnterpriseDB to obtain a copy of the FIPS 140-2 compliant versions of the "ssleay32.dll" and "libeay32.dll" files and replace the "ssleay32.dll" and "libeay32.dll" files in <EDB Postgres Advanced Server Home>\bin with FIPS 140-2 compliant DLLs from EnterpriseDB. If the EDB Postgres Advanced Server minor version is 11.6 or greater, the FIPS 140-2 compliant versions of these DLLs are installed by default and do not need to be replaced. Create C:\usr\local\ssl\openssl.cnf or another file referenced by a System Environment variable called OPENSSL_CONF with these contents: HOME = . RANDFILE = $ENV::HOME/.rnd openssl_conf=openssl_conf_section [openssl_conf_section] alg_section=evp_settings [evp_settings] fips_mode=yes Restart the Postgres server via the Services administration GUI.
If Postgres Enterprise Manager (PEM) or another log collection tool is not installed and configured to automatically collect audit logs or if or a process for off-loading audit logs to a centralized system is not in place, this is a finding. Review the system documentation for a description of how audit records are off-loaded and how local audit log space is managed.
Install a centralized log-collecting tool and configure it as instructed in its documentation. If using PEM, find the instructions for configuring the centralized audit manager at: https://www.enterprisedb.com/docs/en/7.0/pemgetstarted/toc.html
Review the DBMS documentation and configuration to determine if the DBMS is configured in accordance with DoD security configuration and implementation guidance, including STIGs, NSA configuration guides, CTOs, and DTMs and IAVMs. If the DBMS is not configured in accordance with security configuration settings, this is a finding.
Configure EDB Postgres Advanced Server in accordance with DoD security configuration and implementation guidance, including STIGs, NSA configuration guides, CTOs, and DTMs, and IAVMs.
If any uncommented lines in <postgresql data dir>\pg_hba.conf do not start with "hostssl", this is a finding. The "ssleay32_dll" and "libeay32.dll" files in <EDB Postgres Advanced Server Home>\bin should be FIPS 140-2 or 140-3 compliant DLLs from EnterpriseDB. These are included in EDB Postgres Advanced Server v11 update 6 (i.e., 11.6) and greater. If the installed EDB v11 is not update 11.6 or greater, this is a finding. If C:\usr\local\ssl\openssl.cnf does not exist with these contents, or if an System Environment variable called OPENSSL_CONF pointing to a file with these contents has not been created, this is a finding: HOME = . RANDFILE = $ENV::HOME/.rnd openssl_conf=openssl_conf_section [openssl_conf_section] alg_section=evp_settings [evp_settings] fips_mode=yes
Edit <postgresql data dir>\pg_hba.conf so that each uncommented line starts with "hostssl" If the EDB Postgres Advanced Server minor version is less than version 11.6, install the 11.6 update or later version or contact EnterpriseDB to obtain a copy of the FIPS 140 compliant versions of the "ssleay32.dll" and "libeay32.dll" files and replace the "ssleay32.dll" and "libeay32.dll" files in <EDB Postgres Advanced Server Home>\bin with FIPS 140 compliant DLLs from EnterpriseDB. If the EDB Postgres Advanced Server minor version is 11.6 or greater, the FIPS 140 compliant versions of these DLLs are installed by default and do not need to be replaced. Create C:\usr\local\ssl\openssl.cnf or another file referenced by a System Environment variable called OPENSSL_CONF with these contents: HOME = . RANDFILE = $ENV::HOME/.rnd openssl_conf=openssl_conf_section [openssl_conf_section] alg_section=evp_settings [evp_settings] fips_mode=yes Restart the Postgres server via the Services administration GUI.
Enterprise Postgres Advanced Server v11 on Windows is no longer supported by the vendor. If the system is running Enterprise Postgres Advanced Server v11 on Windows, this is a finding.
Remove or decommission all unsupported software products. Upgrade unsupported DBMS or unsupported components to a supported version of the product.