Crunchy Data Postgres 16 Security Technical Implementation Guide

  • Version/Release: V1R1
  • Published: 2024-06-17
  • Released: 2024-06-13
  • Expand All:
  • Severity:
  • Sort:
Compare

Select any two versions of this STIG to compare the individual requirements

View

Select any old version/release of this STIG to view the previous requirements

This Security Technical Implementation Guide is published as a tool to improve the security of Department of Defense (DOD) information systems. The requirements are derived from the National Institute of Standards and Technology (NIST) 800-53 and related documents. Comments or proposed revisions to this document should be sent via email to the following address: disa.stig_spt@mail.mil.
b
PostgreSQL must limit the number of concurrent sessions to an organization-defined number per user for all accounts and/or account types.
AC-10 - Medium - CCI-000054 - V-261857 - SV-261857r1000976_rule
RMF Control
AC-10
Severity
Medium
CCI
CCI-000054
Version
CD16-00-000100
Vuln IDs
  • V-261857
Rule IDs
  • SV-261857r1000976_rule
Database management includes the ability to control the number of users and user sessions using PostgreSQL. Unlimited concurrent connections to PostgreSQL could allow a successful denial-of-service (DoS) attack by exhausting connection resources; and a system can also fail or be degraded by an overload of legitimate users. Limiting the number of concurrent sessions per user is helpful in reducing these risks. This requirement addresses concurrent session control for a single account. It does not address concurrent sessions by a single user via multiple system accounts; and it does not deal with the total number of sessions across all accounts. The capability to limit the number of concurrent sessions per user must be configured in or added to PostgreSQL (for example, by use of a log on trigger), when this is technically feasible. Note that it is not sufficient to limit sessions via a web server or application server alone, because legitimate users and adversaries can potentially connect to PostgreSQL by other means. The organization will need to define the maximum number of concurrent sessions by account type, by account, or a combination thereof. In deciding on the appropriate number, it is important to consider the work requirements of the various types of users. For example, two might be an acceptable limit for general users accessing the database via an application; but 10 might be too few for a database administrator using a database management GUI tool, where each query tab and navigation pane may count as a separate session. (Sessions may also be referred to as connections or logons, which for the purposes of this requirement are synonyms).
Checks: C-65711r1000976_chk

To check the total amount of connections allowed by the database, as the database administrator, run the following SQL: $ sudo su - postgres $ psql -c "SHOW max_connections" If the total amount of connections is greater than documented by an organization, this is a finding. To check the amount of connections allowed for each role, as the database administrator, run the following SQL: $ sudo su - postgres $ psql -c "SELECT rolname, rolconnlimit FROM pg_roles WHERE rolname NOT IN ( 'pg_database_owner', 'pg_read_all_data', 'pg_write_all_data', 'pg_monitor', 'pg_read_all_settings', 'pg_read_all_stats', 'pg_stat_scan_tables', 'pg_read_server_files', 'pg_write_server_files', 'pg_execute_server_program', 'pg_signal_backend', 'pg_checkpoint', 'pg_use_reserved_connections', 'pg_create_subscription');" If any roles have more connections configured than documented, this is a finding. A value of "-1" indicates Unlimited and is a finding.

Fix: F-65619r1000575_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To configure the maximum amount of connections allowed to the database, as the database administrator (shown here as "postgres") change the following in postgresql.conf (the value 10 is an example; set the value to suit local conditions): $ sudo su - postgres  $ vi ${PGDATA?}/postgresql.conf  max_connections = 10  Restart the database: $ sudo systemctl restart postgresql-${PGVER?} To limit the amount of connections allowed by a specific role, as the database administrator, run the following SQL:  $ psql -c "ALTER ROLE <rolname> CONNECTION LIMIT 1";

c
PostgreSQL must integrate with an organization-level authentication/access mechanism providing account management and automation for all users, groups, roles, and any other principals.
AC-2 - High - CCI-000015 - V-261858 - SV-261858r1000953_rule
RMF Control
AC-2
Severity
High
CCI
CCI-000015
Version
CD16-00-000200
Vuln IDs
  • V-261858
Rule IDs
  • SV-261858r1000953_rule
Enterprise environments make account management for applications and databases challenging and complex. A manual process for account management functions adds the risk of a potential oversight or other error. Managing accounts for the same person in multiple places is inefficient and prone to problems with consistency and synchronization. A comprehensive application account management process that includes automation helps to ensure that accounts designated as requiring attention are consistently and promptly addressed. Examples include, but are not limited to, using automation to take action on multiple accounts designated as inactive, suspended, or terminated, or by disabling accounts located in noncentralized account stores, such as multiple servers. Account management functions can also include assignment of group or role membership; identifying account type; specifying user access authorizations (i.e., privileges); account removal, update, or termination; and administrative alerts. The use of automated mechanisms can include, for example, using email or text messaging to notify account managers when users are terminated or transferred; using the information system to monitor account usage; and using automated telephone notification to report atypical system account usage. PostgreSQL must be configured to automatically use organization-level account management functions, and these functions must immediately enforce the organization's current account policy. Automation may comprise differing technologies that when placed together contain an overall mechanism supporting an organization's automated account management requirements.
Checks: C-65712r1000577_chk

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. If all accounts are authenticated by the organization-level authentication/access mechanism, such as LDAP or Kerberos and not by PostgreSQL, this is not a finding. As the database administrator (shown here as "postgres"), review pg_hba.conf authentication file settings: $ sudo su - postgres $ cat ${PGDATA?}/pg_hba.conf All records must use an auth-method of gss, sspi, ldap, or cert. For details on the specifics of these authentication methods refer to: http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html. If there are any records with a different auth-method than gss, sspi, ldap, or cert, review the system documentation for justification and approval of these records. If there are any records with a different auth-method than gss, sspi, ldap, or cert, that are not documented and approved, this is a finding.

Fix: F-65620r1000578_fix

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. Integrate PostgreSQL security with an organization-level authentication/access mechanism providing account management for all users, groups, roles, and any other principals. As the database administrator (shown here as "postgres"), edit pg_hba.conf authentication file: $ sudo su - postgres $ vi ${PGDATA?}/pg_hba.conf For each PostgreSQL-managed account that is not documented and approved, either transfer it to management by the external mechanism, or document the need for it and obtain approval, as appropriate.

c
PostgreSQL must enforce approved authorizations for logical access to information and system resources in accordance with applicable access control policies.
AC-3 - High - CCI-000213 - V-261859 - SV-261859r1000582_rule
RMF Control
AC-3
Severity
High
CCI
CCI-000213
Version
CD16-00-000300
Vuln IDs
  • V-261859
Rule IDs
  • SV-261859r1000582_rule
Authentication with a DOD-approved PKI certificate does not necessarily imply authorization to access PostgreSQL. To mitigate the risk of unauthorized access to sensitive information by entities that have been issued certificates by DOD-approved PKIs, all DOD systems, including databases, must be properly configured to implement access control policies. Successful authentication must not automatically give an entity access to an asset or security boundary. Authorization procedures and controls must be implemented to ensure each authenticated entity also has a validated and current authorization. Authorization is the process of determining whether an entity, once authenticated, is permitted to access a specific asset. Information systems use access control policies and enforcement mechanisms to implement this requirement. Access control policies include identity-based policies, role-based policies, and attribute-based policies. Access enforcement mechanisms include access control lists, access control matrices, and cryptography. These policies and mechanisms must be employed by the application to control access between users (or processes acting on behalf of users) and objects (e.g., devices, files, records, processes, programs, and domains) in the information system. This requirement is applicable to access control enforcement applications, a category that includes database management systems. If PostgreSQL does not follow applicable policy when approving access, it may be in conflict with networks or other applications in the information system. This may result in users either gaining or being denied access inappropriately and in conflict with applicable policy.
Checks: C-65713r1000580_chk

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. From the system security plan or equivalent documentation, determine the appropriate permissions on database objects for each kind (group role) of user. If this documentation is missing, this is a finding. As the database administrator (shown here as "postgres"), check the privileges of all roles in the database by running the following SQL: $ sudo su - postgres $ psql -c '\du' Review all roles and their associated privileges. If any roles' privileges exceed those documented, this is a finding. As the database administrator (shown here as "postgres"), check the configured privileges for tables and columns by running the following SQL: $ sudo su - postgres $ psql -c '\dp' Review all access privileges and column access privileges list. If any roles' privileges exceed those documented, this is a finding. As the database administrator (shown here as "postgres"), check the configured authentication settings in pg_hba.conf: $ sudo su - postgres $ cat ${PGDATA?}/pg_hba.conf Review all entries and their associated authentication methods. If any entries do not have their documented authentication requirements, this is a finding.

Fix: F-65621r1000581_fix

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. Create and/or maintain documentation of each group role's appropriate permissions on database objects. Implement these permissions in the database and remove any permissions that exceed those documented. The following are examples of how to use role privileges in PostgreSQL to enforce access controls. For a complete list of privileges, refer to the official documentation: https://www.postgresql.org/docs/current/static/sql-createrole.html. #### Roles Example 1 The following example demonstrates how to create an admin role with CREATEDB and CREATEROLE privileges. As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "CREATE ROLE admin WITH CREATEDB CREATEROLE" #### Roles Example 2 The following example demonstrates how to create a role with a password that expires and makes the role a member of the "admin" group. As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "CREATE ROLE joe LOGIN ENCRYPTED PASSWORD 'stig_2024' VALID UNTIL '2024-09-20' IN ROLE admin" #### Roles Example 3 The following demonstrates how to revoke privileges from a role using REVOKE. As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "REVOKE admin FROM joe" #### Roles Example 4 The following demonstrates how to alter privileges in a role using ALTER. As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "ALTER ROLE joe NOLOGIN" The following are examples of how to use grant privileges in PostgreSQL to enforce access controls on objects. For a complete list of privileges, refer to the official documentation: https://www.postgresql.org/docs/current/static/sql-grant.html. #### Grant Example 1 The following example demonstrates how to grant INSERT on a table to a role. As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "GRANT SELECT ON stig_test TO joe" #### Grant Example 2 The following example demonstrates how to grant ALL PRIVILEGES on a table to a role. As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "GRANT ALL PRIVILEGES ON stig_test TO joe" #### Grant Example 3 The following example demonstrates how to grant a role to a role. As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "GRANT admin TO joe" #### Revoke Example 1 The following example demonstrates how to revoke access from a role. As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "REVOKE admin FROM joe" To change authentication requirements for the database, as the database administrator (shown here as "postgres"), edit pg_hba.conf: $ sudo su - postgres $ vi ${PGDATA?}/pg_hba.conf Edit authentication requirements to the organizational requirements. Refer to the official documentation for the complete list of options for authentication: http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html. After changes to pg_hba.conf, reload the server: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must protect against a user falsely repudiating having performed organization-defined actions.
AU-10 - Medium - CCI-000166 - V-261860 - SV-261860r1000977_rule
RMF Control
AU-10
Severity
Medium
CCI
CCI-000166
Version
CD16-00-000400
Vuln IDs
  • V-261860
Rule IDs
  • SV-261860r1000977_rule
Nonrepudiation of actions taken is required to maintain data integrity. Examples of particular actions taken by individuals include creating information, sending a message, approving information (e.g., indicating concurrence or signing a contract), and receiving a message. Nonrepudiation protects against later claims by a user of not having created, modified, or deleted a particular data item or collection of data in the database. In designing a database, the organization must define the types of data and the user actions that must be protected from repudiation. The implementation must then include building audit features into the application data tables and configuring PostgreSQL audit tools to capture the necessary audit trail. Design and implementation must ensure that applications pass individual user identification to PostgreSQL, even where the application connects to PostgreSQL with a standard, shared account.
Checks: C-65714r1000583_chk

As the database administrator, review the current log_line_prefix settings by running the following SQL:  $ sudo su - postgres  $ psql -c "SHOW log_line_prefix"  If log_line_prefix does not contain at least '&lt; %m %a %u %d %r %p &gt;', this is a finding.  Review the current shared_preload_libraries settings by running the following SQL:  $ psql -c "SHOW shared_preload_libraries"  If shared_preload_libraries does not contain "pgaudit", this is a finding.

Fix: F-65622r1000584_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. Configure the database to supply additional auditing information to protect against a user falsely repudiating having performed organization-defined actions.  Using "pgaudit", PostgreSQL can be configured to audit these requests. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit.  To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging.  Modify the configuration of audit logs to include details identifying the individual user:  As the database administrator (shown here as "postgres"), edit postgresql.conf:  $ sudo su - postgres  $ vi ${PGDATA?}/postgresql.conf  Extra parameters can be added to the setting log_line_prefix to identify the user:  log_line_prefix = '< %m %a %u %d %r %p >'  As the system administrator, reload the server with the new configuration:  $ sudo systemctl reload postgresql-${PGVER?} Use accounts assigned to individual users. Where the application connects to PostgreSQL using a standard, shared account, ensure it also captures the individual user identification and passes it to PostgreSQL.

b
PostgreSQL must provide audit record generation capability for DOD-defined auditable events within all DBMS/database components.
AU-12 - Medium - CCI-000169 - V-261861 - SV-261861r1000588_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000169
Version
CD16-00-000500
Vuln IDs
  • V-261861
Rule IDs
  • SV-261861r1000588_rule
Without the capability to generate audit records, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within PostgreSQL (e.g., process, module). Certain specific application functionalities may be audited as well. The list of audited events is the set of events for which audits are to be generated. This set of events is typically a subset of the list of all events for which the system is capable of generating audit records. DOD has defined the list of events for which PostgreSQL will provide an audit record generation capability as the following: (i) Successful and unsuccessful attempts to access, modify, or delete privileges, security objects, security levels, or categories of information (e.g., classification levels); (ii) Access actions, such as successful and unsuccessful logon attempts, privileged activities, or other system-level access, starting and ending time for user access to the system, concurrent logons from different workstations, successful and unsuccessful accesses to objects, all program initiations, and all direct access to the information system; and (iii) All account creation, modification, disabling, and termination actions. Organizations may define additional events requiring continuous or ad hoc auditing.
Checks: C-65715r1000586_chk

Note: The following instructions use the PGLOG environment variables. Refer to supplementary content APPENDIX-I for instructions on configuring PGVER. Check PostgreSQL audit logs to determine whether organization-defined auditable events are being audited by the system. For example, if the organization defines 'CREATE TABLE' as an auditable event, issuing the following command should return a result: $ sudo su - postgres $ psql -c "CREATE TABLE example (id int)" $ grep 'AUDIT:.*,CREATE TABLE.*example' ${PGLOG?}/&lt;latest_log&gt; $ psql -c 'DROP TABLE example;' If organization-defined auditable events are not being audited, this is a finding.

Fix: F-65623r1000587_fix

Configure PostgreSQL to generate audit records for at least the DOD minimum set of events. Using "pgaudit", PostgreSQL can be configured to audit these requests. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C.

b
PostgreSQL must allow only the information system security manager (ISSM), or individuals or roles appointed by the ISSM, to select which events are to be audited.
AU-12 - Medium - CCI-000171 - V-261862 - SV-261862r1000591_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000171
Version
CD16-00-000600
Vuln IDs
  • V-261862
Rule IDs
  • SV-261862r1000591_rule
Without the capability to restrict which roles and individuals can select which events are audited, unauthorized personnel may be able to prevent or interfere with the auditing of critical events. Suppression of auditing could permit an adversary to evade detection. Misconfigured audits can degrade the system's performance by overwhelming the audit log. Misconfigured audits may also make it more difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one.
Checks: C-65716r1000589_chk

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. Check PostgreSQL settings and documentation to determine whether designated personnel are able to select which auditable events are being audited. As the database administrator (shown here as "postgres"), verify the permissions for PGDATA: $ ls -la ${PGDATA?} If anything in PGDATA is not owned by the database administrator, this is a finding. As the database administrator, run the following SQL: $ sudo su - postgres $ psql -c "\du" Review the role permissions, if any role is listed as superuser but should not have that access, this is a finding.

Fix: F-65624r1000590_fix

Configure PostgreSQL's settings to allow designated personnel to select which auditable events are audited. Using pgaudit allows administrators the flexibility to choose what they log. For an overview of the capabilities of pgaudit, refer to https://github.com/pgaudit/pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. Refer to supplementary content APPENDIX-C for instructions on enabling logging. Only administrators/superuser can change PostgreSQL configurations. Access to the database administrator must be limited to designated personnel only. To ensure that postgresql.conf is owned by the database owner: $ chown postgres:postgres ${PGDATA?}/postgresql.conf $ chmod 600 ${PGDATA?}/postgresql.conf

b
PostgreSQL must be able to generate audit records when privileges/permissions are retrieved.
AU-12 - Medium - CCI-000172 - V-261863 - SV-261863r1000954_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-000700
Vuln IDs
  • V-261863
Rule IDs
  • SV-261863r1000954_rule
Under some circumstances, it may be useful to monitor who/what is reading privilege/permission/role information. Therefore, it must be possible to configure auditing to do this. PostgreSQLs typically make such information available through views or functions. This requirement addresses explicit requests for privilege/permission/role membership information. It does not refer to the implicit retrieval of privileges/permissions/role memberships that PostgreSQL continually performs to determine if any and every action on the database is permitted.
Checks: C-65717r1000592_chk

Note: The following instructions use the PGLOG environment variable. Refer to supplementary content APPENDIX-I for instructions on configuring PGLOG. As the database administrator (shown here as "postgres"), check if pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If pgaudit is not found in the results, this is a finding. As the database administrator (shown here as "postgres"), list all role memberships for the database: $ sudo su - postgres $ psql -c "\du" Verify the query was logged: $ sudo su - postgres $ cat ${PGLOG?}/&lt;latest_log&gt; This should, as an example, return (among other rows): &lt; 2024-02-01 19:13:38.276 UTC psql postgres postgres [local] 15639 &gt;LOG: duration: 29.932 ms statement: SELECT r.rolname, r.rolsuper, r.rolinherit, r.rolcreaterole, r.rolcreatedb, r.rolcanlogin, r.rolconnlimit, r.rolvaliduntil , r.rolreplication , r.rolbypassrls FROM pg_catalog.pg_roles r WHERE r.rolname !~ '^pg_' ORDER BY 1; If audit records are not produced, this is a finding.

Fix: F-65625r1000954_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. PostgreSQL can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters):  pgaudit.log_catalog = 'on' pgaudit.log = 'read' Note: For this requirement the pgaudit.log must contain 'read' however APPENDIX-C suggests setting pgaudit.log='ddl, role, read, write' to fulfill all requirements. As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to retrieve privileges/permissions occur.
AU-12 - Medium - CCI-000172 - V-261864 - SV-261864r1000597_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-000800
Vuln IDs
  • V-261864
Rule IDs
  • SV-261864r1000597_rule
Under some circumstances, it may be useful to monitor who/what is reading privilege/permission/role information. Therefore, it must be possible to configure auditing to do this. PostgreSQLs typically make such information available through views or functions. This requirement addresses explicit requests for privilege/permission/role membership information. It does not refer to the implicit retrieval of privileges/permissions/role memberships that PostgreSQL continually performs to determine if any and every action on the database is permitted. To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.
Checks: C-65718r1000595_chk

Note: The following instructions use the PGLOG environment variables. Refer to supplementary content APPENDIX-I for instructions on configuring PGLOG. As the database administrator (shown here as "postgres"), create a role "bob" by running the following SQL: $ sudo su - postgres $ psql -c "CREATE ROLE bob" Attempt to retrieve information from the pg_authid table: $ psql -c "SET ROLE bob; SELECT * FROM pg_authid" $ psql -c "DROP ROLE bob;" As the database administrator (shown here as "postgres"), verify the event was logged in PGLOG: $ sudo su - postgres $ cat ${PGLOG?}/&lt;latest_log&gt; &lt; 2024-02-13 16:49:58.864 UTC postgres postgres ERROR: &gt; permission denied for relation pg_authid &lt; 2024-02-13 16:49:58.864 UTC postgres postgres STATEMENT: &gt; SELECT * FROM pg_authid If the above steps cannot verify that audit records are produced when PostgreSQL denies retrieval of privileges/permissions/role memberships, this is a finding.

Fix: F-65626r1000596_fix

Configure PostgreSQL to produce audit records when unsuccessful attempts to access privileges occur. All denials are logged if logging is enabled. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C.

b
PostgreSQL must initiate session auditing upon startup.
AU-14 - Medium - CCI-001464 - V-261865 - SV-261865r1000600_rule
RMF Control
AU-14
Severity
Medium
CCI
CCI-001464
Version
CD16-00-000900
Vuln IDs
  • V-261865
Rule IDs
  • SV-261865r1000600_rule
Session auditing is for use when a user's activities are under investigation. To ensure the capture of all activity during those periods when session auditing is in use, it needs to be in operation for the whole time PostgreSQL is running.
Checks: C-65719r1000598_chk

As the database administrator (shown here as "postgres"), check the current settings by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If pgaudit is not in the current setting, this is a finding. As the database administrator (shown here as "postgres"), check the current settings by running the following SQL: $ psql -c "SHOW log_destination" If stderr or syslog are not in the current setting, this is a finding.

Fix: F-65627r1000599_fix

Configure PostgreSQL to enable auditing. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging. For session logging, using pgaudit is recommended. For instructions on how to setup pgaudit, refer to supplementary content APPENDIX-B.

b
PostgreSQL must produce audit records containing sufficient information to establish what type of events occurred.
AU-3 - Medium - CCI-000130 - V-261866 - SV-261866r1000603_rule
RMF Control
AU-3
Severity
Medium
CCI
CCI-000130
Version
CD16-00-001000
Vuln IDs
  • V-261866
Rule IDs
  • SV-261866r1000603_rule
Information system auditing capability is critical for accurate forensic analysis. Without establishing what type of event occurred, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit record content that may be necessary to satisfy the requirement of this policy includes, for example, time stamps, user/process identifiers, event descriptions, success/fail indications, filenames involved, and access control or flow control rules invoked. Associating event types with detected events in the application and audit logs provides a means of investigating an attack; recognizing resource utilization or capacity thresholds; or identifying an improperly configured application. PostgreSQL is capable of a range of actions on data stored within the database. It is important, for accurate forensic analysis, to know exactly what actions were performed. This requires specific information regarding the event type an audit record is referring to. If event type information is not recorded and stored with the audit record, the record itself is of very limited use.
Checks: C-65720r1000601_chk

As the database administrator (shown here as "postgres"), verify the current log_line_prefix setting: $ sudo su - postgres $ psql -c "SHOW log_line_prefix" Verify that the current settings are appropriate for the organization. The following is what is possible for logged information: # %a = application name # %u = user name # %d = database name # %r = remote host and port # %h = remote host # %p = process ID # %t = timestamp without milliseconds # %m = timestamp with milliseconds # %i = command tag # %e = SQL state # %c = session ID # %l = session line number # %s = session start timestamp # %v = virtual transaction ID # %x = transaction ID (0 if none) # %q = stop here in non-session processes If the audit record does not log events required by the organization, this is a finding. Verify the current settings of log_connections and log_disconnections by running the following SQL: $ psql -c "SHOW log_connections" $ psql -c "SHOW log_disconnections" If either setting is off, this is a finding.

Fix: F-65628r1000602_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C.  If logging is enabled the following configurations must be made to log connections, date/time, username and session identifier. Edit the postgresql.conf file as a privileged user: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Edit the following parameters based on the organization's needs (minimum requirements are as follows): log_connections = on log_disconnections = on log_line_prefix = '< %m %u %d %c: >' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must produce audit records containing time stamps to establish when the events occurred.
AU-3 - Medium - CCI-000131 - V-261867 - SV-261867r1000955_rule
RMF Control
AU-3
Severity
Medium
CCI
CCI-000131
Version
CD16-00-001100
Vuln IDs
  • V-261867
Rule IDs
  • SV-261867r1000955_rule
Information system auditing capability is critical for accurate forensic analysis. Without establishing when events occurred, it is impossible to establish, correlate, and investigate the events relating to an incident. To compile an accurate risk assessment and provide forensic analysis, it is essential for security personnel to know the date and time when events occurred. Associating the date and time with detected events in the application and audit logs provides a means of investigating an attack; recognizing resource utilization or capacity thresholds; or identifying an improperly configured application. PostgreSQL is capable of a range of actions on data stored within the database. It is important, for accurate forensic analysis, to know exactly when specific actions were performed. This requires the date and time an audit record is referring to. If date and time information is not recorded and stored with the audit record, the record itself is of very limited use.
Checks: C-65721r1000604_chk

As the database administrator (usually postgres), run the following SQL: $ sudo su - postgres $ psql -c "SHOW log_line_prefix" If the query result does not contain "%m", this is a finding.

Fix: F-65629r1000605_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. Logging must be enabled to capture timestamps. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. If logging is enabled, the following configurations must be made to log events with timestamps: As the database administrator (shown here as "postgres"), edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add %m to log_line_prefix to enable timestamps with milliseconds: log_line_prefix = '< %m >' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must produce audit records containing sufficient information to establish where the events occurred.
AU-3 - Medium - CCI-000132 - V-261868 - SV-261868r1000609_rule
RMF Control
AU-3
Severity
Medium
CCI
CCI-000132
Version
CD16-00-001200
Vuln IDs
  • V-261868
Rule IDs
  • SV-261868r1000609_rule
Information system auditing capability is critical for accurate forensic analysis. Without establishing where events occurred, it is impossible to establish, correlate, and investigate the events relating to an incident. In order to compile an accurate risk assessment and provide forensic analysis, it is essential for security personnel to know where events occurred, such as application components, modules, session identifiers, filenames, host names, and functionality. Associating information about where the event occurred within the application provides a means of investigating an attack; recognizing resource utilization or capacity thresholds; or identifying an improperly configured application.
Checks: C-65722r1000607_chk

As the database administrator (shown here as "postgres"), check the current log_line_prefix setting by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_line_prefix" If log_line_prefix does not contain "%m %u %d %s", this is a finding.

Fix: F-65630r1000608_fix

$ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Extra parameters can be added to the setting log_line_prefix to log application related information: # %a = application name # %u = user name # %d = database name # %r = remote host and port # %p = process ID # %m = timestamp with milliseconds # %i = command tag # %s = session startup # %e = SQL state For example: log_line_prefix = '< %m %a %u %d %r %p %i %e %s>' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must produce audit records containing sufficient information to establish the sources (origins) of the events.
AU-3 - Medium - CCI-000133 - V-261869 - SV-261869r1000956_rule
RMF Control
AU-3
Severity
Medium
CCI
CCI-000133
Version
CD16-00-001300
Vuln IDs
  • V-261869
Rule IDs
  • SV-261869r1000956_rule
Information system auditing capability is critical for accurate forensic analysis. Without establishing the source of the event, it is impossible to establish, correlate, and investigate the events relating to an incident. To compile an accurate risk assessment and provide forensic analysis, it is essential for security personnel to know where events occurred, such as application components, modules, session identifiers, filenames, host names, and functionality. In addition to logging where events occur within the application, the application must also produce audit records that identify the application itself as the source of the event. Associating information about the source of the event within the application provides a means of investigating an attack; recognizing resource utilization or capacity thresholds; or identifying an improperly configured application.
Checks: C-65723r1000610_chk

Check PostgreSQL settings and existing audit records to verify information specific to the source (origin) of the event is being captured and stored with audit records. As the database administrator (usually postgres) check the current log_line_prefix and log_hostname setting by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_line_prefix" $ psql -c "SHOW log_hostname" For a complete list of extra information that can be added to log_line_prefix, refer to the official documentation: https://www.postgresql.org/docs/current/static/runtime-config-logging.html#GUC-LOG-LINE-PREFIX. If the current settings do not provide enough information regarding the source of the event, this is a finding.

Fix: F-65631r1000611_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging. If logging is enabled, the following configurations can be made to log the source of an event. As the database administrator, edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf ###### Log Line Prefix Extra parameters can be added to the setting log_line_prefix to log source of event: # %a = application name # %u = user name # %d = database name # %r = remote host and port # %p = process ID # %m = timestamp with milliseconds For example: log_line_prefix = '< %m %a %u %d %r %p %m >' ###### Log Hostname By default, only IP address is logged. To also log the hostname, the following parameter can also be set in postgresql.conf: log_hostname = on As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must produce audit records containing sufficient information to establish the outcome (success or failure) of the events.
AU-3 - Medium - CCI-000134 - V-261870 - SV-261870r1000615_rule
RMF Control
AU-3
Severity
Medium
CCI
CCI-000134
Version
CD16-00-001400
Vuln IDs
  • V-261870
Rule IDs
  • SV-261870r1000615_rule
Information system auditing capability is critical for accurate forensic analysis. Without information about the outcome of events, security personnel cannot make an accurate assessment as to whether an attack was successful or if changes were made to the security state of the system. Event outcomes can include indicators of event success or failure and event-specific results (e.g., the security state of the information system after the event occurred). As such, they also provide a means to measure the impact of an event and help authorized personnel to determine the appropriate response.
Checks: C-65724r1000613_chk

Note: The following instructions use the PGLOG environment variables. Refer to supplementary content APPENDIX-I for instructions on configuring them. As a database administrator (shown here as "postgres"), create a table, insert a value, alter the table and update the table by running the following SQL: CREATE TABLE stig_test(id INT); INSERT INTO stig_test(id) VALUES (0); ALTER TABLE stig_test ADD COLUMN name text; UPDATE stig_test SET id = 1 WHERE id = 0; As a user without access to the stig_test table, run the following SQL: INSERT INTO stig_test(id) VALUES (1); ALTER TABLE stig_test DROP COLUMN name; UPDATE stig_test SET id = 0 WHERE id = 1; The prior SQL should generate errors: ERROR: permission denied for relation stig_test ERROR: must be owner of relation stig_test ERROR: permission denied for relation stig_test As the database administrator, drop the test table by running the following SQL: DROP TABLE stig_test; Verify the errors were logged: $ sudo su - postgres $ cat ${PGLOG?}/&lt;latest_logfile&gt; &lt; 2024-02-23 14:51:31.103 UTC psql postgres postgres 570bf22a.3af2 2024-04-11 14:51:22 EDT [local] &gt;LOG: AUDIT: SESSION,1,1,DDL,CREATE TABLE,,,CREATE TABLE stig_test(id INT);,&lt;none&gt; &lt; 2024-02-23 14:51:44.835 UTC psql postgres postgres 570bf22a.3af2 2024-04-11 14:51:22 EDT [local] &gt;LOG: AUDIT: SESSION,2,1,WRITE,INSERT,,,INSERT INTO stig_test(id) VALUES (0);,&lt;none&gt; &lt; 2024-02-23 14:53:25.805 UTC psql postgres postgres 570bf22a.3af2 2024-04-11 14:51:22 EDT [local] &gt;LOG: AUDIT: SESSION,3,1,DDL,ALTER TABLE,,,ALTER TABLE stig_test ADD COLUMN name text;,&lt;none&gt; &lt; 2024-02-23 14:53:54.381 UTC psql postgres postgres 570bf22a.3af2 2024-04-11 14:51:22 EDT [local] &gt;LOG: AUDIT: SESSION,4,1,WRITE,UPDATE,,,UPDATE stig_test SET id = 1 WHERE id = 0;,&lt;none&gt; &lt; 2024-02-23 14:54:20.832 UTC psql postgres postgres 570bf22a.3af2 2024-04-11 14:51:22 EDT [local] &gt;ERROR: permission denied for relation stig_test &lt; 2024-02-23 14:54:20.832 UTC psql postgres postgres 570bf22a.3af2 2024-04-11 14:51:22 EDT [local] &gt;STATEMENT: INSERT INTO stig_test(id) VALUES (1); &lt; 2024-02-23 14:54:41.032 UTC psql postgres postgres 570bf22a.3af2 2024-04-11 14:51:22 EDT [local] &gt;ERROR: must be owner of relation stig_test &lt; 2024-02-23 14:54:41.032 UTC psql postgres postgres 570bf22a.3af2 2024-04-11 14:51:22 EDT [local] &gt;STATEMENT: ALTER TABLE stig_test DROP COLUMN name; &lt; 2024-02-23 14:54:54.378 UTC psql postgres postgres 570bf22a.3af2 2024-04-11 14:51:22 EDT [local] &gt;ERROR: permission denied for relation stig_test &lt; 2024-02-23 14:54:54.378 UTC psql postgres postgres 570bf22a.3af2 2024-04-11 14:51:22 EDT [local] &gt;STATEMENT: UPDATE stig_test SET id = 0 WHERE id = 1; &lt; 2024-02-23 14:55:23.723 UTC psql postgres postgres 570bf307.3b0a 2024-04-11 14:55:03 EDT [local] &gt;LOG: AUDIT: SESSION,1,1,DDL,DROP TABLE,,,DROP TABLE stig_test;,&lt;none&gt; If audit records exist without the outcome of the event that occurred, this is a finding.

Fix: F-65632r1000614_fix

Using pgaudit, PostgreSQL can be configured to audit various facets of PostgreSQL. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. All errors, denials, and unsuccessful requests are logged if logging is enabled. Refer to supplementary content APPENDIX-C for documentation on enabling logging. Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. With pgaudit and logging enabled, set the configuration settings in postgresql.conf, as the database administrator (shown here as "postgres"), to the following: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf pgaudit.log_catalog='on' pgaudit.log_level='log' pgaudit.log_parameter='on' pgaudit.log_statement_once='off' pgaudit.log='ddl, role, read, write' Tune the following logging configurations in postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf log_line_prefix = '< %m %u %d %e: >' log_error_verbosity = default As the system administrator, restart PostgreSQL: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must produce audit records containing sufficient information to establish the identity of any user/subject or process associated with the event.
AU-3 - Medium - CCI-001487 - V-261871 - SV-261871r1000618_rule
RMF Control
AU-3
Severity
Medium
CCI
CCI-001487
Version
CD16-00-001500
Vuln IDs
  • V-261871
Rule IDs
  • SV-261871r1000618_rule
Information system auditing capability is critical for accurate forensic analysis. Without information that establishes the identity of the subjects (i.e., users or processes acting on behalf of users) associated with the events, security personnel cannot determine responsibility for the potentially harmful event. Identifiers (if authenticated or otherwise known) include, but are not limited to, user database tables, primary key values, usernames, or process identifiers.
Checks: C-65725r1000616_chk

Check PostgreSQL settings and existing audit records to verify a username associated with the event is being captured and stored with the audit records. If audit records exist without specific user information, this is a finding. As the database administrator (shown here as "postgres"), verify the current setting of log_line_prefix by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_line_prefix" If log_line_prefix does not contain %m, %u, %d, %p, %r, %a, this is a finding.

Fix: F-65633r1000617_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. Logging must be enabled to capture the identity of any user/subject or process associated with an event. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. To enable username, database name, process ID, remote host/port and application name in logging, as the database administrator (shown here as "postgres"), edit the following in postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf log_line_prefix = '< %m %u %d %p %r %a >' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must include additional, more detailed, organization-defined information in the audit records for audit events identified by type, location, or subject.
AU-3 - Medium - CCI-000135 - V-261872 - SV-261872r1000621_rule
RMF Control
AU-3
Severity
Medium
CCI
CCI-000135
Version
CD16-00-001600
Vuln IDs
  • V-261872
Rule IDs
  • SV-261872r1000621_rule
Information system auditing capability is critical for accurate forensic analysis. Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. To support analysis, some types of events will need information to be logged that exceeds the basic requirements of event type, time stamps, location, source, outcome, and user identity. If additional information is not available, it could negatively impact forensic investigations into user actions or other malicious events. The organization must determine what additional information is required for complete analysis of the audited events. The additional information required is dependent on the type of information (e.g., sensitivity of the data and the environment within which it resides). At a minimum, the organization must employ either full-text recording of privileged commands or the individual identities of users of shared accounts, or both. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. Examples of detailed information the organization may require in audit records are full-text recording of privileged commands or the individual identities of shared account users.
Checks: C-65726r1000619_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F and APPENDIX-I for instructions on configuring them. Review the system documentation to identify what additional information the organization has determined necessary. Check PostgreSQL settings by examining ${PGDATA?}/postgresql.conf to ensure additional auditing is configured and then examine existing audit records in ${PGLOG?}/&lt;latest.log&gt; to verify that all organization-defined additional, more detailed information is in the audit records for audit events identified by type, location, or subject after executing SQL commands that fall under the additional audit classes. If any additional information is defined and is not contained in the audit records, this is a finding.

Fix: F-65634r1000620_fix

Configure PostgreSQL audit settings to include all organization-defined detailed information in the audit records for audit events identified by type, location, or subject. Using pgaudit, PostgreSQL can be configured to audit these requests. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C.

b
PostgreSQL must, by default, shut down upon audit failure, to include the unavailability of space for more audit log records; or must be configurable to shut down upon audit failure.
AU-5 - Medium - CCI-000140 - V-261873 - SV-261873r1000624_rule
RMF Control
AU-5
Severity
Medium
CCI
CCI-000140
Version
CD16-00-001700
Vuln IDs
  • V-261873
Rule IDs
  • SV-261873r1000624_rule
It is critical that when the DBMS is at risk of failing to process audit logs as required, it take action to mitigate the failure. Audit processing failures include software/hardware errors; failures in the audit capturing mechanisms; and audit storage capacity being reached or exceeded. Responses to audit failure depend upon the nature of the failure mode. When the need for system availability does not outweigh the need for a complete audit trail, PostgreSQL should shut down immediately, rolling back all in-flight transactions. Systems where audit trail completeness is paramount will most likely be at a lower MAC level than MAC I; the final determination is the prerogative of the application owner, subject to Authorizing Official concurrence. In any case, sufficient auditing resources must be allocated to avoid a shutdown in all but the most extreme situations.
Checks: C-65727r1000622_chk

If the application owner has determined that the need for system availability outweighs the need for a complete audit trail, this is Not Applicable. Review the procedures, either manually and/or automated, for monitoring the space used by audit trail(s) and for offloading 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.

Fix: F-65635r1000623_fix

Modify PostgreSQL, OS, or third-party logging application settings to alert appropriate personnel when a specific percentage of log storage capacity is reached.

b
PostgreSQL must be configurable to overwrite audit log records, oldest first (first-in-first-out [FIFO]), in the event of unavailability of space for more audit log records.
AU-5 - Medium - CCI-000140 - V-261874 - SV-261874r1000627_rule
RMF Control
AU-5
Severity
Medium
CCI
CCI-000140
Version
CD16-00-001800
Vuln IDs
  • V-261874
Rule IDs
  • SV-261874r1000627_rule
It is critical that when PostgreSQL is at risk of failing to process audit logs as required, it take action to mitigate the failure. Audit processing failures include software/hardware errors; failures in the audit capturing mechanisms; and audit storage capacity being reached or exceeded. Responses to audit failure depend upon the nature of the failure mode. When availability is an overriding concern, approved actions in response to an audit failure are as follows: (i) If the failure was caused by the lack of audit record storage capacity, PostgreSQL must continue generating audit records, if possible (automatically restarting the audit service if necessary), overwriting the oldest audit records in a first-in-first-out manner. (ii) If audit records are sent to a centralized collection server and communication with this server is lost or the server fails, PostgreSQL must queue audit records locally until communication is restored or until the audit records are retrieved manually. Upon restoration of the connection to the centralized collection server, action should be taken to synchronize the local audit data with the collection server. Systems where availability is paramount will most likely be MAC I; the final determination is the prerogative of the application owner, subject to Authorizing Official concurrence. In any case, sufficient auditing resources must be allocated to avoid audit data loss in all but the most extreme situations.
Checks: C-65728r1000625_chk

If the Authorizing Official (AO)-approved system documentation states that system availability takes precedence, this requirement is Not Applicable. 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 PostgreSQL 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.

Fix: F-65636r1000626_fix

Establish a process with accompanying tools for monitoring available disk space and ensuring that sufficient disk space is maintained to continue generating audit logs, overwriting the oldest existing records if necessary.

b
The audit information produced by PostgreSQL must be protected from unauthorized read access.
AU-9 - Medium - CCI-000162 - V-261875 - SV-261875r1000630_rule
RMF Control
AU-9
Severity
Medium
CCI
CCI-000162
Version
CD16-00-002000
Vuln IDs
  • V-261875
Rule IDs
  • SV-261875r1000630_rule
If audit data were to become compromised, then competent forensic analysis and discovery of the true source of potentially malicious system activity is difficult, if not impossible, to achieve. In addition, access to audit records provides information an attacker could potentially use to their advantage. To ensure the veracity of audit data, the information system and/or the application must protect audit information from any and all unauthorized access. This includes read, write, copy, etc. This requirement can be achieved through multiple methods which will depend upon system architecture and design. Some commonly employed methods include ensuring log files enjoy the proper file system permissions using file system protections and limiting log data location. Additionally, applications with user interfaces to audit records should not allow for the unfettered manipulation of or access to those records via the application. If the application provides access to the audit data, the application becomes accountable for ensuring that audit information is protected from unauthorized access. Audit information includes all information (e.g., audit records, audit settings, and audit reports) needed to successfully audit information system activity.
Checks: C-65729r1000628_chk

Note: The following instructions use the PGLOG environment variable. Refer to supplementary content APPENDIX-I for instructions on configuring PGLOG. Review locations of audit logs, both internal to the database and database audit logs located at the operating system level. Verify appropriate controls and permissions exist to protect the audit information from unauthorized access. #### syslog Logging If PostgreSQL is configured to use syslog for logging, consult organization location and permissions for syslog log files. #### stderr Logging As the database administrator (shown here as "postgres"), check the current log_file_mode configuration by running the following: Note: Consult the organization's documentation on acceptable log privileges. $ sudo su - postgres $ psql -c "SHOW log_file_mode" If log_file_mode is not 600, this is a finding. Verify the log files have the set permissions in ${PGLOG?}: $ ls -l ${PGLOG?}/ total 32 -rw-------. 1 postgres postgres 0 Apr 8 00:00 postgresql-Fri.log -rw-------. 1 postgres postgres 8288 Apr 11 17:36 postgresql-Mon.log -rw-------. 1 postgres postgres 0 Apr 9 00:00 postgresql-Sat.log -rw-------. 1 postgres postgres 0 Apr 10 00:00 postgresql-Sun.log -rw-------. 1 postgres postgres 16212 Apr 7 17:05 postgresql-Thu.log  -rw-------. 1 postgres postgres 1130 Apr 6 17:56 postgresql-Wed.log  If logs with 600 permissions do not exist in ${PGLOG?}, this is a finding.

Fix: F-65637r1000629_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. #### syslog Logging If PostgreSQL is configured to use syslog for logging, consult organization location and permissions for syslog log files. #### stderr Logging If PostgreSQL is configured to use stderr for logging, permissions of the log files can be set in postgresql.conf. As the database administrator (shown here as "postgres"), edit the following settings of logs in the postgresql.conf file: Note: Consult the organization's documentation on acceptable log privileges. $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf log_file_mode = 0600 As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
The audit information produced by PostgreSQL must be protected from unauthorized modification.
AU-9 - Medium - CCI-000163 - V-261876 - SV-261876r1000978_rule
RMF Control
AU-9
Severity
Medium
CCI
CCI-000163
Version
CD16-00-002100
Vuln IDs
  • V-261876
Rule IDs
  • SV-261876r1000978_rule
If audit data were to become compromised, competent forensic analysis and discovery of the true source of potentially malicious system activity would be impossible to achieve. To ensure the veracity of audit data, the information system and/or the application must protect audit information from unauthorized modification. This requirement can be achieved through multiple methods depending on system architecture and design. Some commonly employed methods include ensuring log files have the proper file system permissions and limiting log data locations. Applications providing a user interface to audit data will leverage user permissions and roles identifying the user accessing the data and the user's corresponding rights to make access decisions regarding the modification of audit data. Audit information includes all information (e.g., audit records, audit settings, and audit reports) needed to successfully audit information system activity. Modification of database audit data could mask the theft or unauthorized modification of sensitive data stored in the database.
Checks: C-65730r1000631_chk

Review locations of audit logs, both internal to the database and database audit logs located at the operating system level. Verify there are appropriate controls and permissions to protect the audit information from unauthorized modification. Note: The following instructions use the PGLOG environment variable. Refer to supplementary content APPENDIX-I for instructions on configuring PGLOG. #### stderr Logging If the PostgreSQL server is configured to use stderr for logging, the logs will be owned by the database owner (usually postgres user) with a default permissions level of 0600. The permissions can be configured in postgresql.conf. To check the permissions for log files in postgresql.conf, as the database owner (shown here as "postgres"), run the following command: $ sudo su - postgres $ psql -c "show log_file_mode;" If the permissions are not 0600, this is a finding. As the database owner (shown here as "postgres"), list the permissions of the logs: $ sudo su - postgres $ ls -la ${PGLOG?} If logs are not owned by the database owner (shown here as "postgres") and are not the same permissions as configured in postgresql.conf, this is a finding. #### syslog Logging If the PostgreSQL server is configured to use syslog for logging, consult the organization syslog setting for permissions and ownership of logs.

Fix: F-65638r1000632_fix

To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for instructions on configuring PGLOG. #### stderr Logging With stderr logging enabled, as the database owner (shown here as "postgres"), set the following parameter in postgresql.conf: $ vi ${PGDATA?}/postgresql.conf log_file_mode = 0600 To change the owner and permissions of the log files, run the following: $ chown postgres:postgres ${PGDATA?}/${PGLOG?} $ chmod 0700 ${PGDATA?}/${PGLOG?} $ chmod 600 ${PGDATA?}/${PGLOG?}/*.log #### syslog Logging If PostgreSQL is configured to use syslog for logging, the log files must be configured to be owned by root with 0600 permissions. $ chown root:root <log directory name>/<log_filename> $ chmod 0700 <log directory name> $ chmod 0600 <log directory name>/*.log

b
The audit information produced by PostgreSQL must be protected from unauthorized deletion.
AU-9 - Medium - CCI-000164 - V-261877 - SV-261877r1000968_rule
RMF Control
AU-9
Severity
Medium
CCI
CCI-000164
Version
CD16-00-002200
Vuln IDs
  • V-261877
Rule IDs
  • SV-261877r1000968_rule
If audit data were to become compromised, then competent forensic analysis and discovery of the true source of potentially malicious system activity is impossible to achieve. To ensure the veracity of audit data, the information system and/or the application must protect audit information from unauthorized deletion. This requirement can be achieved through multiple methods which will depend upon system architecture and design. Some commonly employed methods include ensuring log files enjoy the proper file system permissions using file system protections; restricting access; and backing up log data to ensure log data is retained. Applications providing a user interface to audit data will leverage user permissions and roles identifying the user accessing the data and the corresponding rights the user enjoys in order to make access decisions regarding the deletion of audit data. Audit information includes all information (e.g., audit records, audit settings, and audit reports) needed to successfully audit information system activity. Deletion of database audit data could mask the theft of, or the unauthorized modification of, sensitive data stored in the database.
Checks: C-65731r1000968_chk

Note: The following instructions use the PGLOG environment variable. Refer to supplementary content APPENDIX-I for instructions on configuring PGLOG. Review locations of audit logs, both internal to the database and database audit logs located at the operating system level. Verify there are appropriate controls and permissions to protect the audit information from unauthorized modification. #### stderr Logging If the PostgreSQL server is configured to use stderr for logging, the logs will be owned by the database administrator (shown here as "postgres") with a default permissions level of 0600. The permissions can be configured in postgresql.conf. To check the permissions for log files, as the database administrator (shown here as "postgres"), run the following command: $ sudo su - postgres $ psql -c "show log_file_mode" If the permissions are not 0600, this is a finding. As the database administrator (shown here as "postgres"), list the permissions of the logs: $ sudo su - postgres $ ls -la ${PGLOG?} If logs are not owned by the database administrator (shown here as "postgres") and are not the same permissions as configured in postgresql.conf, this is a finding. #### syslog Logging If the PostgreSQL server is configured to use syslog for logging, consult organization syslog setting for permissions and ownership of logs.

Fix: F-65639r1000635_fix

To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for instructions on configuring PGLOG. #### stderr Logging With stderr logging enabled, as the database owner (shown here as "postgres"), set the following parameter in postgresql.conf: $ vi ${PGDATA?}/postgresql.conf log_file_mode = 0600 To change the owner and permissions of the log files, run the following: $ chown postgres:postgres ${PGDATA?}/${PGLOG?} $ chmod 0700 ${PGDATA?}/${PGLOG?} $ chmod 600 ${PGDATA?}/${PGLOG?}/*.log #### syslog Logging If PostgreSQL is configured to use syslog for logging, the log files must be configured to be owned by root with 0600 permissions. $ chown root:root <log directory name>/<log_filename> $ chmod 0700 <log directory name> $ chmod 0600 <log directory name>/*.log

b
PostgreSQL must protect its audit features from unauthorized access.
AU-9 - Medium - CCI-001493 - V-261878 - SV-261878r1000958_rule
RMF Control
AU-9
Severity
Medium
CCI
CCI-001493
Version
CD16-00-002300
Vuln IDs
  • V-261878
Rule IDs
  • SV-261878r1000958_rule
Protecting audit data also includes identifying and protecting the tools used to view and manipulate log data. Depending upon the log format and application, system and application log tools may provide the only means to manipulate and manage application and system log data. It is, therefore, imperative that access to audit tools be controlled and protected from unauthorized access. Applications providing tools to interface with audit data will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys in order to make access decisions regarding the access to audit tools. Audit tools include, but are not limited to, OS-provided audit tools, vendor-provided audit tools, and open-source audit tools needed to successfully view and manipulate audit information system activity and records. If an attacker were to gain access to audit tools, they could analyze audit logs for system weaknesses or weaknesses in the auditing itself. An attacker could also manipulate logs to hide evidence of malicious activity.
Checks: C-65732r1000637_chk

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA, APPENDIX-H for PGVER, and APPENDIX-I for PGLOG. Only the database owner and superuser can alter configuration of PostgreSQL. Ensure the PGLOG directory is owned by postgres user and group: $ sudo su - postgres $ ls -la ${PGLOG?}  If PGLOG is not owned by the database owner, this is a finding.  Ensure the data directory is owned by postgres user and group.  $ sudo su - postgres $ ls -la ${PGDATA?} If PGDATA is not owned by the database owner, this is a finding. Ensure the pgaudit installation is owned by root: $ sudo su - postgres $ ls -la /usr/pgsql-${PGVER?}/share/extension/pgaudit* If the pgaudit installation is not owned by root, this is a finding. As the database administrator (shown here as "postgres"), run the following SQL to list all roles and their privileges: $ sudo su - postgres $ psql -x -c "\du" If any role has "superuser" that should not, this is a finding.

Fix: F-65640r1000638_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA, APPENDIX-H for PGVER and APPENDIX-I for PGLOG. If PGLOG or PGDATA are not owned by postgres user and group, configure them as follows:  $ sudo chown -R postgres:postgres ${PGDATA?} $ sudo chown -R postgres:postgres ${PGLOG?} If the pgaudit installation is not owned by root user and group, configure it as follows: $ sudo chown -R root:root /usr/pgsql-${PGVER?}/share/extension/pgaudit* To remove superuser from a role, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "ALTER ROLE <role-name> WITH NOSUPERUSER"

b
PostgreSQL must protect its audit configuration from unauthorized modification.
AU-9 - Medium - CCI-001494 - V-261879 - SV-261879r1000960_rule
RMF Control
AU-9
Severity
Medium
CCI
CCI-001494
Version
CD16-00-002400
Vuln IDs
  • V-261879
Rule IDs
  • SV-261879r1000960_rule
Protecting audit data also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operation on audit data. Applications providing tools to interface with audit data will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys to make access decisions regarding the modification of audit tools. Audit tools include, but are not limited to, vendor-provided and open source audit tools needed to successfully view and manipulate audit information system activity and records. Audit tools include custom queries and report generators.
Checks: C-65733r1000640_chk

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. All configurations for auditing and logging can be found in the postgresql.conf configuration file. By default, this file is owned by the database administrator account. To check that the permissions of the postgresql.conf are owned by the database administrator with permissions of 0600, run the following as the database administrator (shown here as "postgres"): $ sudo su - postgres $ ls -la ${PGDATA?} If postgresql.conf is not owned by the database administrator or does not have 0600 permissions, this is a finding. #### stderr Logging To check that logs are created with 0600 permissions, check the following setting: $ sudo su - postgres $ psql -c "SHOW log_file_mode" If permissions are not 0600, this is a finding. #### syslog Logging If PostgreSQL is configured to use syslog, verify that the logs are owned by root and have 0600 permissions. If they are not, this is a finding.

Fix: F-65641r1000641_fix

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. Apply or modify access controls and permissions (both within PostgreSQL and in the file system/operating system) to tools used to view or modify audit log data. Tools must be configurable by authorized personnel only. $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf log_file_mode = 0600 As the database administrator (shown here as "postgres"), change the ownership and permissions of configuration files in PGDATA: $ sudo su - postgres $ chown postgres:postgres ${PGDATA?}/*.conf $ chmod 0600 ${PGDATA?}/*.conf

b
PostgreSQL must protect its audit features from unauthorized removal.
AU-9 - Medium - CCI-001495 - V-261880 - SV-261880r1000959_rule
RMF Control
AU-9
Severity
Medium
CCI
CCI-001495
Version
CD16-00-002500
Vuln IDs
  • V-261880
Rule IDs
  • SV-261880r1000959_rule
Protecting audit data also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operation on audit data. Applications providing tools to interface with audit data will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys to make access decisions regarding the deletion of audit tools. Audit tools include, but are not limited to, vendor-provided and open source audit tools needed to successfully view and manipulate audit information system activity and records. Audit tools include custom queries and report generators.
Checks: C-65734r1000643_chk

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. As the database administrator (shown here as "postgres"), verify the permissions of PGDATA: $ sudo su - postgres $ ls -la ${PGDATA?} If PGDATA is not owned by postgres:postgres or if files can be accessed by others, this is a finding. As the system administrator, verify the permissions of pgsql shared objects and compiled binaries: $ ls -la /usr/pgsql-${PGVER?}/bin $ ls -la /usr/pgsql-${PGVER?}/include $ ls -la /usr/pgsql-${PGVER?}/lib $ ls -la /usr/pgsql-${PGVER?}/share If any of these are not owned by root:root, this is a finding.

Fix: F-65642r1000644_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. As the system administrator, change the permissions of PGDATA: $ sudo chown -R postgres:postgres ${PGDATA?} $ sudo chmod 700 ${PGDATA?} As the system administrator, change the permissions of pgsql: $ sudo chown -R root:root /usr/pgsql-${PGVER?}

b
PostgreSQL must limit privileges to change software modules, to include stored procedures, functions and triggers, and links to software external to PostgreSQL.
CM-5 - Medium - CCI-001499 - V-261881 - SV-261881r1000648_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001499
Version
CD16-00-002600
Vuln IDs
  • V-261881
Rule IDs
  • SV-261881r1000648_rule
If the system were to allow any user to make changes to software libraries, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. Accordingly, only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. Unmanaged changes that occur to the database software libraries or configuration can lead to unauthorized or compromised installations.
Checks: C-65735r1000646_chk

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. As the database administrator (shown here as "postgres"), check the permissions of configuration files for the database: $ sudo su - postgres $ ls -la ${PGDATA?} If any files are not owned by the database owner or have permissions allowing others to modify (write) configuration files, this is a finding. As the server administrator, check the permissions on the shared libraries for PostgreSQL: $ sudo ls -la /usr/pgsql-${PGVER?} $ sudo ls -la /usr/pgsql-${PGVER?}/bin $ sudo ls -la /usr/pgsql-${PGVER?}/include $ sudo ls -la /usr/pgsql-${PGVER?}/lib $ sudo ls -la /usr/pgsql-${PGVER?}/share If any files are not owned by root or have permissions allowing others to modify (write) configuration files, this is a finding.

Fix: F-65643r1000647_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. As the database administrator (shown here as "postgres"), change the ownership and permissions of configuration files in PGDATA: $ sudo su - postgres $ chown postgres:postgres ${PGDATA?}/postgresql.conf $ chmod 0600 ${PGDATA?}/postgresql.conf As the server administrator, change the ownership and permissions of shared objects in /usr/pgsql-${PGVER?}/*.so $ sudo chown root:root /usr/pgsql-${PGVER?}/lib/*.so $ sudo chmod 0755 /usr/pgsql-${PGVER?}/lib/*.so As the service administrator, change the ownership and permissions of executables in /usr/pgsql-${PGVER?}/bin: $ sudo chown root:root /usr/pgsql-${PGVER?}/bin/* $ sudo chmod 0755 /usr/pgsql-${PGVER?}/bin/*

c
The PostgreSQL software installation account must be restricted to authorized users.
CM-5 - High - CCI-001499 - V-261882 - SV-261882r1000651_rule
RMF Control
CM-5
Severity
High
CCI
CCI-001499
Version
CD16-00-002700
Vuln IDs
  • V-261882
Rule IDs
  • SV-261882r1000651_rule
When dealing with change control issues, it should be noted any changes to the hardware, software, and/or firmware components of the information system and/or application can have significant effects on the overall security of the system. If the system were to allow any user to make changes to software libraries, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. Accordingly, only qualified and authorized individuals must be allowed access to information system components for purposes of initiating changes, including upgrades and modifications. DBA and other privileged administrative or application owner accounts are granted privileges that allow actions that can have a great impact on database security and operation. It is especially important to grant privileged access to only those persons who are qualified and authorized to use them.
Checks: C-65736r1000649_chk

Review procedures for controlling, granting access to, and tracking use of the PostgreSQL software installation account(s). 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.

Fix: F-65644r1000650_fix

Develop, document, and implement procedures to restrict and track use of the PostgreSQL software installation account(s).

b
Database software, including PostgreSQL configuration files, must be stored in dedicated directories, or DASD pools, separate from the host OS and other applications.
CM-5 - Medium - CCI-001499 - V-261883 - SV-261883r1000654_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001499
Version
CD16-00-002800
Vuln IDs
  • V-261883
Rule IDs
  • SV-261883r1000654_rule
When dealing with change control issues, it should be noted any changes to the hardware, software, and/or firmware components of the information system and/or application can potentially have significant effects on the overall security of the system. Multiple applications can provide a cumulative negative effect. A vulnerability and subsequent exploit to one application can lead to an exploit of other applications sharing the same security context. For example, an exploit to a web server process that leads to unauthorized administrative access to host system directories can most likely lead to a compromise of all applications hosted by the same system. Database software not installed using dedicated directories both threatens and is threatened by other hosted applications. Access controls defined for one application may by default provide access to the other application's database objects or directories. Any method that provides any level of separation of security context assists in the protection between applications.
Checks: C-65737r1000652_chk

Review the PostgreSQL software library directory and any subdirectories. If any non-PostgreSQL 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 PostgreSQL, this is a finding. Only applications that are required for the functioning and administration, not use, of the PostgreSQL software library should be located in the same disk directory as the PostgreSQL software libraries. If other applications are located in the same directory as PostgreSQL, this is a finding.

Fix: F-65645r1000653_fix

Install all applications on directories separate from the PostgreSQL software library directory. Relocate any directories or reinstall other application software that currently shares the PostgreSQL software library directory.

b
Database objects (including but not limited to tables, indexes, storage, stored procedures, functions, triggers, links to software external to the DBMS, etc.) must be owned by database/PostgreSQL principals authorized for ownership.
CM-5 - Medium - CCI-001499 - V-261884 - SV-261884r1000657_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001499
Version
CD16-00-002900
Vuln IDs
  • V-261884
Rule IDs
  • SV-261884r1000657_rule
Within the database, object ownership implies full privileges to the owned object, including the privilege to assign access to the owned objects to other subjects. Database functions and procedures can be coded using definer's rights. This allows anyone who uses the object to perform the actions if they were the owner. If not properly managed, this can lead to privileged actions being taken by unauthorized individuals. Conversely, if critical tables or other objects rely on unauthorized owner accounts, these objects may be lost when an account is removed.
Checks: C-65738r1000655_chk

Review system documentation to identify accounts authorized to own database objects. Review accounts that own objects in the database(s). If any database objects are found to be owned by users not authorized to own database objects, this is a finding. To check the ownership of objects in the database, as the database administrator, run the following SQL: $ sudo su - postgres $ psql -X -c '\dnS' $ psql -x -c "\dt *.*" $ psql -X -c '\dsS' $ psql -x -c "\dv *.*" $ psql -x -c "\df+ *.*" If any object is not owned by an authorized role for ownership, this is a finding.

Fix: F-65646r1000656_fix

Assign ownership of authorized objects to authorized object owner accounts. #### Schema Owner To create a schema owned by the user "bob", run the following SQL: $ sudo su - postgres $ psql -c "CREATE SCHEMA test AUTHORIZATION bob" To alter the ownership of an existing object to be owned by the user "bob", run the following SQL: $ sudo su - postgres $ psql -c "ALTER SCHEMA test OWNER TO bob"

b
The role(s)/group(s) used to modify database structure (including but not necessarily limited to tables, indexes, storage, etc.) and logic modules (stored procedures, functions, triggers, links to software external to PostgreSQL, etc.) must be restricted to authorized users.
CM-5 - Medium - CCI-001499 - V-261885 - SV-261885r1000949_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001499
Version
CD16-00-003000
Vuln IDs
  • V-261885
Rule IDs
  • SV-261885r1000949_rule
If PostgreSQL were to allow any user to make changes to database structure or logic, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. Accordingly, only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. Unmanaged changes that occur to the database software libraries or configuration can lead to unauthorized or compromised installations.
Checks: C-65739r1000658_chk

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. As the database administrator (shown here as "postgres"), list all users and their permissions by running the following SQL: $ sudo su - postgres $ psql -c "\dp *.*" Verify that all objects have the correct privileges. If they do not, this is a finding. As the database administrator (shown here as "postgres"), verify the permissions of the database directory on the filesystem: $ ls -la ${PGDATA?} If permissions of the database directory are not limited to an authorized user account, this is a finding.

Fix: F-65647r1000659_fix

As the database administrator, revoke any permissions from a role that are deemed unnecessary by running the following SQL: ALTER ROLE bob NOCREATEDB; ALTER ROLE bob NOCREATEROLE; ALTER ROLE bob NOSUPERUSER; ALTER ROLE bob NOINHERIT; REVOKE SELECT ON some_function FROM bob;

b
Unused database components, PostgreSQL software, and database objects must be removed.
CM-7 - Medium - CCI-000381 - V-261886 - SV-261886r1000951_rule
RMF Control
CM-7
Severity
Medium
CCI
CCI-000381
Version
CD16-00-003200
Vuln IDs
  • V-261886
Rule IDs
  • SV-261886r1000951_rule
Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). It is detrimental for software products to provide, or install by default, functionality exceeding requirements or mission objectives. PostgreSQL must adhere to the principles of least functionality by providing only essential capabilities.
Checks: C-65740r1000661_chk

To get a list of all extensions installed, use the following commands: $ sudo su - postgres $ psql -c "select * from pg_extension where extname != 'plpgsql'" If any extensions exist that are not approved, this is a finding.

Fix: F-65648r1000951_fix

To remove extensions, use the following commands: $ sudo su - postgres $ psql -c "DROP EXTENSION <extension_name>" Note: Removal of plpgsql is not recommended.

b
Unused database components that are integrated in PostgreSQL and cannot be uninstalled must be disabled.
CM-7 - Medium - CCI-000381 - V-261887 - SV-261887r1000666_rule
RMF Control
CM-7
Severity
Medium
CCI
CCI-000381
Version
CD16-00-003300
Vuln IDs
  • V-261887
Rule IDs
  • SV-261887r1000666_rule
Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). It is detrimental for software products to provide, or install by default, functionality exceeding requirements or mission objectives. DBMSs must adhere to the principles of least functionality by providing only essential capabilities. Unused, unnecessary PostgreSQL components increase the attack vector for PostgreSQL by introducing additional targets for attack. By minimizing the services and applications installed on the system, the number of potential vulnerabilities is reduced. Components of the system that are unused and cannot be uninstalled must be disabled. The techniques available for disabling components will vary by DBMS product, OS, and the nature of the component and may include PostgreSQL configuration settings, OS service settings, OS file access security, and PostgreSQL user/role permissions.
Checks: C-65741r1000664_chk

To list all installed packages, as the system administrator, run the following: # RHEL/CENT 8/9 Systems $ sudo dnf list installed | grep postgres # RHEL/CENT 7 Systems $ sudo yum list installed | grep postgres # Debian Systems $ dpkg --get-selections | grep postgres If any of the packages installed not required, this is a finding.

Fix: F-65649r1000665_fix

To remove any unneeded executables, as the system administrator, run the following: # RHEL/CENT Systems $ sudo yum erase <package_name> # Debian Systems $ sudo apt-get remove <package_name>

b
Access to external executables must be disabled or restricted.
CM-7 - Medium - CCI-000381 - V-261888 - SV-261888r1000669_rule
RMF Control
CM-7
Severity
Medium
CCI
CCI-000381
Version
CD16-00-003400
Vuln IDs
  • V-261888
Rule IDs
  • SV-261888r1000669_rule
Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). It is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives. Applications must adhere to the principles of least functionality by providing only essential capabilities. PostgreSQL may spawn additional external processes to execute procedures that are defined in PostgreSQL but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than PostgreSQL and provide unauthorized access to the host system.
Checks: C-65742r1000667_chk

PostgreSQL's COPY command can interact with the underlying OS. Only superuser has access to this command. As the database administrator (shown here as "postgres"), run the following SQL to list all roles and their privileges: $ sudo su - postgres $ psql -x -c "\du" If any role has "superuser" that should not, this is a finding. It is possible for an extension to contain code that could access external executables via SQL. To list all installed extensions, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -x -c "SELECT * FROM pg_available_extensions WHERE installed_version IS NOT NULL" If any installed extensions are not approved, this is a finding.

Fix: F-65650r1000668_fix

To remove superuser from a role, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "ALTER ROLE <role-name> WITH NOSUPERUSER" To remove extensions from PostgreSQL, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "DROP EXTENSION extension_name"

b
PostgreSQL must be configured to prohibit or restrict the use of organization-defined functions, ports, protocols, and/or services, as defined in the PPSM CAL and vulnerability assessments.
CM-7 - Medium - CCI-000382 - V-261889 - SV-261889r1000672_rule
RMF Control
CM-7
Severity
Medium
CCI
CCI-000382
Version
CD16-00-003500
Vuln IDs
  • V-261889
Rule IDs
  • SV-261889r1000672_rule
In order to prevent unauthorized connection of devices, unauthorized transfer of information, or unauthorized tunneling (i.e., embedding of data types within data types), organizations must disable or restrict unused or unnecessary physical and logical ports/protocols/services on information systems. Applications are capable of providing a wide variety of functions and services. Some of the functions and services provided by default may not be necessary to support essential organizational operations. Additionally, it is sometimes convenient to provide multiple services from a single component (e.g., email and web services); however, doing so increases risk over limiting the services provided by any one component. To support the requirements and principles of least functionality, the application must support the organizational requirements providing only essential capabilities and limiting the use of ports, protocols, and/or services to only those required, authorized, and approved to conduct official business or to address authorized quality of life issues. Database Management Systems using ports, protocols, and services deemed unsafe are open to attack through those ports, protocols, and services. This can allow unauthorized access to the database and through the database to other components of the information system.
Checks: C-65743r1000670_chk

As the database administrator, run the following SQL: $ psql -c "SHOW port" $ psql -c "SHOW listen_addresses" If the currently defined address:port configuration is deemed prohibited, this is a finding.

Fix: F-65651r1000671_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To change the listening port of the database, as the database administrator, change the following setting in postgresql.conf: $ sudo su - postgres $ vi $PGDATA/postgresql.conf Change the port parameter to the desired port. To change the listening address of the database, as the database administrator, change the following setting in postgresql.conf: listen_addresses = '10.0.0.1, 127.0.0.1' Restart the database: # SYSTEMD SERVER ONLY $ sudo systemctl restart postgresql-${PGVER?} Note: psql uses the port 5432 by default. This can be changed by specifying the port with psql or by setting the PGPORT environment variable: $ psql -p 5432 -c "SHOW port" $ export PGPORT=5432

b
PostgreSQL must uniquely identify and authenticate organizational users (or processes acting on behalf of organizational users).
IA-2 - Medium - CCI-000764 - V-261890 - SV-261890r1000675_rule
RMF Control
IA-2
Severity
Medium
CCI
CCI-000764
Version
CD16-00-003600
Vuln IDs
  • V-261890
Rule IDs
  • SV-261890r1000675_rule
To assure accountability and prevent unauthenticated access, organizational users must be identified and authenticated to prevent potential misuse and compromise of the system. Organizational users include organizational employees or individuals the organization deems to have equivalent status of employees (e.g., contractors). Organizational users (and any processes acting on behalf of users) must be uniquely identified and authenticated for all accesses, except the following: (i) Accesses explicitly identified and documented by the organization. Organizations document specific user actions that can be performed on the information system without identification or authentication; and (ii) Accesses that occur through authorized use of group authenticators without individual authentication. Organizations may require unique identification of individuals using shared accounts, for detailed accountability of individual activity.
Checks: C-65744r1000673_chk

Review PostgreSQL settings to determine whether organizational users are uniquely identified and authenticated when logging on/connecting to the system. To list all roles in the database, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "\du" If organizational users are not uniquely identified and authenticated, this is a finding. As the database administrator (shown here as "postgres"), verify the current pg_hba.conf authentication settings: $ sudo su - postgres $ cat ${PGDATA?}/pg_hba.conf If every role does not have unique authentication requirements, this is a finding. If accounts are determined to be shared, determine if individuals are first individually authenticated. If individuals are not individually authenticated before using the shared account, this is a finding.

Fix: F-65652r1000674_fix

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. Configure PostgreSQL settings to uniquely identify and authenticate all organizational users who log on/connect to the system. To create roles, use the following SQL: CREATE ROLE <role_name> [OPTIONS] For more information on CREATE ROLE, refer to the official documentation: https://www.postgresql.org/docs/current/static/sql-createrole.html. For each role created, the database administrator can specify database authentication by editing pg_hba.conf: $ sudo su - postgres $ vi ${PGDATA?}/pg_hba.conf An example pg_hba entry looks like this: # TYPE DATABASE USER ADDRESS METHOD host test_db bob 192.168.0.0/16 scram-sha-256 For more information on pg_hba.conf, refer to the official documentation: https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html.

c
If passwords are used for authentication, PostgreSQL must store only hashed, salted representations of passwords.
IA-5 - High - CCI-000196 - V-261891 - SV-261891r1000970_rule
RMF Control
IA-5
Severity
High
CCI
CCI-000196
Version
CD16-00-003800
Vuln IDs
  • V-261891
Rule IDs
  • SV-261891r1000970_rule
The DOD standard for authentication is DOD-approved PKI certificates. Authentication based on User ID and Password may be used only when it is not possible to employ a PKI certificate, and requires Authorizing Official (AO) approval. In such cases, database passwords stored in clear text, using reversible encryption, or using unsalted hashes would be vulnerable to unauthorized disclosure. Database passwords must always be in the form of one-way, salted hashes when stored internally or externally to PostgreSQL.
Checks: C-65745r1000676_chk

Note: The following instructions use the PGVER environment variables. Refer to supplementary content APPENDIX-H for PGVER. To check if password encryption is enabled, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "SHOW password_encryption" If password_encryption is not "scram-sha-256", this is a finding. To identify if any passwords have been stored without being hashed and salted, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -x -c "SELECT username, passwd FROM pg_shadow WHERE passwd IS NULL OR passwd NOT LIKE 'SCRAM-SHA-256%';" If any password is in plaintext, this is a finding.

Fix: F-65653r1000970_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To enable password_encryption, as the database administrator, edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf password_encryption = 'scram-sha-256' Institute a policy of not using the "WITH UNENCRYPTED PASSWORD" option with the CREATE ROLE/USER and ALTER ROLE/USER commands. (This option overrides the setting of the password_encryption configuration parameter.) As the system administrator, restart the server with the new configuration: # SYSTEMD SERVER ONLY $ sudo systemctl restart postgresql-${PGVER?}

c
If passwords are used for authentication, PostgreSQL must transmit only encrypted representations of passwords.
IA-5 - High - CCI-000197 - V-261892 - SV-261892r1000681_rule
RMF Control
IA-5
Severity
High
CCI
CCI-000197
Version
CD16-00-003900
Vuln IDs
  • V-261892
Rule IDs
  • SV-261892r1000681_rule
The DOD standard for authentication is DOD-approved PKI certificates. Authentication based on User ID and Password may be used only when it is not possible to employ a PKI certificate, and requires Authorizing Official (AO) approval. In such cases, passwords need to be protected at all times, and encryption is the standard method for protecting passwords during transmission. PostgreSQL passwords sent in clear text format across the network are vulnerable to discovery by unauthorized users. Disclosure of passwords may easily lead to unauthorized access to the database.
Checks: C-65746r1000679_chk

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. As the database administrator (shown here as "postgres"), review the authentication entries in pg_hba.conf: $ sudo su - postgres $ cat ${PGDATA?}/pg_hba.conf If any entries use the auth_method (last column in records) "password" or "md5", this is a finding.

Fix: F-65654r1000680_fix

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. As the database administrator (shown here as "postgres"), edit pg_hba.conf authentication file and change all entries of "password" to "scram-sha-256": $ sudo su - postgres $ vi ${PGDATA?}/pg_hba.conf host all all .example.com scram-sha-256

b
PostgreSQL, when using PKI-based authentication, must validate certificates by performing RFC 5280-compliant certification path validation.
IA-5 - Medium - CCI-000185 - V-261893 - SV-261893r1000684_rule
RMF Control
IA-5
Severity
Medium
CCI
CCI-000185
Version
CD16-00-004000
Vuln IDs
  • V-261893
Rule IDs
  • SV-261893r1000684_rule
The DOD standard for authentication is DOD-approved PKI certificates. A certificate's certification path is the path from the end entity certificate to a trusted root certification authority (CA). Certification path validation is necessary for a relying party to make an informed decision regarding acceptance of an end entity certificate. Certification path validation includes checks such as certificate issuer trust, time validity and revocation status for each certificate in the certification path. Revocation status information for CA and subject certificates in a certification path is commonly provided via certificate revocation lists (CRLs) or online certificate status protocol (OCSP) responses. Database Management Systems that do not validate certificates by performing RFC 5280-compliant certification path validation are in danger of accepting certificates that are invalid and/or counterfeit. This could allow unauthorized access to the database.
Checks: C-65747r1000682_chk

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. To verify that a CRL file exists, as the database administrator (shown here as "postgres"), run the following: $ sudo su - postgres $ psql -c "SELECT CASE WHEN length(setting) &gt; 0 THEN CASE WHEN substring(setting, 1, 1) = '/' THEN setting ELSE (SELECT setting FROM pg_settings WHERE name = 'data_directory') || '/' || setting END ELSE '' END AS ssl_crl_file FROM pg_settings WHERE name = 'ssl_crl_file';" If this is not set to a CRL file, this is a finding. Verify the existence of the CRL file by checking the directory from above: $ sudo su - postgres $ ls -ld &lt;ssl_crl_file&gt; If the CRL file does not exist, this is a finding. Verify that hostssl entries in pg_hba.conf have "cert" and "clientcert=verify-ca" enabled: $ sudo su - postgres $ grep '^hostssl.*cert.*clientcert=verify-ca ' ${PGDATA?}/pg_hba.conf If hostssl entries are not returned, this is a finding. If certificates are not being validated by performing RFC 5280-compliant certification path validation, this is a finding.

Fix: F-65655r1000683_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To configure PostgreSQL to use SSL, refer to supplementary content APPENDIX-G. To generate a Certificate Revocation List, refer to the official Red Hat Documentation: https://access.redhat.com/documentation/en-US/Red_Hat_Update_Infrastructure/2.1/html/Administration_Guide/chap-Red_Hat_Update_Infrastructure-Administration_Guide-Certification_Revocation_List_CRL.html. As the database administrator (shown here as "postgres"), copy the CRL file into the data directory: As the system administrator, copy the CRL file into the PostgreSQL Data Directory: $ sudo cp root.crl ${PGDATA?}/root.crl As the database administrator (shown here as "postgres"), set the ssl_crl_file parameter to the filename of the CRL: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf ssl_crl_file = 'root.crl' In pg_hba.conf, require ssl authentication: $ sudo su - postgres $ vi ${PGDATA?}/pg_hba.conf hostssl <database> <user> <address> cert clientcert=verify-ca As the system administrator, reload the server with the new configuration: # SYSTEMD SERVER ONLY $ sudo systemctl reload postgresql-${PGVER?}

c
PostgreSQL must enforce authorized access to all PKI private keys stored/used by PostgreSQL.
IA-5 - High - CCI-000186 - V-261894 - SV-261894r1000687_rule
RMF Control
IA-5
Severity
High
CCI
CCI-000186
Version
CD16-00-004100
Vuln IDs
  • V-261894
Rule IDs
  • SV-261894r1000687_rule
The DOD standard for authentication is DOD-approved PKI certificates. PKI certificate-based authentication is performed by requiring the certificate holder to cryptographically prove possession of the corresponding private key. If the private key is stolen, an attacker can use the private key(s) to impersonate the certificate holder. In cases where the DBMS-stored private keys are used to authenticate PostgreSQL to the system's clients, loss of the corresponding private keys would allow an attacker to successfully perform undetected man in the middle attacks against the PostgreSQL system and its clients. Both the holder of a digital certificate and the issuing authority must take careful measures to protect the corresponding private key. Private keys should always be generated and protected in FIPS 140-2 or 140-3 validated cryptographic modules. All access to the private key(s) of PostgreSQL must be restricted to authorized and authenticated users. If unauthorized users have access to one or more of PostgreSQL's private keys, an attacker could gain access to the key(s) and use them to impersonate the database on the network or otherwise perform unauthorized actions.
Checks: C-65748r1000685_chk

As the database administrator (shown here as "postgres"), verify the following settings: $ sudo su - postgres $ psql -c "select name, case when setting = '' then '&lt;undefined&gt;' when substring(setting, 1, 1) = '/' then setting else (select setting from pg_settings where name = 'data_directory') || '/' || setting end as setting from pg_settings where name in ('ssl_ca_file', 'ssl_cert_file', 'ssl_crl_file', 'ssl_key_file');" If the directory in which these files are stored is not protected, this is a finding.

Fix: F-65656r1000686_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. Store all PostgreSQL PKI private keys in a FIPS 140-2-validated cryptographic module. Ensure access to PostgreSQL PKI private keys is restricted to only authenticated and authorized users. PostgreSQL private key(s) can be stored in $PGDATA directory, which is only accessible by the database owner (usually postgres, DBA) user. Do not allow access to this system account to unauthorized users. To put the keys in a different directory, as the database administrator (shown here as "postgres"), set the following settings to a protected directory: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf ssl_ca_file = "/some/protected/directory/root.crt" ssl_crl_file = "/some/protected/directory/root.crl" ssl_cert_file = "/some/protected/directory/server.crt" ssl_key_file = "/some/protected/directory/server.key" As the system administrator, restart the server with the new configuration: # SYSTEMD SERVER ONLY $ sudo systemctl restart postgresql-${PGVER?} For more information on configuring PostgreSQL to use SSL, refer to supplementary content APPENDIX-G.

b
PostgreSQL must map the PKI-authenticated identity to an associated user account.
IA-5 - Medium - CCI-000187 - V-261895 - SV-261895r1000690_rule
RMF Control
IA-5
Severity
Medium
CCI
CCI-000187
Version
CD16-00-004200
Vuln IDs
  • V-261895
Rule IDs
  • SV-261895r1000690_rule
The DOD standard for authentication is DOD-approved PKI certificates. Once a PKI certificate has been validated, it must be mapped to a PostgreSQL user account for the authenticated identity to be meaningful to PostgreSQL and useful for authorization decisions.
Checks: C-65749r1000688_chk

The Common Name (cn) attribute of the certificate will be compared to the requested database username and, if they match, the login will be allowed. To check the cn of the certificate, using openssl, do the following: $ openssl x509 -noout -subject -in /path/to/your/client_cert.file If the cn does not match the users listed in PostgreSQL and no user mapping is used, this is a finding. User name mapping can be used to allow cn to be different from the database username. If User Name Maps are used, run the following as the database administrator (shown here as "postgres"), to get a list of maps used for authentication: $ sudo su - postgres $ grep "map" ${PGDATA?}/pg_hba.conf With the names of the maps used, check those maps against the username mappings in pg_ident.conf: $ sudo su - postgres $ cat ${PGDATA?}/pg_ident.conf If user accounts are not being mapped to authenticated identities, this is a finding. If the cn and the username mapping do not match, this is a finding.

Fix: F-65657r1000689_fix

Configure PostgreSQL to map authenticated identities directly to PostgreSQL user accounts. For information on configuring PostgreSQL to use SSL, refer to supplementary content APPENDIX-G.

c
PostgreSQL must use NIST FIPS 140-2 or 140-3 validated cryptographic modules for cryptographic operations.
IA-7 - High - CCI-000803 - V-261896 - SV-261896r1000693_rule
RMF Control
IA-7
Severity
High
CCI
CCI-000803
Version
CD16-00-004400
Vuln IDs
  • V-261896
Rule IDs
  • SV-261896r1000693_rule
Use of weak or not validated cryptographic algorithms undermines the purposes of using encryption and digital signatures to protect data. Weak algorithms can be easily broken and not validated cryptographic modules may not implement algorithms correctly. Unapproved cryptographic modules or algorithms should not be relied on for authentication, confidentiality, or integrity. Weak cryptography could allow an attacker to gain access to and modify data stored in the database as well as the administration settings of PostgreSQL. Applications (including DBMSs) using cryptography are required to use approved NIST FIPS 140-2 or 140-3 validated cryptographic modules that meet the requirements of applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. NSA Type-X (where X=1, 2, 3, 4) products are NSA-certified, hardware-based encryption modules. The standard for validating cryptographic modules will transition to the NIST FIPS 140-3 publication. FIPS 140-2 modules can remain active for up to five years after validation or until September 21, 2026, when the FIPS 140-2 validations will be moved to the historical list. Even on the historical list, CMVP supports the purchase and use of these modules for existing systems. While federal agencies decide when they move to FIPS 140-3 only modules, purchasers are reminded that for several years there may be a limited selection of FIPS 140-3 modules from which to choose. CMVP recommends purchasers consider all modules that appear on the Validated Modules Search Page: https://csrc.nist.gov/projects/cryptographic-module-validation-program/validated-modules. More information on the FIPS 140-3 transition can be found here: https://csrc.nist.gov/Projects/fips-140-3-transition-effort/.
Checks: C-65750r1000691_chk

As the system administrator, run the following: $ openssl version If "fips" is not included in the OpenSSL version, this is a finding.

Fix: F-65658r1000692_fix

Configure OpenSSL to meet FIPS Compliance using the following documentation in section 9.1: http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp1758.pdf. For more information on configuring PostgreSQL to use SSL, refer to supplementary content APPENDIX-G.

b
PostgreSQL must uniquely identify and authenticate nonorganizational users (or processes acting on behalf of nonorganizational users).
IA-8 - Medium - CCI-000804 - V-261897 - SV-261897r1000696_rule
RMF Control
IA-8
Severity
Medium
CCI
CCI-000804
Version
CD16-00-004500
Vuln IDs
  • V-261897
Rule IDs
  • SV-261897r1000696_rule
Nonorganizational users include all information system users other than organizational users, which include organizational employees or individuals the organization deems to have equivalent status of employees (e.g., contractors, guest researchers, individuals from allied nations). Nonorganizational users must be uniquely identified and authenticated for all accesses other than those accesses explicitly identified and documented by the organization when related to the use of anonymous access, such as accessing a web server. Accordingly, a risk assessment is used in determining the authentication needs of the organization. Scalability, practicality, and security are simultaneously considered in balancing the need to ensure ease of use for access to federal information and information systems with the need to protect and adequately mitigate risk to organizational operations, organizational assets, individuals, other organizations, and the Nation.
Checks: C-65751r1000694_chk

PostgreSQL uniquely identifies and authenticates PostgreSQL users through the use of DBMS roles. To list all roles in the database, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "\du" If users are not uniquely identified per organizational documentation, this is a finding.

Fix: F-65659r1000695_fix

To drop a role, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "DROP ROLE <role_to_drop>" To create a role, as the database administrator, run the following SQL: $ sudo su - postgres $ psql -c "CREATE ROLE <role name> LOGIN" For the complete list of permissions allowed by roles, refer to the official documentation: https://www.postgresql.org/docs/current/static/sql-createrole.html.

b
PostgreSQL must separate user functionality (including user interface services) from database management functionality.
SC-2 - Medium - CCI-001082 - V-261898 - SV-261898r1000699_rule
RMF Control
SC-2
Severity
Medium
CCI
CCI-001082
Version
CD16-00-004600
Vuln IDs
  • V-261898
Rule IDs
  • SV-261898r1000699_rule
Information system management functionality includes functions necessary to administer databases, network components, workstations, or servers and typically requires privileged user access. The separation of user functionality from information system management functionality is either physical or logical and is accomplished by using different computers, different central processing units, different instances of the operating system, different network addresses, combinations of these methods, or other methods, as appropriate. An example of this type of separation is observed in web administrative interfaces that use separate authentication methods for users of any other information system resources. This may include isolating the administrative interface on a different domain and with additional access controls. If administrative functionality or information regarding PostgreSQL management is presented on an interface available for users, information on PostgreSQL settings may be inadvertently made available to the user.
Checks: C-65752r1000697_chk

Check PostgreSQL settings and vendor documentation to verify that administrative functionality is separate from user functionality. As the database administrator (shown here as "postgres"), list all roles and permissions for the database: $ sudo su - postgres $ psql -c "\du" If any nonadministrative role has the attribute "Superuser", "Create role", "Create DB" or "Bypass RLS", this is a finding. If administrator and general user functionality are not separated either physically or logically, this is a finding.

Fix: F-65660r1000698_fix

Configure PostgreSQL to separate database administration and general user functionality. Do not grant superuser, create role, create db, or bypass rls role attributes to users that do not require it. To remove privileges, refer to the following example: ALTER ROLE <username> NOSUPERUSER NOCREATEDB NOCREATEROLE NOBYPASSRLS;

b
PostgreSQL must invalidate session identifiers upon user logout or other session termination.
SC-23 - Medium - CCI-001185 - V-261899 - SV-261899r1000702_rule
RMF Control
SC-23
Severity
Medium
CCI
CCI-001185
Version
CD16-00-004700
Vuln IDs
  • V-261899
Rule IDs
  • SV-261899r1000702_rule
Captured sessions can be reused in "replay" attacks. This requirement limits the ability of adversaries to capture and continue to employ previously valid session IDs. This requirement focuses on communications protection for the PostgreSQL session rather than for the network packet. The intent of this control is to establish grounds for confidence at each end of a communications session in the ongoing identity of the other party and in the validity of the information being transmitted. Session IDs are tokens generated by DBMSs to uniquely identify a user's (or process's) session. DBMSs will make access decisions and execute logic based on the session ID. Unique session IDs help to reduce predictability of said identifiers. Unique session IDs address man-in-the-middle attacks, including session hijacking or insertion of false information into a session. If the attacker is unable to identify or guess the session information related to pending application traffic, they will have more difficulty in hijacking the session or otherwise manipulating valid sessions. When a user logs out, or when any other session termination event occurs, PostgreSQL must terminate the user session(s) to minimize the potential for sessions to be hijacked.
Checks: C-65753r1000700_chk

As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -h localhost -c "SHOW tcp_keepalives_idle" $ psql -h localhost -c "SHOW tcp_keepalives_interval" $ psql -h localhost -c "SHOW tcp_keepalives_count" $ psql -h localhost -c "SHOW statement_timeout" If these settings are not set to something other than zero, this is a finding.

Fix: F-65661r1000701_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. As the database administrator (shown here as "postgres"), edit postgresql.conf: $ sudo su - postgres $ vi $PGDATA/postgresql.conf Set the following parameters to organizational requirements: statement_timeout = 10000 #milliseconds tcp_keepalives_idle = 10 # seconds tcp_keepalives_interval = 10 # seconds tcp_keepalives_count = 10 As the system administrator, restart the server with the new configuration: $ sudo systemctl restart postgresql-${PGVER?}

b
PostgreSQL must maintain the authenticity of communications sessions by guarding against man-in-the-middle attacks that guess at Session ID values.
SC-23 - Medium - CCI-001188 - V-261900 - SV-261900r1000705_rule
RMF Control
SC-23
Severity
Medium
CCI
CCI-001188
Version
CD16-00-004900
Vuln IDs
  • V-261900
Rule IDs
  • SV-261900r1000705_rule
One class of man-in-the-middle, or session hijacking, attack involves the adversary guessing at valid session identifiers based on patterns in identifiers already known. The preferred technique for thwarting guesses at Session IDs is the generation of unique session identifiers using a FIPS 140-2 or 140-3 approved random number generator. However, it is recognized that available DBMS products do not all implement the preferred technique yet may have other protections against session hijacking. Therefore, other techniques are acceptable, provided they are demonstrated to be effective.
Checks: C-65754r1000703_chk

To check if PostgreSQL is configured to use ssl, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "SHOW ssl" If this is not set to on, this is a finding.

Fix: F-65662r1000704_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To configure PostgreSQL to use SSL, as a database owner (shown here as "postgres"), edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameter: ssl = on As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?} For more information on configuring PostgreSQL to use SSL, refer to supplementary content APPENDIX-G. For further SSL configurations, refer to the official documentation: https://www.postgresql.org/docs/current/static/ssl-tcp.html.

c
PostgreSQL must protect the confidentiality and integrity of all information at rest.
SC-28 - High - CCI-001199 - V-261901 - SV-261901r1000708_rule
RMF Control
SC-28
Severity
High
CCI
CCI-001199
Version
CD16-00-005200
Vuln IDs
  • V-261901
Rule IDs
  • SV-261901r1000708_rule
This control is intended to address the confidentiality and integrity of information at rest in nonmobile devices and covers user information and system information. Information at rest refers to the state of information when it is located on a secondary storage device (e.g., disk drive, tape drive) within an organizational information system. Applications and application users generate information throughout the course of their application use. User data generated, as well as application-specific configuration data, needs to be protected. Organizations may choose to employ different mechanisms to achieve confidentiality and integrity protections, as appropriate. If the confidentiality and integrity of application data is not protected, the data will be open to compromise and unauthorized modification.
Checks: C-65755r1000706_chk

If the application owner and Authorizing Official (AO) have determined that encryption of data at rest is NOT required, this is not a finding. One possible way to encrypt data within PostgreSQL is to use the pgcrypto extension. To check if pgcrypto is installed on PostgreSQL, as a database administrator (shown here as "postgres"), run the following command: $ sudo su - postgres $ psql -c "SELECT * FROM pg_available_extensions where name='pgcrypto'" If data in the database requires encryption and pgcrypto is not available, this is a finding. If disk or filesystem requires encryption, ask the system owner, database administrator (DBA), and system administrator (SA) to demonstrate the use of disk-level encryption. If this is required and is not found, this is a finding. If controls do not exist or are not enabled, this is a finding.

Fix: F-65663r1000707_fix

Apply appropriate controls to protect the confidentiality and integrity of data at rest in the database. The pgcrypto module provides cryptographic functions for PostgreSQL. Refer to supplementary content APPENDIX-E for documentation on installing pgcrypto. With pgcrypto installed, it is possible to insert encrypted data into the database: INSERT INTO accounts(username, password) VALUES ('bob', crypt('a_secure_password', gen_salt('xdes')));

b
PostgreSQL must isolate security functions from nonsecurity functions.
SC-3 - Medium - CCI-001084 - V-261902 - SV-261902r1000711_rule
RMF Control
SC-3
Severity
Medium
CCI
CCI-001084
Version
CD16-00-005300
Vuln IDs
  • V-261902
Rule IDs
  • SV-261902r1000711_rule
An isolation boundary provides access control and protects the integrity of the hardware, software, and firmware that perform security functions. Security functions are the hardware, software, and/or firmware of the information system responsible for enforcing the system security policy and supporting the isolation of code and data on which the protection is based. Developers and implementers can increase the assurance in security functions by employing well-defined security policy models; structured, disciplined, and rigorous hardware and software development techniques; and sound system/security engineering principles. Database Management Systems typically separate security functionality from nonsecurity functionality via separate databases or schemas. Database objects or code implementing security functionality should not be commingled with objects or code implementing application logic. When security and nonsecurity functionality are commingled, users who have access to nonsecurity functionality may be able to access security functionality.
Checks: C-65756r1000709_chk

Check PostgreSQL settings to determine whether objects or code implementing security functionality are located in a separate security domain, such as a separate database or schema created specifically for security functionality. By default, all objects in pg_catalog and information_schema are owned by the database administrator. To check the access controls for those schemas, as the database administrator (shown here as "postgres"), run the following commands to review the access privileges granted on the data dictionary and security tables, views, sequences, functions and trigger procedures: $ sudo su - postgres $ psql -x -c "\dp pg_catalog.*" $ psql -x -c "\dp information_schema.*" Repeat the \dp statements for any additional schemas that contain locally defined security objects. Repeat using \df+*.* to review ownership of PostgreSQL functions: $ sudo su - postgres $ psql -x -c "\df+ pg_catalog.*" $ psql -x -c "\df+ information_schema.*" Refer to the PostgreSQL online documentation for GRANT for help in interpreting the Access Privileges column in the output from \du. Note that an entry starting with an equals sign indicates privileges granted to Public (all users). By default, most of the tables and views in the pg_catalog and information_schema schemas can be read by Public. If any user besides the database administrator(s) is listed in access privileges and not documented, this is a finding. If security-related database objects or code are not kept separate, this is a finding.

Fix: F-65664r1000710_fix

Do not locate security-related database objects with application tables or schema. Review any site-specific applications security modules built into the database: determine what schema they are located in and take appropriate action. Do not grant access to pg_catalog or information_schema to anyone but the database administrator(s). Access to the database administrator account(s) must not be granted to anyone without official approval.

b
Database contents must be protected from unauthorized and unintended information transfer by enforcement of a data-transfer policy.
SC-4 - Medium - CCI-001090 - V-261903 - SV-261903r1000714_rule
RMF Control
SC-4
Severity
Medium
CCI
CCI-001090
Version
CD16-00-005400
Vuln IDs
  • V-261903
Rule IDs
  • SV-261903r1000714_rule
Applications, including DBMSs, must prevent unauthorized and unintended information transfer via shared system resources. Data used for the development and testing of applications often involves copying data from production. It is important that specific procedures exist for this process, to include the conditions under which such transfer may take place, where the copies may reside, and the rules for ensuring sensitive data are not exposed. Copies of sensitive data must not be misplaced or left in a temporary location without the proper controls.
Checks: C-65757r1000712_chk

Review the procedures for the refreshing of development/test data from production. Review any scripts or code that exists 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.

Fix: F-65665r1000713_fix

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.

b
Access to database files must be limited to relevant processes and to authorized, administrative users.
SC-4 - Medium - CCI-001090 - V-261904 - SV-261904r1000717_rule
RMF Control
SC-4
Severity
Medium
CCI
CCI-001090
Version
CD16-00-005600
Vuln IDs
  • V-261904
Rule IDs
  • SV-261904r1000717_rule
Applications, including DBMSs, must prevent unauthorized and unintended information transfer via shared system resources. Permitting only PostgreSQL processes and authorized, administrative users to have access to the files where the database resides helps ensure that those files are not shared inappropriately and are not open to backdoor access and manipulation.
Checks: C-65758r1000715_chk

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. Review the permissions granted to users by the operating system/file system on the database files, database log files and database backup files. To verify that all files are owned by the database administrator and have the correct permissions, run the following as the database administrator (shown here as "postgres"): $ sudo su - postgres $ ls -lR ${PGDATA?} If any files are not owned by the database administrator or allow anyone but the database administrator to read/write/execute, this is a finding. If any user/role that is not an authorized system administrator with a need-to-know or database administrator with a need-to-know, or a system account for running PostgreSQL processes, is permitted to read/view any of these files, this is a finding.

Fix: F-65666r1000716_fix

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. Configure the permissions granted by the operating system/file system on the database files, database log files, and database backup files so that only relevant system accounts and authorized system administrators and database administrators with a need to know are permitted to read/view these files. Any files (for example: extra configuration files) created in ${PGDATA?} must be owned by the database administrator, with only owner permissions to read, write, and execute.

b
PostgreSQL must check the validity of all data inputs except those specifically identified by the organization.
SI-10 - Medium - CCI-001310 - V-261905 - SV-261905r1000720_rule
RMF Control
SI-10
Severity
Medium
CCI
CCI-001310
Version
CD16-00-005700
Vuln IDs
  • V-261905
Rule IDs
  • SV-261905r1000720_rule
Invalid user input occurs when a user inserts data or characters into an application's data entry fields and the application is unprepared to process that data. This results in unanticipated application behavior, potentially leading to an application or information system compromise. Invalid user input is one of the primary methods employed when attempting to compromise an application. With respect to database management systems, one class of threat is known as SQL Injection, or more generally, code injection. It takes advantage of the dynamic execution capabilities of various programming languages, including dialects of SQL. Potentially, the attacker can gain unauthorized access to data, including security settings, and severely corrupt or destroy the database. Even when no such hijacking takes place, invalid input that gets recorded in the database, whether accidental or malicious, reduces the reliability and usability of the system. Available protections include data types, referential constraints, uniqueness constraints, range checking, and application-specific logic. Application-specific logic can be implemented within the database in stored procedures and triggers, where appropriate. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed, and must document what has been discovered.
Checks: C-65759r1000718_chk

Review PostgreSQL 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 PostgreSQL for the use of prepared statements. If prepared statements are not used, this is a finding.

Fix: F-65667r1000719_fix

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 constraints and validity checking on database columns and tables that require them for data integrity. Use prepared statements when taking user input. Do not allow general users direct console access to PostgreSQL.

b
PostgreSQL and associated applications must reserve the use of dynamic code execution for situations that require it.
SI-10 - Medium - CCI-001310 - V-261906 - SV-261906r1000979_rule
RMF Control
SI-10
Severity
Medium
CCI
CCI-001310
Version
CD16-00-005800
Vuln IDs
  • V-261906
Rule IDs
  • SV-261906r1000979_rule
With respect to database management systems, one class of threat is known as SQL Injection, or more generally, code injection. It takes advantage of the dynamic execution capabilities of various programming languages, including dialects of SQL. In such cases, the attacker deduces the manner in which SQL statements are being processed, either from inside knowledge or by observing system behavior in response to invalid inputs. When the attacker identifies scenarios where SQL queries are being assembled by application code (which may be within the database or separate from it) and executed dynamically, the attacker is then able to craft input strings that subvert the intent of the query. Potentially, the attacker can gain unauthorized access to data, including security settings, and severely corrupt or destroy the database. The principal protection against code injection is not to use dynamic execution except where it provides necessary functionality that cannot be used otherwise. Use strongly typed data items rather than general-purpose strings as input parameters to task-specific, pre-compiled stored procedures and functions (and triggers). This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed and must document what has been discovered.
Checks: C-65760r1000721_chk

Review PostgreSQL source code (trigger procedures, functions) 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.

Fix: F-65668r1000722_fix

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.

b
PostgreSQL and associated applications, when making use of dynamic code execution, must scan input data for invalid values that may indicate a code injection attack.
SI-10 - Medium - CCI-001310 - V-261907 - SV-261907r1000726_rule
RMF Control
SI-10
Severity
Medium
CCI
CCI-001310
Version
CD16-00-005900
Vuln IDs
  • V-261907
Rule IDs
  • SV-261907r1000726_rule
With respect to database management systems, one class of threat is known as SQL Injection, or more generally, code injection. It takes advantage of the dynamic execution capabilities of various programming languages, including dialects of SQL. In such cases, the attacker deduces the manner in which SQL statements are being processed, either from inside knowledge or by observing system behavior in response to invalid inputs. When the attacker identifies scenarios where SQL queries are being assembled by application code (which may be within the database or separate from it) and executed dynamically, the attacker is then able to craft input strings that subvert the intent of the query. Potentially, the attacker can gain unauthorized access to data, including security settings, and severely corrupt or destroy the database. The principal protection against code injection is not to use dynamic execution except where it provides necessary functionality that cannot be used otherwise. Use strongly typed data items rather than general-purpose strings as input parameters to task-specific, pre-compiled stored procedures and functions (and triggers). When dynamic execution is necessary, ways to mitigate the risk include the following, which should be implemented both in the on-screen application and at the database level, in the stored procedures: -- Allow strings as input only when necessary. -- Rely on data typing to validate numbers, dates, etc. Do not accept invalid values. If substituting other values for them, think carefully about whether this could be subverted. -- Limit the size of input strings to what is truly necessary. -- If single quotes/apostrophes, double quotes, semicolons, equals signs, angle brackets, or square brackets will never be valid as input, reject them. -- If comment markers will never be valid as input, reject them. In SQL, these are -- or /* */ -- If HTML and XML tags, entities, comments, etc., will never be valid, reject them. -- If wildcards are present, reject them unless truly necessary. In SQL these are the underscore and the percentage sign, and the word ESCAPE is also a clue that wildcards are in use. -- If SQL key words, such as SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, ESCAPE, UNION, GRANT, REVOKE, DENY, MODIFY will never be valid, reject them. Use case-insensitive comparisons when searching for these. Bear in mind that some of these words, particularly Grant (as a person's name), could also be valid input. -- If there are range limits on the values that may be entered, enforce those limits. -- Institute procedures for inspection of programs for correct use of dynamic coding, by a party other than the developer. -- Conduct rigorous testing of program modules that use dynamic coding, searching for ways to subvert the intended use. -- Record the inspection and testing in the system documentation. -- Bear in mind that all this applies not only to screen input, but also to the values in an incoming message to a web service or to a stored procedure called by a software component that has not itself been hardened in these ways. Not only can the caller be subject to such vulnerabilities; it may itself be the attacker. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed, and must document what has been discovered.
Checks: C-65761r1000724_chk

Review PostgreSQL source code (trigger procedures, functions) 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.

Fix: F-65669r1000725_fix

Where dynamic code execution is used, modify the code to implement protections against code injection (i.e., prepared statements).

b
PostgreSQL must provide nonprivileged users with error messages that provide information necessary for corrective actions without revealing information that could be exploited by adversaries.
SI-11 - Medium - CCI-001312 - V-261908 - SV-261908r1000729_rule
RMF Control
SI-11
Severity
Medium
CCI
CCI-001312
Version
CD16-00-006000
Vuln IDs
  • V-261908
Rule IDs
  • SV-261908r1000729_rule
Any DBMS or associated application providing too much information in error messages on the screen or printout risks compromising the data and security of the system. The structure and content of error messages need to be carefully considered by the organization and development team. Databases can inadvertently provide a wealth of information to an attacker through improperly handled error messages. In addition to sensitive business or personal information, database errors can provide host names, IP addresses, usernames, and other system information not required for troubleshooting but very useful to someone targeting the system. Carefully consider the structure/content of error messages. The extent to which information systems are able to identify and handle error conditions is guided by organizational policy and operational requirements. Information that could be exploited by adversaries includes, for example, logon attempts with passwords entered by mistake as the username, mission/business information that can be derived from (if not stated explicitly by) information recorded, and personal information, such as account numbers, social security numbers, and credit card numbers. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed, and must document what has been discovered.
Checks: C-65762r1000727_chk

To check the level of detail for errors exposed to clients, as the DBA (shown here as "postgres"), run the following: $ sudo su - postgres $ psql -c "SHOW client_min_messages;" If client_min_messages is not set to error, this is a finding.

Fix: F-65670r1000728_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. As the database administrator, edit "postgresql.conf": $ sudo su - postgres $ vi $PGDATA/postgresql.conf Change the client_min_messages parameter to be "error": client_min_messages = error Reload the server with the new configuration (this just reloads settings currently in memory; it will not cause an interruption): $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must reveal detailed error messages only to the information system security officer (ISSO), information system security manager (ISSM), system administrator (SA), and database administrator (DBA).
SI-11 - Medium - CCI-001314 - V-261909 - SV-261909r1000980_rule
RMF Control
SI-11
Severity
Medium
CCI
CCI-001314
Version
CD16-00-006100
Vuln IDs
  • V-261909
Rule IDs
  • SV-261909r1000980_rule
If the DBMS provides too much information in error logs and administrative messages to the screen, this could lead to compromise. The structure and content of error messages need to be carefully considered by the organization and development team. The extent to which the information system is able to identify and handle error conditions is guided by organizational policy and operational requirements. Some default PostgreSQL error messages can contain information that could aid an attacker in, among other things, identifying the database type, host address, or state of the database. Custom errors may contain sensitive customer information. It is important that detailed error messages be visible only to those who are authorized to view them; that general users receive only generalized acknowledgment that errors have occurred; and that these generalized messages appear only when relevant to the user's task. For example, a message along the lines of, "An error has occurred. Unable to save your changes. If this problem persists, please contact your help desk" would be relevant. A message such as "Warning: your transaction generated a large number of page splits" would likely not be relevant. Administrative users authorized to review detailed error messages typically are the ISSO, ISSM, SA, and DBA. Other individuals or roles may be specified according to organization-specific needs, with appropriate approval. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the DBA is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed and must document what has been discovered.
Checks: C-65763r1000972_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for instructions on configuring PGLOG. Check PostgreSQL settings and custom database code to determine if detailed error messages are ever displayed to unauthorized individuals. To check the level of detail for errors exposed to clients, as the DBA (shown here as "postgres"), run the following: $ sudo su - postgres $ psql -c "SHOW client_min_messages;" If client_min_messages is not set to error, this is a finding. If detailed error messages are displayed to individuals not authorized to view them, this is a finding. #### stderr Logging Logs may contain detailed information and should only be accessible by the database owner. As the database administrator, verify the following settings of logs. Note: Consult the organization's documentation on acceptable log privileges. $ sudo su - postgres $ psql -c "SHOW log_file_mode;" Verify the log files have the set configurations. $ ls -l ${PGLOG?} total 32 -rw-------. 1 postgres postgres 0 Apr 8 00:00 postgresql-Fri.log -rw-------. 1 postgres postgres 8288 Apr 11 17:36 postgresql-Mon.log -rw-------. 1 postgres postgres 0 Apr 9 00:00 postgresql-Sat.log -rw-------. 1 postgres postgres 0 Apr 10 00:00 postgresql-Sun.log -rw-------. 1 postgres postgres 16212 Apr 7 17:05 postgresql-Thu.log -rw-------. 1 postgres postgres 1130 Apr 6 17:56 postgresql-Wed.log If logs are not owned by the database administrator or have permissions that are not 0600, this is a finding. #### syslog Logging If PostgreSQL is configured to use syslog for logging, consult organization location and permissions for syslog log files. If the logs are not owned by root or have permissions that are not 0600, this is a finding.

Fix: F-65671r1000731_fix

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA. To set the level of detail for error messages exposed to clients, as the DBA (shown here as "postgres"), run the following commands: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf client_min_messages = error

b
PostgreSQL must automatically terminate a user session after organization-defined conditions or trigger events requiring session disconnect.
AC-12 - Medium - CCI-002361 - V-261910 - SV-261910r1000735_rule
RMF Control
AC-12
Severity
Medium
CCI
CCI-002361
Version
CD16-00-006200
Vuln IDs
  • V-261910
Rule IDs
  • SV-261910r1000735_rule
This addresses the termination of user-initiated logical sessions in contrast to the termination of network connections that are associated with communications sessions (i.e., network disconnect). A logical session (for local, network, and remote access) is initiated whenever a user (or process acting on behalf of a user) accesses an organizational information system. Such user sessions can be terminated (and thus terminate user access) without terminating network sessions. Session termination ends all processes associated with a user's logical session except those batch processes/jobs that are specifically created by the user (i.e., session owner) to continue after the session is terminated. Conditions or trigger events requiring automatic session termination can include, for example, organization-defined periods of user inactivity, targeted responses to certain types of incidents, and time-of-day restrictions on information system use. This capability is typically reserved for specific cases where the system owner, data owner, or organization requires additional assurance.
Checks: C-65764r1000733_chk

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 PostgreSQL is not configured accordingly, this is a finding.

Fix: F-65672r1000734_fix

Configure PostgreSQL to automatically terminate a user session after organization-defined conditions or trigger events requiring session termination. Examples follow. ### Change a role to nologin and disconnect the user ALTER ROLE '<username>' NOLOGIN; SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE usename='<usename>'; ### Disconnecting users during a specific time range Refer to supplementary content APPENDIX-A for a bash script for this example. The script found in APPENDIX-A using the -l command can disable all users with rolcanlogin=t from logging in. The script keeps track of who it disables in a .restore_login file. After the specified time is over, the same script can be run with the -r command to restore all login connections. This script would be added to a cron job: # lock at 5 am every day of the week, month, year at the 0 minute mark. 0 5 * * * postgres /var/lib/pgsql/no_login.sh -d postgres -l # restore at 5 pm every day of the week, month, year at the 0 minute mark. 0 17 * * * postgres /var/lib/pgsql/no_login.sh -d postgres -r

b
PostgreSQL must associate organization-defined types of security labels having organization-defined security label values with information in storage.
AC-16 - Medium - CCI-002262 - V-261911 - SV-261911r1000738_rule
RMF Control
AC-16
Severity
Medium
CCI
CCI-002262
Version
CD16-00-006400
Vuln IDs
  • V-261911
Rule IDs
  • SV-261911r1000738_rule
Without the association of security labels to information, there is no basis for PostgreSQL to make security-related access-control decisions. Security labels are abstractions representing the basic properties or characteristics of an entity (e.g., subjects and objects) with respect to safeguarding information. These labels are typically associated with internal data structures (e.g., tables, rows) within the database and are used to enable the implementation of access control and flow control policies, reflect special dissemination, handling or distribution instructions, or support other aspects of the information security policy. One example includes marking data as classified or CUI. These security labels may be assigned manually or during data processing, but, either way, it is imperative these assignments are maintained while the data is in storage. If the security labels are lost when the data is stored, there is the risk of a data compromise. The mechanism used to support security labeling may be a feature of the DBMS product, a third-party product, or custom application code.
Checks: C-65765r1000736_chk

If security labeling is not required, this is not a finding. As the database administrator (shown here as "postgres"), run the following SQL against each table that requires security labels: $ sudo su - postgres $ psql -c "\d+ &lt;schema_name&gt;.&lt;table_name&gt;" If security labeling is required and the results of the SQL above do not show a policy attached to the table, this is a finding. If security labeling is required and not implemented according to the system documentation, such as SSP, this is a finding. If security labeling requirements have been specified, but the security labeling is not implemented or does not reliably maintain labels on information in storage, this is a finding.

Fix: F-65673r1000737_fix

In addition to the SQL-standard privilege system available through GRANT, tables can have row security policies that restrict, on a per-user basis, which rows can be returned by normal queries or inserted, updated, or deleted by data modification commands. This feature is also known as Row-Level Security (RLS). RLS policies can be very different depending on their use case. For one example of using RLS for Security Labels, refer to supplementary content APPENDIX-D.

b
PostgreSQL must associate organization-defined types of security labels having organization-defined security label values with information in process.
AC-16 - Medium - CCI-002263 - V-261912 - SV-261912r1000741_rule
RMF Control
AC-16
Severity
Medium
CCI
CCI-002263
Version
CD16-00-006500
Vuln IDs
  • V-261912
Rule IDs
  • SV-261912r1000741_rule
Without the association of security labels to information, there is no basis for PostgreSQL to make security-related access-control decisions. Security labels are abstractions representing the basic properties or characteristics of an entity (e.g., subjects and objects) with respect to safeguarding information. These labels are typically associated with internal data structures (e.g., tables, rows) within the database and are used to enable the implementation of access control and flow control policies, reflect special dissemination, handling or distribution instructions, or support other aspects of the information security policy. One example includes marking data as classified or CUI. These security labels may be assigned manually or during data processing, but, either way, it is imperative these assignments are maintained while the data is in storage. If the security labels are lost when the data is stored, there is the risk of a data compromise. The mechanism used to support security labeling may be a feature of the DBMS product, a third-party product, or custom application code.
Checks: C-65766r1000739_chk

If security labeling is not required, this is not a finding. As the database administrator (shown here as "postgres"), run the following SQL against each table that requires security labels: $ sudo su - postgres $ psql -c "\d+ &lt;schema_name&gt;.&lt;table_name&gt;" If security labeling requirements have been specified, but the security labeling is not implemented or does not reliably maintain labels on information in process, this is a finding.

Fix: F-65674r1000740_fix

In addition to the SQL-standard privilege system available through GRANT, tables can have row security policies that restrict, on a per-user basis, which rows can be returned by normal queries or inserted, updated, or deleted by data modification commands. This feature is also known as Row-Level Security (RLS). RLS policies can be very different depending on their use case. For one example of using RLS for Security Labels, refer to supplementary content APPENDIX-D.

b
PostgreSQL must associate organization-defined types of security labels having organization-defined security label values with information in transmission.
AC-16 - Medium - CCI-002264 - V-261913 - SV-261913r1000744_rule
RMF Control
AC-16
Severity
Medium
CCI
CCI-002264
Version
CD16-00-006600
Vuln IDs
  • V-261913
Rule IDs
  • SV-261913r1000744_rule
Without the association of security labels to information, there is no basis for PostgreSQL to make security-related access-control decisions. Security labels are abstractions representing the basic properties or characteristics of an entity (e.g., subjects and objects) with respect to safeguarding information. These labels are typically associated with internal data structures (e.g., tables, rows) within the database and are used to enable the implementation of access control and flow control policies, reflect special dissemination, handling or distribution instructions, or support other aspects of the information security policy. One example includes marking data as classified or CUI. These security labels may be assigned manually or during data processing, but, either way, it is imperative these assignments are maintained while the data is in storage. If the security labels are lost when the data is stored, there is the risk of a data compromise. The mechanism used to support security labeling may be a feature of the DBMS product, a third-party product, or custom application code.
Checks: C-65767r1000742_chk

If security labeling is not required, this is not a finding. As the database administrator (shown here as "postgres"), run the following SQL against each table that requires security labels: $ sudo su - postgres $ psql -c "\d+ &lt;schema_name&gt;.&lt;table_name&gt;" If security labeling is required and the results of the SQL above do not show a policy attached to the table, this is a finding. If security labeling is required and not implemented according to the system documentation, such as SSP, this is a finding. If security labeling requirements have been specified, but the security labeling is not implemented or does not reliably maintain labels on information in storage, this is a finding.

Fix: F-65675r1000743_fix

In addition to the SQL-standard privilege system available through GRANT, tables can have row security policies that restrict, on a per-user basis, which rows can be returned by normal queries or inserted, updated, or deleted by data modification commands. This feature is also known as Row-Level Security (RLS). RLS policies can be very different depending on their use case. For one example of using RLS for Security Labels, refer to supplementary content APPENDIX-D.

b
PostgreSQL must enforce discretionary access control policies, as defined by the data owner, over defined subjects and objects.
AC-3 - Medium - CCI-002165 - V-261914 - SV-261914r1000747_rule
RMF Control
AC-3
Severity
Medium
CCI
CCI-002165
Version
CD16-00-006700
Vuln IDs
  • V-261914
Rule IDs
  • SV-261914r1000747_rule
Discretionary Access Control (DAC) is based on the notion that individual users are "owners" of objects and therefore have discretion over who should be authorized to access the object and in which mode (e.g., read or write). Ownership is usually acquired as a consequence of creating the object or via specified ownership assignment. DAC allows the owner to determine who will have access to objects they control. An example of DAC includes user-controlled table permissions. When discretionary access control policies are implemented, subjects are not constrained with regard to what actions they can take with information for which they have already been granted access. Thus, subjects that have been granted access to information are not prevented from passing (i.e., the subjects have the discretion to pass) the information to other subjects or objects. A subject that is constrained in its operation by Mandatory Access Control policies is still able to operate under the less rigorous constraints of this requirement. Thus, while Mandatory Access Control imposes constraints preventing a subject from passing information to another subject operating at a different sensitivity level, this requirement permits the subject to pass the information to any subject at the same sensitivity level. The policy is bounded by the information system boundary. Once the information is passed outside of the control of the information system, additional means may be required to ensure the constraints remain in effect. While the older, more traditional definitions of discretionary access control require identity-based access control, that limitation is not required for this use of discretionary access control.
Checks: C-65768r1000745_chk

Review system documentation to identify the required discretionary access control (DAC). Review the security configuration of the database and PostgreSQL. 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. If any database objects are found to be owned by users not authorized to own database objects, this is a finding. To check the ownership of objects in the database, as the database administrator, run the following: $ sudo su - postgres $ psql -X -c '\dnS' $ psql -x -c "\dt *.*" $ psql -X -c '\dsS' $ psql -x -c "\dv *.*" $ psql -x -c "\df+ *.*" If any role is given privileges to objects it should not have, this is a finding.

Fix: F-65676r1000746_fix

Implement the organization's DAC policy in the security configuration of the database and PostgreSQL, and, if applicable, the security configuration of the application(s) using the database. To GRANT privileges to roles, as the database administrator (shown here as "postgres"), run statements like the following examples: $ sudo su - postgres $ psql -c "CREATE SCHEMA test" $ psql -c "GRANT CREATE ON SCHEMA test TO bob" $ psql -c "CREATE TABLE test.test_table(id INT)" $ psql -c "GRANT SELECT ON TABLE test.test_table TO bob" To REVOKE privileges to roles, as the database administrator (shown here as "postgres"), run statements like the following examples: $ psql -c "REVOKE SELECT ON TABLE test.test_table FROM bob" $ psql -c "REVOKE CREATE ON SCHEMA test FROM bob"

b
PostgreSQL must prevent nonprivileged users from executing privileged functions, to include disabling, circumventing, or altering implemented security safeguards/countermeasures.
AC-6 - Medium - CCI-002235 - V-261915 - SV-261915r1000750_rule
RMF Control
AC-6
Severity
Medium
CCI
CCI-002235
Version
CD16-00-006800
Vuln IDs
  • V-261915
Rule IDs
  • SV-261915r1000750_rule
Preventing nonprivileged users from executing privileged functions mitigates the risk that unauthorized individuals or processes may gain unnecessary access to information or privileges. System documentation should include a definition of the functionality considered privileged. Depending on circumstances, privileged functions can include, for example, establishing accounts, performing system integrity checks, or administering cryptographic key management activities. Nonprivileged users are individuals that do not possess appropriate authorizations. Circumventing intrusion detection and prevention mechanisms or malicious code protection mechanisms are examples of privileged functions that require protection from nonprivileged users. A privileged function in the PostgreSQL/database context is any operation that modifies the structure of the database, its built-in logic, or its security settings. This would include all Data Definition Language (DDL) statements and all security-related statements. In an SQL environment, it encompasses, but is not necessarily limited to: CREATE ALTER DROP GRANT REVOKE DENY There may also be Data Manipulation Language (DML) statements that, subject to context, should be regarded as privileged. Possible examples include: TRUNCATE TABLE; DELETE, or DELETE affecting more than n rows, for some n, or DELETE without a WHERE clause; UPDATE or UPDATE affecting more than n rows, for some n, or UPDATE without a WHERE clause; any SELECT, INSERT, UPDATE, or DELETE to an application-defined security table executed by other than a security principal. Depending on the capabilities of the DBMS and the design of the database and associated applications, the prevention of unauthorized use of privileged functions may be achieved by means of PostgreSQL security features, database triggers, other mechanisms, or a combination of these.
Checks: C-65769r1000748_chk

Review the system documentation to obtain the definition of the PostgreSQL functionality considered privileged in the context of the system in question. Review the PostgreSQL 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. If PostgreSQL instance uses procedural languages, such as pl/Python or pl/R, without Authorizing Official (AO) authorization, this is a finding.

Fix: F-65677r1000749_fix

Configure PostgreSQL security to protect all privileged functionality. If pl/R and pl/Python are used, document their intended use, document users that have access to pl/R and pl/Python, as well as their business use case, such as data-analytics or data-mining. Because of the risks associated with using pl/R and pl/Python, their use must have AO risk acceptance. To remove unwanted extensions, use: DROP EXTENSION <extension_name> To remove unwanted privileges from a role, use the REVOKE command. Refer to the PostgreSQL documentation for more details: http://www.postgresql.org/docs/current/static/sql-revoke.html.

b
Execution of software modules (to include stored procedures, functions, and triggers) with elevated privileges must be restricted to necessary cases only.
AC-6 - Medium - CCI-002233 - V-261916 - SV-261916r1000981_rule
RMF Control
AC-6
Severity
Medium
CCI
CCI-002233
Version
CD16-00-006900
Vuln IDs
  • V-261916
Rule IDs
  • SV-261916r1000981_rule
In certain situations, to provide required functionality, PostgreSQL needs to execute internal logic (stored procedures, functions, triggers, etc.) and/or external code modules with elevated privileges. However, if the privileges required for execution are at a higher level than the privileges assigned to organizational users invoking the functionality applications/programs, those users are indirectly provided with greater privileges than assigned by organizations. Privilege elevation must be used only where necessary and protected from misuse. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed and must document what has been discovered.
Checks: C-65770r1000751_chk

Functions in PostgreSQL can be created with the SECURITY DEFINER option. When SECURITY DEFINER functions are executed by a user, said function is run with the privileges of the user who created it. To list all functions that have SECURITY DEFINER, as, the DBA (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "SELECT nspname, proname, proargtypes, prosecdef, rolname, proconfig FROM pg_proc p JOIN pg_namespace n ON p.pronamespace = n.oid JOIN pg_authid a ON a.oid = p.proowner WHERE prosecdef OR NOT proconfig IS NULL" In the query results, a prosecdef value of "t" on a row indicates that that function uses privilege elevation. If elevation of PostgreSQL privileges is used but not documented, this is a finding. If elevation of PostgreSQL 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, or in contexts other than intended, or by subjects/principals other than intended, this is a finding.

Fix: F-65678r1000752_fix

Determine where, when, how, and by what principals/subjects elevated privilege is needed. To change a SECURITY DEFINER function to SECURITY INVOKER, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "ALTER FUNCTION <function_name> SECURITY INVOKER"

b
PostgreSQL must use centralized management of the content captured in audit records generated by all components of PostgreSQL.
AU-3 - Medium - CCI-001844 - V-261917 - SV-261917r1000962_rule
RMF Control
AU-3
Severity
Medium
CCI
CCI-001844
Version
CD16-00-007000
Vuln IDs
  • V-261917
Rule IDs
  • SV-261917r1000962_rule
Without the ability to centrally manage the content captured in the audit records, identification, troubleshooting, and correlation of suspicious behavior would be difficult and could lead to a delayed or incomplete analysis of an ongoing attack. The content captured in audit records must be managed from a central location (necessitating automation). Centralized management of audit records and logs provides for efficiency in maintenance and management of records, as well as the backup and archiving of those records. PostgreSQL may write audit records to database tables, to files in the file system, to other kinds of local repository, or directly to a centralized log management system. Whatever the method used, it must be compatible with offloading the records to the centralized system.
Checks: C-65771r1000962_chk

On Unix systems, PostgreSQL can be configured to use stderr, csvlog, and syslog. To send logs to a centralized location, syslog should be used. As the database owner (shown here as "postgres"), ensure PostgreSQL uses syslog by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_destination" As the database owner (shown here as "postgres"), check to which log facility PostgreSQL is configured by running the following SQL: $ sudo su - postgres $ psql -c "SHOW syslog_facility" Check with the organization to refer to how syslog facilities are defined in their organization. If PostgreSQL audit records are not written directly to or systematically transferred to a centralized log management system, this is a finding.

Fix: F-65679r1000755_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging. With logging enabled, as the database owner (shown here as "postgres"), configure the following parameters in postgresql.conf: Note: Consult the organization on how syslog facilities are defined in the syslog daemon configuration. $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf log_destination = 'syslog' syslog_facility = 'LOCAL0' syslog_ident = 'postgres' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must allocate audit record storage capacity in accordance with organization-defined audit record storage requirements.
AU-4 - Medium - CCI-001849 - V-261918 - SV-261918r1000759_rule
RMF Control
AU-4
Severity
Medium
CCI
CCI-001849
Version
CD16-00-007200
Vuln IDs
  • V-261918
Rule IDs
  • SV-261918r1000759_rule
In order to ensure sufficient storage capacity for the audit logs, PostgreSQL must be able to allocate audit record storage capacity. Although another requirement (SRG-APP-000515-DB-000318) mandates that audit data be offloaded to a centralized log management system, it remains necessary to provide space on the database server to serve as a buffer against outages and capacity limits of the offloading mechanism. The task of allocating audit record storage capacity is usually performed during initial installation of PostgreSQL and is closely associated with the DBA and system administrator roles. The DBA or system administrator will usually coordinate the allocation of physical drive space with the application owner/installer and the application will prompt the installer to provide the capacity information, the physical location of the disk, or both. In determining the capacity requirements, consider such factors as: total number of users; expected number of concurrent users during busy periods; number and type of events being monitored; types and amounts of data being captured; the frequency/speed with which audit records are offloaded to the central log management system; and any limitations that exist on PostgreSQL's ability to reuse the space formerly occupied by offloaded records.
Checks: C-65772r1000757_chk

Investigate whether there have been any incidents where PostgreSQL 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 where PostgreSQL ran out of audit log space, this is a finding.

Fix: F-65680r1000758_fix

Allocate sufficient audit file/table space to support peak demand.

b
PostgreSQL must provide a warning to appropriate support staff when allocated audit record storage volume reaches 75 percent of maximum audit record storage capacity.
AU-5 - Medium - CCI-001855 - V-261919 - SV-261919r1000762_rule
RMF Control
AU-5
Severity
Medium
CCI
CCI-001855
Version
CD16-00-007300
Vuln IDs
  • V-261919
Rule IDs
  • SV-261919r1000762_rule
Organizations are required to use a central log management system so under normal conditions, the audit space allocated to PostgreSQL on its own server will not be an issue. However, space will still be required on the PostgreSQL server for audit records in transit, and, under abnormal conditions, this could fill up. Since a requirement exists to halt processing upon audit failure, a service outage would result. If support personnel are not notified immediately upon storage volume utilization reaching 75%, they are unable to plan for storage capacity expansion. The appropriate support staff include, at a minimum, the information system security officer (ISSO) and the database administrator (DBA)/system administrator (SA).
Checks: C-65773r1000760_chk

Review system configuration. If no script or tool is monitoring the partition for the PostgreSQL log directories, this is a finding. If appropriate support staff are not notified immediately upon storage volume utilization reaching 75 percent, this is a finding.

Fix: F-65681r1000761_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. Configure the system to notify appropriate support staff immediately upon storage volume utilization reaching 75 percent. PostgreSQL does not monitor storage; however, it is possible to monitor storage with a script. ##### Example Monitoring Script #!/bin/bash PGDATA=/var/lib/pgsql/${PGVER?}/data CURRENT=$(df ${PGDATA?} | grep / | awk '{ print $5}' | sed 's/%//g') THRESHOLD=75 if [ "$CURRENT" -gt "$THRESHOLD" ] ; then mail -s 'Disk Space Alert' mail@support.com << EOF The data directory volume is almost full. Used: $CURRENT EOF fi Schedule this script in cron to run around the clock.

b
PostgreSQL must provide an immediate real-time alert to appropriate support staff of all audit log failures.
AU-5 - Medium - CCI-001858 - V-261920 - SV-261920r1000973_rule
RMF Control
AU-5
Severity
Medium
CCI
CCI-001858
Version
CD16-00-007400
Vuln IDs
  • V-261920
Rule IDs
  • SV-261920r1000973_rule
It is critical for the appropriate personnel to be aware if a system is at risk of failing to process audit logs as required. Without a real-time alert, security personnel may be unaware of an impending failure of the audit capability, and system operation may be adversely affected. The appropriate support staff include, at a minimum, the information system security officer (ISSO) and the database administrator (DBA)/system administrator (SA). A failure of database auditing will result in either the database continuing to function without auditing or in a complete halt to database operations. When audit processing fails, appropriate personnel must be alerted immediately to avoid further downtime or unaudited transactions. Alerts provide organizations with urgent messages. Real-time alerts provide these messages immediately (i.e., the time from event detection to alert occurs in seconds or less).
Checks: C-65774r1000973_chk

Review PostgreSQL, OS, or third-party logging software settings to determine whether a real-time alert will be sent to the appropriate personnel when auditing fails for any reason. If real-time alerts are not sent upon auditing failure, this is a finding.

Fix: F-65682r1000764_fix

Configure the system to provide an immediate real-time alert to appropriate support staff when an audit log failure occurs. It is possible to create scripts or implement third-party tools to enable real-time alerting for audit failures in PostgreSQL.

b
PostgreSQL must record time stamps in audit records and application data that can be mapped to Coordinated Universal Time (UTC), formerly Greenwich Mean Time (GMT).
AU-8 - Medium - CCI-001890 - V-261921 - SV-261921r1000994_rule
RMF Control
AU-8
Severity
Medium
CCI
CCI-001890
Version
CD16-00-007500
Vuln IDs
  • V-261921
Rule IDs
  • SV-261921r1000994_rule
If time stamps are not consistently applied and there is no common time reference, it is difficult to perform forensic analysis. Time stamps generated by PostgreSQL must include date and time. Time is commonly expressed in UTC, a modern continuation of GMT, or local time with an offset from UTC. Some DBMS products offer a data type called TIMESTAMP that is not a representation of date and time. Rather, it is a database state counter and does not correspond to calendar and clock time. This requirement does not refer to that meaning of TIMESTAMP.
Checks: C-65775r1000766_chk

When a PostgreSQL cluster is initialized using initdb, the PostgreSQL cluster will be configured to use the same time zone as the target server. As the database administrator (shown here as "postgres"), check the current log_timezone setting by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_timezone" log_timezone -------------- UTC (1 row) If log_timezone is not set to the desired time zone, this is a finding.

Fix: F-65683r1000767_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To change log_timezone in postgresql.conf to use a different time zone for logs, as the database administrator (shown here as "postgres"), run the following: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf log_timezone='UTC' Restart the database: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate time stamps for audit records and application data with a minimum granularity of one second.
AU-8 - Medium - CCI-001889 - V-261922 - SV-261922r1000771_rule
RMF Control
AU-8
Severity
Medium
CCI
CCI-001889
Version
CD16-00-007600
Vuln IDs
  • V-261922
Rule IDs
  • SV-261922r1000771_rule
Without sufficient granularity of time stamps, it is not possible to adequately determine the chronological order of records. Time stamps generated by PostgreSQL must include date and time. Granularity of time measurements refers to the precision available in time stamp values. Granularity coarser than one second is not sufficient for audit trail purposes. Time stamp values are typically presented with three or more decimal places of seconds; however, the actual granularity may be coarser than the apparent precision. For example, SQL Server's GETDATE()/CURRENT_TMESTAMP values are presented to three decimal places, but the granularity is not one millisecond: it is about 1/300 of a second. Some DBMS products offer a data type called TIMESTAMP that is not a representation of date and time. Rather, it is a database state counter and does not correspond to calendar and clock time. This requirement does not refer to that meaning of TIMESTAMP.
Checks: C-65776r1000769_chk

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), verify the current log_line_prefix setting by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_line_prefix" If log_line_prefix does not contain %m, this is a finding. Check the logs to verify time stamps are being logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-02-23 12:53:33.947 EDT postgres postgres 570bd68d.3912 &gt;LOG: connection authorized: user=postgres database=postgres &lt; 2024-02-23 12:53:41.576 EDT postgres postgres 570bd68d.3912 &gt;LOG: AUDIT: SESSION,1,1,DDL,CREATE TABLE,,,CREATE TABLE test_srg(id INT);,&lt;none&gt; &lt; 2024-02-23 12:53:44.372 EDT postgres postgres 570bd68d.3912 &gt;LOG: disconnection: session time: 0:00:10.426 user=postgres database=postgres host=[local] If time stamps are not being logged, this is a finding.

Fix: F-65684r1000770_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. PostgreSQL will not log anything if logging is not enabled. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. If logging is enabled, the following configurations must be made to log events with time stamps: As the database administrator (shown here as "postgres"), edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add %m to log_line_prefix to enable time stamps with milliseconds: log_line_prefix = '< %m >' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must prohibit user installation of logic modules (stored procedures, functions, triggers, views, etc.) without explicit privileged status.
CM-11 - Medium - CCI-001812 - V-261923 - SV-261923r1000993_rule
RMF Control
CM-11
Severity
Medium
CCI
CCI-001812
Version
CD16-00-007700
Vuln IDs
  • V-261923
Rule IDs
  • SV-261923r1000993_rule
Allowing regular users to install software without explicit privileges creates the risk that untested or potentially malicious software will be installed on the system. Explicit privileges (escalated or administrative privileges) provide the regular user with explicit capabilities and control that exceed the rights of a regular user. PostgreSQL functionality and the nature and requirements of databases will vary; so while users are not permitted to install unapproved software, there may be instances where the organization allows the user to install approved software packages such as from an approved software repository. The requirements for production servers will be more restrictive than those used for development and research. PostgreSQL must enforce software installation by users based upon what types of software installations are permitted (e.g., updates and security patches to existing software) and what types of installations are prohibited (e.g., software whose pedigree with regard to being potentially malicious is unknown or suspect) by the organization. In the case of a database management system, this requirement covers stored procedures, functions, triggers, views, etc.
Checks: C-65777r1000772_chk

If PostgreSQL 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 PostgreSQL and database security settings with respect to nonadministrative users ability to create, alter, or replace logic modules, to include but not necessarily only stored procedures, functions, triggers, and views. To list the privileges for all tables and schemas, as the database administrator (shown here as "postgres"), run the following: $ sudo su - postgres $ psql -c "\dp" $ psql -c "\dn+" The privileges are as follows: rolename=xxxx -- privileges granted to a role =xxxx -- privileges granted to PUBLIC r -- SELECT ("read") w -- UPDATE ("write") a -- INSERT ("append") d -- DELETE D -- TRUNCATE x -- REFERENCES t -- TRIGGER X -- EXECUTE U -- USAGE C -- CREATE c -- CONNECT T -- TEMPORARY arwdDxt -- ALL PRIVILEGES (for tables, varies for other objects) * -- grant option for preceding privilege /yyyy -- role that granted this privilege If any such permissions exist and are not documented and approved, this is a finding.

Fix: F-65685r1000773_fix

Document and obtain approval for any nonadministrative users who require the ability to create, alter, or replace logic modules. Implement the approved permissions. Revoke any unapproved permissions.

b
PostgreSQL must enforce access restrictions associated with changes to the configuration of the DBMS or database(s).
CM-5 - Medium - CCI-001813 - V-261924 - SV-261924r1000777_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001813
Version
CD16-00-007800
Vuln IDs
  • V-261924
Rule IDs
  • SV-261924r1000777_rule
Failure to provide logical access restrictions associated with changes to configuration may have significant effects on the overall security of the system. When dealing with access restrictions pertaining to change control, it should be noted that any changes to the hardware, software, and/or firmware components of the information system can potentially have significant effects on the overall security of the system. Accordingly, only qualified and authorized individuals should be allowed to obtain access to system components for the purposes of initiating changes, including upgrades and modifications.
Checks: C-65778r1000775_chk

To list all the permissions of individual roles, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "\du" If any role has SUPERUSER that should not, this is a finding. List all the permissions of databases and schemas by running the following SQL: $ sudo su - postgres $ psql -c "\l" $ psql -c "\dn+" If any database or schema has update ("W") or create ("C") privileges and should not, this is a finding.

Fix: F-65686r1000776_fix

Configure PostgreSQL to enforce access restrictions associated with changes to the configuration of PostgreSQL or database(s). Use ALTER ROLE to remove accesses from roles: $ psql -c "ALTER ROLE <role_name> NOSUPERUSER" Use REVOKE to remove privileges from databases and schemas: $ psql -c "REVOKE ALL PRIVILEGES ON <table> FROM <role_name>"

b
PostgreSQL must produce audit records of its enforcement of access restrictions associated with changes to the configuration of PostgreSQL or database(s).
CM-5 - Medium - CCI-001814 - V-261925 - SV-261925r1000780_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001814
Version
CD16-00-007900
Vuln IDs
  • V-261925
Rule IDs
  • SV-261925r1000780_rule
Without auditing the enforcement of access restrictions against changes to configuration, it would be difficult to identify attempted attacks and an audit trail would not be available for forensic investigation for after-the-fact actions. Enforcement actions are the methods or mechanisms used to prevent unauthorized changes to configuration settings. Enforcement action methods may be as simple as denying access to a file based on the application of file permissions (access restriction). Audit items may consist of lists of actions blocked by access restrictions or changes identified after the fact.
Checks: C-65779r1000778_chk

Note: The following instructions use the PGDATA environment variable. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. To verify that system denies are logged when unprivileged users attempt to change database configuration, as the database administrator (shown here as "postgres"), run the following commands: $ sudo su - postgres $ psql Create a role with no privileges, change the current role to that user, and attempt to change a configuration by running the following SQL: CREATE ROLE bob; SET ROLE bob; SET pgaudit.role='test'; RESET ROLE; DROP ROLE bob; Check ${PGLOG?} (use the latest log): $ cat ${PGDATA?}/${PGLOG?}/postgresql-Thu.log &lt; 2024-01-28 17:57:34.092 UTC bob postgres: &gt;ERROR: permission denied to set parameter "pgaudit.role" &lt; 2024-01-28 17:57:34.092 UTC bob postgres: &gt;STATEMENT: SET pgaudit.role='test'; If the denial is not logged, this is a finding. By default PostgreSQL configuration files are owned by the Postgres user and cannot be edited by nonprivileged users: $ ls -la ${PGDATA?} | grep postgresql.conf -rw-------. 1 postgres postgres 21758 Jan 22 10:27 postgresql.conf If postgresql.conf is not owned by the database owner and does not have read and write permissions for the owner, this is a finding.

Fix: F-65687r1000779_fix

Enable logging. All denials are logged by default if logging is enabled. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C.

b
PostgreSQL must disable network functions, ports, protocols, and services deemed by the organization to be nonsecure, in accordance with the Ports, Protocols, and Services Management (PPSM) guidance.
CM-7 - Medium - CCI-001762 - V-261926 - SV-261926r1000783_rule
RMF Control
CM-7
Severity
Medium
CCI
CCI-001762
Version
CD16-00-008000
Vuln IDs
  • V-261926
Rule IDs
  • SV-261926r1000783_rule
Use of nonsecure network functions, ports, protocols, and services exposes the system to avoidable threats.
Checks: C-65780r1000781_chk

As the database administrator, run the following SQL: $ psql -c "SHOW port" If the currently defined port configuration is deemed prohibited, this is a finding.

Fix: F-65688r1000782_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To change the listening port of the database, as the database administrator, change the following setting in postgresql.conf: $ sudo su - postgres $ vi $PGDATA/postgresql.conf Change the port parameter to the desired port. Restart the database: $ sudo systemctl restart postgresql-${PGVER?} Note: psql uses the port 5432 by default. This can be changed by specifying the port with psql or by setting the PGPORT environment variable: $ psql -p 5432 -c "SHOW port" $ export PGPORT=5432

b
PostgreSQL must require users to reauthenticate when organization-defined circumstances or situations require reauthentication.
IA-11 - Medium - CCI-002038 - V-261927 - SV-261927r1000786_rule
RMF Control
IA-11
Severity
Medium
CCI
CCI-002038
Version
CD16-00-008100
Vuln IDs
  • V-261927
Rule IDs
  • SV-261927r1000786_rule
The DOD standard for authentication of an interactive user is the presentation of a Common Access Card (CAC) or other physical token bearing a valid, current, DOD-issued Public Key Infrastructure (PKI) certificate, coupled with a Personal Identification Number (PIN) to be entered by the user at the beginning of each session and whenever reauthentication is required. Without reauthentication, users may access resources or perform tasks for which they do not have authorization. When applications provide the capability to change security roles or escalate the functional capability of the application, it is critical the user reauthenticate. In addition to the reauthentication requirements associated with session locks, organizations may require reauthentication of individuals and/or devices in other situations, including (but not limited to) the following circumstances: (i) When authenticators change; (ii) When roles change; (iii) When security categories of information systems change; (iv) When the execution of privileged functions occurs; (v) After a fixed period of time; or (vi) Periodically. Within the DOD, the minimum circumstances requiring reauthentication are privilege escalation and role changes.
Checks: C-65781r1000784_chk

Determine all situations where a user must reauthenticate. Check if the mechanisms that handle such situations use the following SQL: To make a single user reauthenticate, the following must be present: SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE user='&lt;username&gt;' To make all users reauthenticate, run the following: SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE user LIKE '%' If the provided SQL does not force reauthentication, this is a finding.

Fix: F-65689r1000785_fix

Modify and/or configure PostgreSQL and related applications and tools so that users are always required to reauthenticate when changing role or escalating privileges. To make a single user reauthenticate, the following must be present: SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE user='<username>' To make all users reauthenticate, the following must be present: SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE user LIKE '%'

c
PostgreSQL must use NSA-approved cryptography to protect classified information in accordance with the data owner's requirements.
SC-13 - High - CCI-002450 - V-261928 - SV-261928r1000789_rule
RMF Control
SC-13
Severity
High
CCI
CCI-002450
Version
CD16-00-008300
Vuln IDs
  • V-261928
Rule IDs
  • SV-261928r1000789_rule
Use of weak or untested encryption algorithms undermines the purposes of using encryption to protect data. The application must implement cryptographic modules adhering to the higher standards approved by the federal government since this provides assurance they have been tested and validated. It is the responsibility of the data owner to assess the cryptography requirements in light of applicable federal laws, Executive Orders, directives, policies, regulations, and standards. NSA-approved cryptography for classified networks is hardware based. This requirement addresses the compatibility of PostgreSQL with the encryption devices.
Checks: C-65782r1000787_chk

If PostgreSQL is deployed in an unclassified environment, this is not applicable. If PostgreSQL is not using NSA-approved cryptography to protect classified information in accordance with applicable federal laws, Executive Orders, directives, policies, regulations, and standards, this is a finding. To check if PostgreSQL is configured to use SSL, as the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "SHOW ssl" If SSL is off, this is a finding. Consult network administration staff to determine whether the server is protected by NSA-approved encrypting devices. If not, this a finding.

Fix: F-65690r1000788_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To configure PostgreSQL to use SSL as a database administrator (shown here as "postgres"), edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameter: ssl = on As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?} For more information on configuring PostgreSQL to use SSL, refer to supplementary content APPENDIX-G. Deploy NSA-approved encrypting devices to protect the server on the network.

b
PostgreSQL must only accept end entity certificates issued by DOD PKI or DOD-approved PKI Certification Authorities (CAs) for the establishment of all encrypted sessions.
SC-23 - Medium - CCI-002470 - V-261929 - SV-261929r1000792_rule
RMF Control
SC-23
Severity
Medium
CCI
CCI-002470
Version
CD16-00-008400
Vuln IDs
  • V-261929
Rule IDs
  • SV-261929r1000792_rule
Only DOD-approved external PKIs have been evaluated to ensure that they have security controls and identity vetting procedures in place which are sufficient for DOD systems to rely on the identity asserted in the certificate. PKIs lacking sufficient security controls and identity vetting procedures risk being compromised and issuing certificates that enable adversaries to impersonate legitimate users. The authoritative list of DOD-approved PKIs is published at https://public.cyber.mil/pki-pke/interoperability/. This requirement focuses on communications protection for the PostgreSQL session rather than for the network packet.
Checks: C-65783r1000790_chk

As the database administrator (shown here as "postgres"), verify the following setting in postgresql.conf: $ sudo su - postgres $ psql -c "SHOW ssl_ca_file" $ psql -c "SHOW ssl_cert_file" If the database is not configured to use only DOD-approved certificates, this is a finding.

Fix: F-65691r1000791_fix

Revoke trust in any certificates not issued by a DOD-approved certificate authority. Configure PostgreSQL to accept only DOD and DOD-approved PKI end-entity certificates. To configure PostgreSQL to accept approved CAs, refer to the official PostgreSQL documentation: http://www.postgresql.org/docs/current/static/ssl-tcp.html For more information on configuring PostgreSQL to use SSL, refer to supplementary content APPENDIX-G.

b
PostgreSQL must implement cryptographic mechanisms to prevent unauthorized modification of organization-defined information at rest (to include, at a minimum, PII and classified information) on organization-defined information system components.
SC-28 - Medium - CCI-002475 - V-261930 - SV-261930r1000795_rule
RMF Control
SC-28
Severity
Medium
CCI
CCI-002475
Version
CD16-00-008500
Vuln IDs
  • V-261930
Rule IDs
  • SV-261930r1000795_rule
PostgreSQLs handling data requiring "data at rest" protections must employ cryptographic mechanisms to prevent unauthorized disclosure and modification of the information at rest. These cryptographic mechanisms may be native to PostgreSQL or implemented via additional software or operating system/file system settings, as appropriate to the situation. Selection of a cryptographic mechanism is based on the need to protect the integrity of organizational information. The strength of the mechanism is commensurate with the security category and/or classification of the information. Organizations have the flexibility to either encrypt all information on storage devices (i.e., full disk encryption) or encrypt specific data structures (e.g., files, records, or fields). The decision whether and what to encrypt rests with the data owner and is also influenced by the physical measures taken to secure the equipment and media on which the information resides.
Checks: C-65784r1000793_chk

Review the system documentation to determine whether the organization has defined the information at rest that is to be protected from modification, which must include, at a minimum, PII and classified information. If no information is identified as requiring such protection, this is not a finding. Review the configuration of PostgreSQL, operating system/file system, and additional software as relevant. If any of the information defined as requiring cryptographic protection from modification is not encrypted in a manner that provides the required level of protection, this is a finding. One possible way to encrypt data within PostgreSQL is to use pgcrypto extension. To check if pgcrypto is installed on PostgreSQL, as a database administrator (shown here as "postgres"), run the following command: $ sudo su - postgres $ psql -c "SELECT * FROM pg_available_extensions where name='pgcrypto'" If data in the database requires encryption and pgcrypto is not available, this is a finding. If disk or filesystem requires encryption, ask the system owner, database administrator (DBA), and system administrator (SA) to demonstrate filesystem or disk level encryption. If this is required and is not found, this is a finding.

Fix: F-65692r1000794_fix

Configure PostgreSQL, operating system/file system, and additional software as relevant, to provide the required level of cryptographic protection. The pgcrypto module provides cryptographic functions for PostgreSQL. Refer to supplementary content APPENDIX-E for documentation on installing pgcrypto. With pgcrypto installed, it is possible to insert encrypted data into the database: INSERT INTO accounts(username, password) VALUES ('bob', crypt('mypass', gen_salt('bf', 4));

b
PostgreSQL must implement cryptographic mechanisms preventing the unauthorized disclosure of organization-defined information at rest on organization-defined information system components.
SC-28 - Medium - CCI-002476 - V-261931 - SV-261931r1000798_rule
RMF Control
SC-28
Severity
Medium
CCI
CCI-002476
Version
CD16-00-008600
Vuln IDs
  • V-261931
Rule IDs
  • SV-261931r1000798_rule
PostgreSQLs handling data requiring "data at rest" protections must employ cryptographic mechanisms to prevent unauthorized disclosure and modification of the information at rest. These cryptographic mechanisms may be native to PostgreSQL or implemented via additional software or operating system/file system settings, as appropriate to the situation. Selection of a cryptographic mechanism is based on the need to protect the integrity of organizational information. The strength of the mechanism is commensurate with the security category and/or classification of the information. Organizations have the flexibility to either encrypt all information on storage devices (i.e., full disk encryption) or encrypt specific data structures (e.g., files, records, or fields). The decision whether and what to encrypt rests with the data owner and is also influenced by the physical measures taken to secure the equipment and media on which the information resides.
Checks: C-65785r1000796_chk

To check if pgcrypto is installed on PostgreSQL, as a database administrator (shown here as "postgres"), run the following command: $ sudo su - postgres $ psql -c "SELECT * FROM pg_available_extensions where name='pgcrypto'" If data in the database requires encryption and pgcrypto is not available, this is a finding. If a disk or filesystem requires encryption, ask the system owner, database administrator (DBA), and system administrator (SA) to demonstrate the use of filesystem and/or disk-level encryption. If this is required and is not found, this is a finding.

Fix: F-65693r1000797_fix

Configure PostgreSQL, operating system/file system, and additional software as relevant, to provide the required level of cryptographic protection for information requiring cryptographic protection against disclosure. Secure the premises, equipment, and media to provide the required level of physical protection. The pgcrypto module provides cryptographic functions for PostgreSQL. Refer to supplementary content APPENDIX-E for documentation on installing pgcrypto. With pgcrypto installed, it is possible to insert encrypted data into the database: INSERT INTO accounts(username, password) VALUES ('bob', crypt('mypass', gen_salt('bf', 4));

b
PostgreSQL must maintain the confidentiality and integrity of information during preparation for transmission.
SC-8 - Medium - CCI-002420 - V-261932 - SV-261932r1000801_rule
RMF Control
SC-8
Severity
Medium
CCI
CCI-002420
Version
CD16-00-008800
Vuln IDs
  • V-261932
Rule IDs
  • SV-261932r1000801_rule
Information can be either unintentionally or maliciously disclosed or modified during preparation for transmission, including, for example, during aggregation, at protocol transformation points, and during packing/unpacking. These unauthorized disclosures or modifications compromise the confidentiality or integrity of the information. Use of this requirement will be limited to situations where the data owner has a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process. When transmitting data, PostgreSQL, associated applications, and infrastructure must leverage transmission protection mechanisms.
Checks: C-65786r1000799_chk

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. As the database administrator (shown here as "postgres"), verify SSL is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW ssl" If SSL is not enabled, this is a finding. If PostgreSQL does not employ protective measures against unauthorized disclosure and modification during preparation for transmission, this is a finding.

Fix: F-65694r1000800_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. Implement protective measures against unauthorized disclosure and modification during preparation for transmission. To configure PostgreSQL to use SSL, as a database administrator (shown here as "postgres"), edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameter: ssl = on As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?} For more information on configuring PostgreSQL to use SSL, refer to supplementary content APPENDIX-G.

b
PostgreSQL must maintain the confidentiality and integrity of information during reception.
SC-8 - Medium - CCI-002422 - V-261933 - SV-261933r1000804_rule
RMF Control
SC-8
Severity
Medium
CCI
CCI-002422
Version
CD16-00-008900
Vuln IDs
  • V-261933
Rule IDs
  • SV-261933r1000804_rule
Information can be either unintentionally or maliciously disclosed or modified during reception, including, for example, during aggregation, at protocol transformation points, and during packing/unpacking. These unauthorized disclosures or modifications compromise the confidentiality or integrity of the information. This requirement applies only to those applications that are either distributed or can allow access to data nonlocally. Use of this requirement will be limited to situations where the data owner has a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process. When receiving data, PostgreSQL, associated applications, and infrastructure must leverage protection mechanisms.
Checks: C-65787r1000802_chk

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. As the database administrator (shown here as "postgres"), verify SSL is enabled in postgresql.conf by running the following SQL: $ sudo su - postgres $ psql -c "SHOW ssl" If SSL is off, this is a finding. If PostgreSQL, associated applications, and infrastructure do not employ protective measures against unauthorized disclosure and modification during reception, this is a finding.

Fix: F-65695r1000803_fix

Implement protective measures against unauthorized disclosure and modification during reception. To configure PostgreSQL to use SSL, refer to supplementary content APPENDIX-G for instructions on enabling SSL.

b
When invalid inputs are received, PostgreSQL must behave in a predictable and documented manner that reflects organizational and system objectives.
SI-10 - Medium - CCI-002754 - V-261934 - SV-261934r1000807_rule
RMF Control
SI-10
Severity
Medium
CCI
CCI-002754
Version
CD16-00-009000
Vuln IDs
  • V-261934
Rule IDs
  • SV-261934r1000807_rule
A common vulnerability is unplanned behavior when invalid inputs are received. This requirement guards against adverse or unintended system behavior caused by invalid inputs, where information system responses to the invalid input may be disruptive or cause the system to fail into an unsafe state. The behavior will be derived from the organizational and system requirements and includes, but is not limited to, notification of the appropriate personnel, creating an audit record, and rejecting invalid input. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed, and must document what has been discovered.
Checks: C-65788r1000805_chk

Review system documentation to determine how input errors from application to PostgreSQL are to be handled in general and if any special handling is defined for specific circumstances. If it does not implement the documented behavior, this is a finding. As the database administrator (shown here as "postgres"), make a small SQL syntax error in psql by running the following: $ sudo su - postgres $ psql -c "CREAT TABLE incorrect_syntax(id INT)" ERROR: syntax error at or near "CREAT" Note: The following instructions use the PGVER and PGLOG environment variables. Refer to supplementary content APPENDIX-H for instructions on configuring PGVER and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), verify the syntax error was logged (change the log file name and part to suit the circumstances): $ sudo su - postgres $ cat ~/${PGVER?}/data/${PGLOG?}/&lt;latest log&gt; 2024-03-30 16:18:10.772 EDT postgres postgres 5706bb87.90dERROR: syntax error at or near "CREAT" at character 1 2024-03-30 16:18:10.772 EDT postgres postgres 5706bb87.90dSTATEMENT: CREAT TABLE incorrect_syntax(id INT); If no matching log entry containing the 'ERROR: syntax error' is present, this is a finding.

Fix: F-65696r1000806_fix

Enable logging. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. All errors and denials are logged if logging is enabled.

b
When updates are applied to the PostgreSQL software, any software components that have been replaced or made unnecessary must be removed.
SI-2 - Medium - CCI-002617 - V-261935 - SV-261935r1000810_rule
RMF Control
SI-2
Severity
Medium
CCI
CCI-002617
Version
CD16-00-009100
Vuln IDs
  • V-261935
Rule IDs
  • SV-261935r1000810_rule
Previous versions of PostgreSQL components that are not removed from the information system after updates have been installed may be exploited by adversaries. Some DBMSs' installation tools may remove older versions of software automatically from the information system. In other cases, manual review and removal will be required. In planning installations and upgrades, organizations must include steps (automated, manual, or both) to identify and remove the outdated modules. A transition period may be necessary when both the old and the new software are required. This should be taken into account in the planning.
Checks: C-65789r1000808_chk

To check software installed by packages, as the system administrator, run the following command: $ sudo rpm -qa | grep postgres If multiple versions of postgres are installed but are unused, this is a finding.

Fix: F-65697r1000809_fix

Use package managers (RPM or apt-get) for installing PostgreSQL. Unused software is removed when updated.

b
Security-relevant software updates to PostgreSQL must be installed within the time period directed by an authoritative source (e.g., IAVM, CTOs, DTMs, and STIGs).
SI-2 - Medium - CCI-002605 - V-261936 - SV-261936r1000963_rule
RMF Control
SI-2
Severity
Medium
CCI
CCI-002605
Version
CD16-00-009200
Vuln IDs
  • V-261936
Rule IDs
  • SV-261936r1000963_rule
Security flaws with software applications, including database management systems, are discovered daily. Vendors are constantly updating and patching their products to address newly discovered security vulnerabilities. Organizations (including any contractor to the organization) are required to promptly install security-relevant software updates (e.g., patches, service packs, and hot fixes). Flaws discovered during security assessments, continuous monitoring, incident response activities, or information system error handling must also be addressed expeditiously. Organization-defined time periods for updating security-relevant software may vary based on a variety of factors including, for example, the security category of the information system or the criticality of the update (i.e., severity of the vulnerability related to the discovered flaw). This requirement will apply to software patch management solutions that are used to install patches across the enclave and also to applications themselves that are not part of that patch management solution. For example, many browsers today provide the capability to install their own patch software. Patch criticality, as well as system criticality, will vary. Therefore, the tactical situations regarding the patch management process will also vary. This means that the time period used must be a configurable parameter. Time frames for application of security-relevant software updates may be dependent upon the Information Assurance Vulnerability Management (IAVM) process. The application will be configured to check for and install security-relevant software updates within an identified time period from the availability of the update. The specific time period will be defined by an authoritative source (e.g., IAVM, CTOs, DTMs, and STIGs).
Checks: C-65790r1000811_chk

If new packages are available for PostgreSQL, they can be reviewed in the package manager appropriate for the server operating system: To list the version of installed PostgreSQL using psql: $ sudo su - postgres $ psql --version To list the current version of software for RPM: $ rpm -qa | grep postgres To list the current version of software for APT: $ apt-cache policy postgres All versions of PostgreSQL are listed here: http://www.postgresql.org/support/versioning/. All security-relevant software updates for PostgreSQL are listed here: http://www.postgresql.org/support/security/. If PostgreSQL is not at the latest version, this is a finding. If PostgreSQL is not at the latest version and the evaluated version has CVEs (IAVAs), then this is a CAT I finding.

Fix: F-65698r1000812_fix

Institute and adhere to policies and procedures to ensure that patches are consistently applied to PostgreSQL within the time allowed.

c
PostgreSQL products must be a version supported by the vendor.
SA-22 - High - CCI-003376 - V-261937 - SV-261937r1000974_rule
RMF Control
SA-22
Severity
High
CCI
CCI-003376
Version
CD16-00-009300
Vuln IDs
  • V-261937
Rule IDs
  • SV-261937r1000974_rule
Unsupported commercial and database systems should not be used because fixes to newly identified bugs will not be implemented by the vendor. The lack of support can result in potential vulnerabilities. Systems at unsupported servicing levels or releases will not receive security updates for new vulnerabilities, which leaves them subject to exploitation. When maintenance updates and patches are no longer available, the database software is no longer considered supported and should be upgraded or decommissioned.
Checks: C-65791r1000974_chk

If new packages are available for PostgreSQL, they can be reviewed in the package manager appropriate for the server operating system: To list the version of installed PostgreSQL using psql: $ sudo su - postgres $ psql --version To list the current version of software for RPM: $ rpm -qa | grep postgres To list the current version of software for APT: $ apt-cache policy postgres All versions of PostgreSQL are listed here: http://www.postgresql.org/support/versioning/ All security-relevant software updates for PostgreSQL are listed here: http://www.postgresql.org/support/security/ If PostgreSQL is not at the latest version, this is a finding. If PostgreSQL is not at the latest version and the evaluated version has CVEs (IAVAs), this is a CAT I finding.

Fix: F-65699r1000815_fix

Institute and adhere to policies and procedures to ensure that patches are consistently applied to PostgreSQL within the time allowed.

b
PostgreSQL must be able to generate audit records when security objects are accessed.
AU-12 - Medium - CCI-000172 - V-261938 - SV-261938r1000819_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-009400
Vuln IDs
  • V-261938
Rule IDs
  • SV-261938r1000819_rule
Changes to the security configuration must be tracked. This requirement applies to situations where security data is retrieved or modified via data manipulation operations, as opposed to via specialized security functionality. In an SQL environment, types of access include, but are not necessarily limited to: SELECT INSERT UPDATE DELETE EXECUTE
Checks: C-65792r1000817_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain pgaudit, this is a finding. Verify that role, read, write, and ddl auditing are enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, read, write, and ddl, this is a finding.

Fix: F-65700r1000818_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. PostgreSQL can be configured to audit these requests using pgaudit.. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed, the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log='ddl, role, read, write' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to access security objects occur.
AU-12 - Medium - CCI-000172 - V-261939 - SV-261939r1000822_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-009500
Vuln IDs
  • V-261939
Rule IDs
  • SV-261939r1000822_rule
Changes to the security configuration must be tracked. This requirement applies to situations where security data is retrieved or modified via data manipulation operations, as opposed to via specialized security functionality. In an SQL environment, types of access include, but are not limited to: SELECT INSERT UPDATE DELETE EXECUTE To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.
Checks: C-65793r1000820_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), setup a test schema and revoke users privileges from using it by running the following SQL: $ sudo su - postgres $ psql -c "CREATE SCHEMA stig_test_schema AUTHORIZATION postgres" $ psql -c "REVOKE ALL ON SCHEMA stig_test_schema FROM public" $ psql -c "GRANT ALL ON SCHEMA stig_test_schema TO postgres" Create a test table and insert a value into that table for the following checks by running the following SQL: $ psql -c "CREATE TABLE stig_test_schema.stig_test_table(id INT)" $ psql -c "INSERT INTO stig_test_schema.stig_test_table(id) VALUES (0)" #### CREATE Attempt to CREATE a table in the stig_test_schema schema with a role that does not have privileges by running the following SQL: psql -c "CREATE ROLE bob; SET ROLE bob; CREATE TABLE stig_test_schema.test_table(id INT);" ERROR: permission denied for schema stig_test_schema As a database administrator (shown here as "postgres"), verify that the denial was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-03-09 09:55:19.423 UTC postgres 56e0393f.186b postgres: &gt;ERROR: permission denied for schema stig_test_schema at character 14 &lt; 2024-03-09 09:55:19.423 UTC postgres 56e0393f.186b postgres: &gt;STATEMENT: CREATE TABLE stig_test_schema.test_table(id INT); If the denial is not logged, this is a finding. #### INSERT As role bob, attempt to INSERT into the table created earlier, stig_test_table by running the following SQL: $ sudo su - postgres $ psql -c "SET ROLE bob; INSERT INTO stig_test_schema.stig_test_table(id) VALUES (0);" As a database administrator (shown here as "postgres"), verify that the denial was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-03-09 09:58:30.709 UTC postgres 56e0393f.186b postgres: &gt;ERROR: permission denied for schema stig_test_schema at character 13 &lt; 2024-03-09 09:58:30.709 UTC postgres 56e0393f.186b postgres: &gt;STATEMENT: INSERT INTO stig_test_schema.stig_test_table(id) VALUES (0); If the denial is not logged, this is a finding. #### SELECT As role bob, attempt to SELECT from the table created earlier, stig_test_table by running the following SQL: $ sudo su - postgres $ psql -c "SET ROLE bob; SELECT * FROM stig_test_schema.stig_test_table;" As a database administrator (shown here as "postgres"), verify that the denial was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-03-09 09:57:58.327 UTC postgres 56e0393f.186b postgres: &gt;ERROR: permission denied for schema stig_test_schema at character 15 &lt; 2024-03-09 09:57:58.327 UTC postgres 56e0393f.186b postgres: &gt;STATEMENT: SELECT * FROM stig_test_schema.stig_test_table; If the denial is not logged, this is a finding. #### ALTER As role bob, attempt to ALTER the table created earlier, stig_test_table by running the following SQL: $ sudo su - postgres $ psql -c "SET ROLE bob; ALTER TABLE stig_test_schema.stig_test_table ADD COLUMN name TEXT;" As a database administrator (shown here as "postgres"), verify that the denial was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-03-09 10:03:43.765 UTC postgres 56e0393f.186b postgres: &gt;STATEMENT: ALTER TABLE stig_test_schema.stig_test_table ADD COLUMN name TEXT; If the denial is not logged, this is a finding. #### UPDATE As role bob, attempt to UPDATE a row created earlier, stig_test_table by running the following SQL: $ sudo su - postgres $ psql -c "SET ROLE bob; UPDATE stig_test_schema.stig_test_table SET id=1 WHERE id=0;" As a database administrator (shown here as "postgres"), verify that the denial was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-03-09 10:08:27.696 UTC postgres 56e0393f.186b postgres: &gt;ERROR: permission denied for schema stig_test_schema at character 8 &lt; 2024-03-09 10:08:27.696 UTC postgres 56e0393f.186b postgres: &gt;STATEMENT: UPDATE stig_test_schema.stig_test_table SET id=1 WHERE id=0; If the denial is not logged, this is a finding. #### DELETE As role bob, attempt to DELETE a row created earlier, stig_test_table by running the following SQL: $ sudo su - postgres $ psql -c "SET ROLE bob; DELETE FROM stig_test_schema.stig_test_table WHERE id=0;" As a database administrator (shown here as "postgres"), verify that the denial was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-03-09 10:09:29.607 UTC postgres 56e0393f.186b postgres: &gt;ERROR: permission denied for schema stig_test_schema at character 13 &lt; 2024-03-09 10:09:29.607 UTC postgres 56e0393f.186b postgres: &gt;STATEMENT: DELETE FROM stig_test_schema.stig_test_table WHERE id=0; If the denial is not logged, this is a finding. #### PREPARE As role bob, attempt to execute a prepared system using PREPARE by running the following SQL: $ sudo su - postgres $ psql -c "SET ROLE bob; PREPARE stig_test_plan(int) AS SELECT id FROM stig_test_schema.stig_test_table WHERE id=$1;" As a database administrator (shown here as "postgres"), verify that the denial was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-03-09 10:16:22.628 UTC postgres 56e03e02.18e4 postgres: &gt;ERROR: permission denied for schema stig_test_schema at character 46 &lt; 2024-03-09 10:16:22.628 UTC postgres 56e03e02.18e4 postgres: &gt;STATEMENT: PREPARE stig_test_plan(int) AS SELECT id FROM stig_test_schema.stig_test_table WHERE id=$1; If the denial is not logged, this is a finding. #### DROP As role bob, attempt to DROP the table created earlier stig_test_table by running the following SQL: $ sudo su - postgres $ psql -c "SET ROLE bob; DROP TABLE stig_test_schema.stig_test_table;" As a database administrator (shown here as "postgres"), verify that the denial was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-03-09 10:18:55.255 UTC postgres 56e03e02.18e4 postgres: &gt;ERROR: permission denied for schema stig_test_schema &lt; 2024-03-09 10:18:55.255 UTC postgres 56e03e02.18e4 postgres: &gt;STATEMENT: DROP TABLE stig_test_schema.stig_test_table; If the denial is not logged, this is a finding.

Fix: F-65701r1000821_fix

Configure PostgreSQL to produce audit records when unsuccessful attempts to access security objects occur. All denials are logged if logging is enabled. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C.

b
PostgreSQL must generate audit records when categories of information (e.g., classification levels/security levels) are accessed.
AU-12 - Medium - CCI-000172 - V-261940 - SV-261940r1000825_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-009600
Vuln IDs
  • V-261940
Rule IDs
  • SV-261940r1000825_rule
Changes in categories of information must be tracked. Without an audit trail, unauthorized access to protected data could go undetected. For detailed information on categorizing information, refer to FIPS Publication 199, Standards for Security Categorization of federal information and information systems, and FIPS Publication 200, Minimum Security Requirements for federal information and information systems.
Checks: C-65794r1000823_chk

As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "SHOW pgaudit.log" If pgaudit.log does not contain, "ddl, write, role", this is a finding.

Fix: F-65702r1000824_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. The DBMS (PostgreSQL) can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log = 'ddl, write, role' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql- ${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to access categories of information (e.g., classification levels/security levels) occur.
AU-12 - Medium - CCI-000172 - V-261941 - SV-261941r1000828_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-009700
Vuln IDs
  • V-261941
Rule IDs
  • SV-261941r1000828_rule
Changes in categories of information must be tracked. Without an audit trail, unauthorized access to protected data could go undetected. To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones. For detailed information on categorizing information, refer to FIPS Publication 199, Standards for Security Categorization of federal information and information systems, and FIPS Publication 200, Minimum Security Requirements for federal information and information systems.
Checks: C-65795r1000826_chk

As the database administrator (shown here as "postgres"), run the following SQL: $ sudo su - postgres $ psql -c "SHOW pgaudit.log" If pgaudit.log does not contain, "ddl, write, role", this is a finding.

Fix: F-65703r1000827_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. Configure PostgreSQL to produce audit records when unsuccessful attempts to access categories of information occur. All denials are logged if logging is enabled. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. With pgaudit installed the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log = 'ddl, write, role' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when privileges/permissions are added.
AU-12 - Medium - CCI-000172 - V-261942 - SV-261942r1000831_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-009800
Vuln IDs
  • V-261942
Rule IDs
  • SV-261942r1000831_rule
Changes in the permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized elevation or restriction of privileges could go undetected. Elevated privileges give users access to information and functionality that they should not have; restricted privileges wrongly deny access to authorized users. In an SQL environment, adding permissions is typically done via the GRANT command, or, in the negative, the DENY command.
Checks: C-65796r1000829_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), create a role by running the following SQL: Change the privileges of another user: $ sudo su - postgres $ psql -c "CREATE ROLE bob" GRANT then REVOKE privileges from the role: $ psql -c "GRANT CONNECT ON DATABASE postgres TO bob" $ psql -c "REVOKE CONNECT ON DATABASE postgres FROM bob" postgres=# REVOKE CONNECT ON DATABASE postgres FROM bob; REVOKE postgres=# GRANT CONNECT ON DATABASE postgres TO bob; GRANT As the database administrator (shown here as "postgres"), verify the events were logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-07-13 16:25:21.103 EDT postgres postgres LOG: &gt; AUDIT: SESSION,1,1,ROLE,GRANT,,,GRANT CONNECT ON DATABASE postgres TO bob,&lt;none&gt; &lt; 2024-07-13 16:25:25.520 EDT postgres postgres LOG: &gt; AUDIT: SESSION,1,1,ROLE,REVOKE,,,REVOKE CONNECT ON DATABASE postgres FROM bob,&lt;none&gt; If the above steps cannot verify that audit records are produced when privileges/permissions/role memberships are added, this is a finding.

Fix: F-65704r1000830_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. PostgreSQL can be configured to audit these requests using pgaudit,. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed, the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log = 'role' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to add privileges/permissions occur.
AU-12 - Medium - CCI-000172 - V-261943 - SV-261943r1000834_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-009900
Vuln IDs
  • V-261943
Rule IDs
  • SV-261943r1000834_rule
Failed attempts to change the permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized attempts to elevate or restrict privileges could go undetected. In an SQL environment, adding permissions is typically done via the GRANT command, or, in the negative, the DENY command. To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.
Checks: C-65797r1000832_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), create a role "bob" and a test table by running the following SQL: $ sudo su - postgres $ psql -c "CREATE ROLE bob; CREATE TABLE test(id INT);" Set current role to "bob" and attempt to modify privileges: $ psql -c "SET ROLE bob; GRANT ALL PRIVILEGES ON test TO bob;" As the database administrator (shown here as "postgres"), verify the unsuccessful attempt was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; 2024-07-14 18:12:23.208 EDT postgres postgres ERROR: permission denied for relation test 2024-07-14 18:12:23.208 EDT postgres postgres STATEMENT: GRANT ALL PRIVILEGES ON test TO bob; If audit logs are not generated when unsuccessful attempts to add privileges/permissions occur, this is a finding.

Fix: F-65705r1000833_fix

Configure PostgreSQL to produce audit records when unsuccessful attempts to add privileges occur. All denials are logged by default if logging is enabled. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging.

b
PostgreSQL must generate audit records when privileges/permissions are modified.
AU-12 - Medium - CCI-000172 - V-261944 - SV-261944r1000837_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-010000
Vuln IDs
  • V-261944
Rule IDs
  • SV-261944r1000837_rule
Changes in the permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized elevation or restriction of privileges could go undetected. Elevated privileges give users access to information and functionality that they should not have; restricted privileges wrongly deny access to authorized users. In an SQL environment, modifying permissions is typically done via the GRANT, REVOKE, and DENY commands.
Checks: C-65798r1000835_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain pgaudit, this is a finding. Verify that role is enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, this is a finding.

Fix: F-65706r1000836_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. PostgreSQL can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed, the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log='role' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to modify privileges/permissions occur.
AU-12 - Medium - CCI-000172 - V-261945 - SV-261945r1000840_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-010100
Vuln IDs
  • V-261945
Rule IDs
  • SV-261945r1000840_rule
Failed attempts to change the permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized attempts to elevate or restrict privileges could go undetected. In an SQL environment, modifying permissions is typically done via the GRANT, REVOKE, and DENY commands. To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.
Checks: C-65799r1000838_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), create a role "bob" and a test table by running the following SQL: $ sudo su - postgres $ psql -c "CREATE ROLE bob; CREATE TABLE test(id INT)" Set current role to "bob" and attempt to modify privileges: $ psql -c "SET ROLE bob; GRANT ALL PRIVILEGES ON test TO bob;" $ psql -c "SET ROLE bob; REVOKE ALL PRIVILEGES ON test FROM bob;" As the database administrator (shown here as "postgres"), verify the unsuccessful attempt was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; 2024-07-14 18:12:23.208 EDT postgres postgres ERROR: permission denied for relation test 2024-07-14 18:12:23.208 EDT postgres postgres STATEMENT: GRANT ALL PRIVILEGES ON test TO bob; 2024-07-14 18:14:52.895 EDT postgres postgres ERROR: permission denied for relation test 2024-07-14 18:14:52.895 EDT postgres postgres STATEMENT: REVOKE ALL PRIVILEGES ON test FROM bob; If audit logs are not generated when unsuccessful attempts to modify privileges/permissions occur, this is a finding.

Fix: F-65707r1000839_fix

Configure PostgreSQL to produce audit records when unsuccessful attempts to modify privileges occur. All denials are logged by default if logging is enabled. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C.

b
PostgreSQL must generate audit records when security objects are modified.
AU-12 - Medium - CCI-000172 - V-261946 - SV-261946r1000843_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-010200
Vuln IDs
  • V-261946
Rule IDs
  • SV-261946r1000843_rule
Changes in the database objects (tables, views, procedures, functions) that record and control permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized changes to the security subsystem could go undetected. The database could be severely compromised or rendered inoperative.
Checks: C-65800r1000841_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the results does not contain pgaudit, this is a finding. Verify that role, read, write, and ddl auditing are enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, read, write, and ddl, this is a finding. Verify that accessing the catalog is audited by running the following SQL: $ psql -c "SHOW pgaudit.log_catalog" If log_catalog is not on, this is a finding.

Fix: F-65708r1000842_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. PostgreSQL can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed, the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log_catalog = 'on' pgaudit.log='ddl, role, read, write' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to modify security objects occur.
AU-12 - Medium - CCI-000172 - V-261947 - SV-261947r1000846_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-010300
Vuln IDs
  • V-261947
Rule IDs
  • SV-261947r1000846_rule
Changes in the database objects (tables, views, procedures, functions) that record and control permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized changes to the security subsystem could go undetected. The database could be severely compromised or rendered inoperative. To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.
Checks: C-65801r1000844_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), create a test role by running the following SQL: $ sudo su - postgres $ psql -c "CREATE ROLE bob" To test if audit records are generated from unsuccessful attempts at modifying security objects, run the following SQL: $ sudo su - postgres $ psql -c "SET ROLE bob; UPDATE pg_authid SET rolsuper = 't' WHERE rolname = 'bob';" As the database administrator (shown here as "postgres"), verify the denials were logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-03-17 10:34:00.017 EDT bob 56eabf52.b62 postgres: &gt;ERROR: permission denied for relation pg_authid &lt; 2024-03-17 10:34:00.017 EDT bob 56eabf52.b62 postgres: &gt;STATEMENT: UPDATE pg_authid SET rolsuper = 't' WHERE rolname = 'bob'; If denials are not logged, this is a finding.

Fix: F-65709r1000845_fix

Configure PostgreSQL to produce audit records when unsuccessful attempts to modify security objects occur. Unsuccessful attempts to modify security objects can be logged if logging is enabled. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging.

b
PostgreSQL must generate audit records when categories of information (e.g., classification levels/security levels) are modified.
AU-12 - Medium - CCI-000172 - V-261948 - SV-261948r1000849_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-010400
Vuln IDs
  • V-261948
Rule IDs
  • SV-261948r1000849_rule
Changes in categories of information must be tracked. Without an audit trail, unauthorized access to protected data could go undetected. For detailed information on categorizing information, refer to FIPS Publication 199, Standards for Security Categorization of federal information and information systems, and FIPS Publication 200, Minimum Security Requirements for federal information and information systems.
Checks: C-65802r1000847_chk

If category tracking is not required in the database, this is not applicable. As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain pgaudit, this is a finding. Verify that role, read, write, and ddl auditing are enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, read, write, and ddl, this is a finding.

Fix: F-65710r1000848_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. PostgreSQL can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log='ddl, role, read, write' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to modify categories of information (e.g., classification levels/security levels) occur.
AU-12 - Medium - CCI-000172 - V-261949 - SV-261949r1000852_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-010500
Vuln IDs
  • V-261949
Rule IDs
  • SV-261949r1000852_rule
Changes in categories of information must be tracked. Without an audit trail, unauthorized access to protected data could go undetected. To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones. For detailed information on categorizing information, refer to FIPS Publication 199, Standards for Security Categorization of federal information and information systems, and FIPS Publication 200, Minimum Security Requirements for federal information and information systems.
Checks: C-65803r1000850_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain "pgaudit", this is a finding. Verify that role, read, write, and ddl auditing are enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, read, write, and ddl, this is a finding.

Fix: F-65711r1000851_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. Configure PostgreSQL to produce audit records when unsuccessful attempts to modify categories of information occur. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. All denials are logged when logging is enabled. With pgaudit installed the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log='ddl, role, read, write' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when privileges/permissions are deleted.
AU-12 - Medium - CCI-000172 - V-261950 - SV-261950r1000855_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-010600
Vuln IDs
  • V-261950
Rule IDs
  • SV-261950r1000855_rule
Changes in the permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized elevation or restriction of privileges could go undetected. Elevated privileges give users access to information and functionality that they should not have; restricted privileges wrongly deny access to authorized users. In an SQL environment, deleting permissions is typically done via the REVOKE or DENY command.
Checks: C-65804r1000853_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain pgaudit, this is a finding. Verify that role, read, write, and ddl auditing are enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, read, write, and ddl, this is a finding.

Fix: F-65712r1000854_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. PostgreSQL can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed, the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log = 'role' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to delete privileges/permissions occur.
AU-12 - Medium - CCI-000172 - V-261951 - SV-261951r1000858_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-010700
Vuln IDs
  • V-261951
Rule IDs
  • SV-261951r1000858_rule
Failed attempts to change the permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized attempts to elevate or restrict privileges could go undetected. In an SQL environment, deleting permissions is typically done via the REVOKE or DENY command. To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.
Checks: C-65805r1000856_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), create the roles "joe" and "bob" with LOGIN by running the following SQL: $ sudo su - postgres $ psql -c "CREATE ROLE joe LOGIN" $ psql -c "CREATE ROLE bob LOGIN" Set current role to "bob" and attempt to alter the role "joe": $ psql -c "SET ROLE bob; ALTER ROLE joe NOLOGIN;" As the database administrator (shown here as "postgres"), verify the denials are logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-03-17 11:28:10.004 UTC bob 56eacd05.cda postgres: &gt;ERROR: permission denied to alter role &lt; 2024-03-17 11:28:10.004 UTC bob 56eacd05.cda postgres: &gt;STATEMENT: ALTER ROLE joe; If audit logs are not generated when unsuccessful attempts to delete privileges/permissions occur, this is a finding.

Fix: F-65713r1000857_fix

Configure PostgreSQL to produce audit records when unsuccessful attempts to delete privileges occur. All denials are logged if logging is enabled. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging.

b
PostgreSQL must generate audit records when security objects are deleted.
AU-12 - Medium - CCI-000172 - V-261952 - SV-261952r1000861_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-010800
Vuln IDs
  • V-261952
Rule IDs
  • SV-261952r1000861_rule
The removal of security objects from the database/PostgreSQL would seriously degrade a system's information assurance posture. If such an event occurs, it must be logged.
Checks: C-65806r1000859_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), create a test table stig_test, enable row level security, and create a policy by running the following SQL: $ sudo su - postgres $ psql -c "CREATE TABLE stig_test(id INT)" $ psql -c "ALTER TABLE stig_test ENABLE ROW LEVEL SECURITY" $ psql -c "CREATE POLICY lock_table ON stig_test USING ('postgres' = current_user)" Drop the policy and disable row level security: $ psql -c "DROP POLICY lock_table ON stig_test" $ psql -c "ALTER TABLE stig_test DISABLE ROW LEVEL SECURITY" As the database administrator (shown here as "postgres"), verify the security objects deletions were logged: $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; 2024-03-30 14:54:18.991 UTC postgres postgres LOG: AUDIT: SESSION,11,1,DDL,DROP POLICY,,,DROP POLICY lock_table ON stig_test;,&lt;none&gt; 2024-03-30 14:54:42.373 UTC postgres postgres LOG: AUDIT: SESSION,12,1,DDL,ALTER TABLE,,,ALTER TABLE stig_test DISABLE ROW LEVEL SECURITY;,&lt;none&gt; If audit records are not produced when security objects are dropped, this is a finding.

Fix: F-65714r1000860_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. PostgreSQL can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log = 'ddl' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to delete security objects occur.
AU-12 - Medium - CCI-000172 - V-261953 - SV-261953r1000864_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-010900
Vuln IDs
  • V-261953
Rule IDs
  • SV-261953r1000864_rule
The removal of security objects from the database/PostgreSQL would seriously degrade a system's information assurance posture. If such an action is attempted, it must be logged. To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.
Checks: C-65807r1000862_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain pgaudit, this is a finding. Verify that role, read, write, and ddl auditing are enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, read, write, and ddl, this is a finding.

Fix: F-65715r1000863_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. Configure PostgreSQL to produce audit records when unsuccessful attempts to delete security objects occur. All errors and denials are logged if logging is enabled. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. With pgaudit installed the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log='ddl, role, read, write' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when categories of information (e.g., classification levels/security levels) are deleted.
AU-12 - Medium - CCI-000172 - V-261954 - SV-261954r1000867_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-011000
Vuln IDs
  • V-261954
Rule IDs
  • SV-261954r1000867_rule
Changes in categories of information must be tracked. Without an audit trail, unauthorized access to protected data could go undetected. For detailed information on categorizing information, refer to FIPS Publication 199, Standards for Security Categorization of federal information and information systems, and FIPS Publication 200, Minimum Security Requirements for federal information and information systems.
Checks: C-65808r1000865_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain "pgaudit", this is a finding. Verify that role, read, write, and ddl auditing are enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, read, write, and ddl, this is a finding.

Fix: F-65716r1000866_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging. PostgreSQL can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed, the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log='ddl, role, read, write' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to delete categories of information (e.g., classification levels/security levels) occur.
AU-12 - Medium - CCI-000172 - V-261955 - SV-261955r1000870_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-011100
Vuln IDs
  • V-261955
Rule IDs
  • SV-261955r1000870_rule
Changes in categories of information must be tracked. Without an audit trail, unauthorized access to protected data could go undetected. To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones. For detailed information on categorizing information, refer to FIPS Publication 199, Standards for Security Categorization of federal information and information systems, and FIPS Publication 200, Minimum Security Requirements for federal information and information systems.
Checks: C-65809r1000868_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain "pgaudit", this is a finding. Verify that role, read, write, and ddl auditing are enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, read, write, and ddl, this is a finding.

Fix: F-65717r1000869_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. All errors and denials are logged if logging is enabled. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging. PostgreSQL can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log='ddl, role, read, write' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when successful logons or connections occur.
AU-12 - Medium - CCI-000172 - V-261956 - SV-261956r1000975_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-011200
Vuln IDs
  • V-261956
Rule IDs
  • SV-261956r1000975_rule
For completeness of forensic analysis, it is necessary to track who/what (a user or other principal) logs on to PostgreSQL.
Checks: C-65810r1000975_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), check if log_connections is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_connections" If log_connections is off, this is a finding. Verify the logs that the previous connection to the database was logged: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-02-16 15:54:03.934 UTC postgres postgres 56c64b8b.aeb: &gt;LOG: connection authorized: user=postgres database=postgres If an audit record is not generated each time a user (or other principal) logs on or connects to PostgreSQL, this is a finding.

Fix: F-65718r1000872_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. If logging is enabled the following configurations must be made to log connections, date/time, username, and session identifier. As the database administrator (shown here as "postgres"), edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Edit the following parameters as such: log_connections = on log_line_prefix = '< %m %u %d %c: >' Where: * %m is the time and date * %u is the username * %d is the database * %c is the session ID for the connection As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful logons or connection attempts occur.
AU-12 - Medium - CCI-000172 - V-261957 - SV-261957r1000876_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-011300
Vuln IDs
  • V-261957
Rule IDs
  • SV-261957r1000876_rule
For completeness of forensic analysis, it is necessary to track failed attempts to log on to PostgreSQL. While positive identification may not be possible in a case of failed authentication, as much information as possible about the incident must be captured.
Checks: C-65811r1000874_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I on PGLOG. In this example the user "joe" will log in to the Postgres database unsuccessfully: $ psql -d postgres -U joe As the database administrator (shown here as "postgres"), check ${PGLOG?} for a FATAL connection audit trail: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/{latest_log&gt; &lt; 2024-02-16 16:18:13.027 UTC joe 56c65135.b5f postgres: &gt;LOG: connection authorized: user=joe database=postgres &lt; 2024-02-16 16:18:13.027 UTC joe 56c65135.b5f postgres: &gt;FATAL: role "joe" does not exist If an audit record is not generated each time a user (or other principal) attempts, but fails to log on or connect to PostgreSQL (including attempts where the user ID is invalid/unknown), this is a finding.

Fix: F-65719r1000875_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. If logging is enabled the following configurations must be made to log unsuccessful connections, date/time, username, and session identifier. As the database administrator (shown here as "postgres"), edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Edit the following parameters: log_connections = on log_line_prefix = '< %m %u %c: >' Where: * %m is the time and date * %u is the username * %c is the session ID for the connection As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records for all privileged activities or other system-level access.
AU-12 - Medium - CCI-000172 - V-261958 - SV-261958r1000879_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-011400
Vuln IDs
  • V-261958
Rule IDs
  • SV-261958r1000879_rule
Without tracking privileged activity, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. System documentation should include a definition of the functionality considered privileged. A privileged function in this context is any operation that modifies the structure of the database, its built-in logic, or its security settings. This would include all Data Definition Language (DDL) statements and all security-related statements. In an SQL environment, it encompasses, but is not necessarily limited to: CREATE ALTER DROP GRANT REVOKE DENY There may also be Data Manipulation Language (DML) statements that, subject to context, should be regarded as privileged. Possible examples in SQL include: TRUNCATE TABLE; DELETE, or DELETE affecting more than n rows, for some n, or DELETE without a WHERE clause; UPDATE or UPDATE affecting more than n rows, for some n, or UPDATE without a WHERE clause; any SELECT, INSERT, UPDATE, or DELETE to an application-defined security table executed by other than a security principal. Depending on the capabilities of PostgreSQL and the design of the database and associated applications, audit logging may be achieved by means of PostgreSQL auditing features, database triggers, other mechanisms, or a combination of these. Note that it is particularly important to audit and tightly control any action that weakens the implementation of this requirement itself, since the objective is to have a complete audit trail of all administrative activity.
Checks: C-65812r1000877_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain pgaudit, this is a finding. Verify that role, read, write, and ddl auditing are enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, read, write, and ddl, this is a finding.

Fix: F-65720r1000878_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. PostgreSQL can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed the following configurations can be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): shared_preload_libraries = 'pgaudit' pgaudit.log='ddl, role, read, write' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful attempts to execute privileged activities or other system-level access occur.
AU-12 - Medium - CCI-000172 - V-261959 - SV-261959r1000882_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-011500
Vuln IDs
  • V-261959
Rule IDs
  • SV-261959r1000882_rule
Without tracking privileged activity, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. System documentation should include a definition of the functionality considered privileged. A privileged function in this context is any operation that modifies the structure of the database, its built-in logic, or its security settings. This would include all Data Definition Language (DDL) statements and all security-related statements. In an SQL environment, it encompasses, but is not necessarily limited to: CREATE ALTER DROP GRANT REVOKE DENY Note that it is particularly important to audit and tightly control any action that weakens the implementation of this requirement itself, since the objective is to have a complete audit trail of all administrative activity. To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.
Checks: C-65813r1000880_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I on PGLOG. As the database administrator (shown here as "postgres"), create the role "bob" by running the following SQL: $ sudo su - postgres $ psql -c "CREATE ROLE bob" Change the current role to bob and attempt to execute privileged activity: $ psql -c "CREATE ROLE stig_test SUPERUSER" $ psql -c "CREATE ROLE stig_test CREATEDB" $ psql -c "CREATE ROLE stig_test CREATEROLE" $ psql -c "CREATE ROLE stig_test CREATEUSER" As the database administrator (shown here as "postgres"), verify that an audit event was produced (use the latest log): $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-02-23 20:16:32.396 UTC postgres 56cfa74f.79eb postgres: &gt;ERROR: must be superuser to create superusers &lt; 2024-02-23 20:16:32.396 UTC postgres 56cfa74f.79eb postgres: &gt;STATEMENT: CREATE ROLE stig_test SUPERUSER; &lt; 2024-02-23 20:16:48.725 UTC postgres 56cfa74f.79eb postgres: &gt;ERROR: permission denied to create role &lt; 2024-02-23 20:16:48.725 UTC postgres 56cfa74f.79eb postgres: &gt;STATEMENT: CREATE ROLE stig_test CREATEDB; &lt; 2024-02-23 20:16:54.365 UTC postgres 56cfa74f.79eb postgres: &gt;ERROR: permission denied to create role &lt; 2024-02-23 20:16:54.365 UTC postgres 56cfa74f.79eb postgres: &gt;STATEMENT: CREATE ROLE stig_test CREATEROLE; &lt; 2024-02-23 20:17:05.949 UTC postgres 56cfa74f.79eb postgres: &gt;ERROR: must be superuser to create superusers &lt; 2024-02-23 20:17:05.949 UTC postgres 56cfa74f.79eb postgres: &gt;STATEMENT: CREATE ROLE stig_test CREATEUSER; If audit records are not produced, this is a finding.

Fix: F-65721r1000881_fix

Configure PostgreSQL to produce audit records when unsuccessful attempts to execute privileged SQL. All denials are logged by default if logging is enabled. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C.

b
PostgreSQL must generate audit records showing starting and ending time for user access to the database(s).
AU-12 - Medium - CCI-000172 - V-261960 - SV-261960r1000885_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-011600
Vuln IDs
  • V-261960
Rule IDs
  • SV-261960r1000885_rule
For completeness of forensic analysis, it is necessary to know how long a user's (or other principal's) connection to PostgreSQL lasts. This can be achieved by recording disconnections, in addition to logons/connections, in the audit logs. Disconnection may be initiated by the user or forced by the system (as in a timeout) or result from a system or network failure. To the greatest extent possible, all disconnections must be logged.
Checks: C-65814r1000883_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. Log into the database with the postgres user by running the following commands: $ sudo su - postgres $ psql -U postgres As the database administrator, verify the log for a connection audit trail: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; &lt; 2024-02-23 20:25:39.931 UTC postgres 56cfa993.7a72 postgres: &gt;LOG: connection authorized: user=postgres database=postgres &lt; 2024-02-23 20:27:45.428 UTC postgres 56cfa993.7a72 postgres: &gt;LOG: AUDIT: SESSION,1,1,READ,SELECT,,,SELECT current_user;,&lt;none&gt; &lt; 2024-02-23 20:27:47.988 UTC postgres 56cfa993.7a72 postgres: &gt;LOG: disconnection: session time: 0:00:08.057 user=postgres database=postgres host=[local] If connections are not logged, this is a finding.

Fix: F-65722r1000884_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C. If logging is enabled the following configurations must be made to log connections, date/time, username, and session identifier. As the database administrator (shown here as "postgres"), edit postgresql.conf by running the following: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Edit the following parameters: log_connections = on log_disconnections = on log_line_prefix = '< %m %u %c: >' Where: * %m is the time and date * %u is the username * %c is the session ID for the connection As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when concurrent logons/connections by the same user from different workstations occur.
AU-12 - Medium - CCI-000172 - V-261961 - SV-261961r1000888_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-011700
Vuln IDs
  • V-261961
Rule IDs
  • SV-261961r1000888_rule
For completeness of forensic analysis, it is necessary to track who logs on to PostgreSQL. Concurrent connections by the same user from multiple workstations may be valid use of the system; or such connections may be due to improper circumvention of the requirement to use the Common Access Card (CAC) for authentication; or they may indicate unauthorized account sharing; or they may be because an account has been compromised. If multiple, concurrent logons by a given user can be reliably reconstructed from the log entries for other events (logons/connections; voluntary and involuntary disconnections), then it is not mandatory to create additional log entries specifically for this.
Checks: C-65815r1000886_chk

As the database administrator, verify that log_connections and log_disconnections are enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_connections" $ psql -c "SHOW log_disconnections" If either is off, this is a finding. Verify that log_line_prefix contains sufficient information by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_line_prefix" If log_line_prefix does not contain at least %m %u %d %c, this is a finding.

Fix: F-65723r1000887_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging. As the database administrator (shown here as "postgres"), edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Edit the following parameters as such: log_connections = on log_disconnections = on log_line_prefix = '< %m %u %d %c: >' Where: * %m is the time and date * %u is the username * %d is the database * %c is the session ID for the connection As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must be able to generate audit records when successful accesses to objects occur.
AU-12 - Medium - CCI-000172 - V-261962 - SV-261962r1000891_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-011800
Vuln IDs
  • V-261962
Rule IDs
  • SV-261962r1000891_rule
Without tracking all or selected types of access to all or selected objects (tables, views, procedures, functions, etc.), it would be difficult to establish, correlate, and investigate the events relating to an incident, or identify those responsible for one. In an SQL environment, types of access include, but are not necessarily limited to: SELECT INSERT UPDATE DELETE EXECUTE
Checks: C-65816r1000889_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain "pgaudit", this is a finding. Verify that role, read, write, and ddl auditing are enabled: $ psql -c "SHOW pgaudit.log" If the output does not contain role, read, write, and ddl, this is a finding.

Fix: F-65724r1000890_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging. If logging is enabled, the following configurations must be made to log unsuccessful connections, date/time, username, and session identifier. As the database administrator (shown here as "postgres"), edit postgresql.conf: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Edit the following parameters: log_connections = on log_line_prefix = '< %m %u %c: >' pgaudit.log = 'read, write' Where: * %m is the time and date * %u is the username * %c is the session ID for the connection As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must generate audit records when unsuccessful accesses to objects occur.
AU-12 - Medium - CCI-000172 - V-261963 - SV-261963r1000894_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-011900
Vuln IDs
  • V-261963
Rule IDs
  • SV-261963r1000894_rule
Without tracking all or selected types of access to all or selected objects (tables, views, procedures, functions, etc.), it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. In an SQL environment, types of access include, but are not limited to: SELECT INSERT UPDATE DELETE EXECUTE To aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.
Checks: C-65817r1000892_chk

Note: The following instructions use the PGDATA and PGLOG environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-I for PGLOG. As the database administrator (shown here as "postgres"), create a schema, test_schema, create a table, test_table, within test_schema, and insert a value: $ sudo su - postgres $ psql -c "CREATE SCHEMA test_schema" $ psql -c "CREATE TABLE test_schema.test_table(id INT)" $ psql -c "INSERT INTO test_schema.test_table(id) VALUES (0)" Create a role "bob" and attempt to SELECT, INSERT, UPDATE, and DROP from the test table: $ psql -c "CREATE ROLE BOB" $ psql -c "SET ROLE bob; SELECT * FROM test_schema.test_table" $ psql -c "SET ROLE bob; INSERT INTO test_schema.test_table VALUES (0)" $ psql -c "SET ROLE bob; UPDATE test_schema.test_table SET id = 1 WHERE id = 0" $ psql -c "SET ROLE bob; DROP TABLE test_schema.test_table" $ psql -c "SET ROLE bob; DROP SCHEMA test_schema" As the database administrator (shown here as "postgres"), review PostgreSQL/database security and audit settings to verify that audit records are created for unsuccessful attempts at the specified access to the specified objects: $ sudo su - postgres $ cat ${PGDATA?}/${PGLOG?}/&lt;latest_log&gt; 2024-03-30 17:23:41.254 EDT postgres postgres ERROR: permission denied for schema test_schema at character 15 2024-03-30 17:23:41.254 EDT postgres postgres STATEMENT: SELECT * FROM test_schema.test_table; 2024-03-30 17:23:53.973 EDT postgres postgres ERROR: permission denied for schema test_schema at character 13 2024-03-30 17:23:53.973 EDT postgres postgres STATEMENT: INSERT INTO test_schema.test_table VALUES (0); 2024-03-30 17:24:32.647 EDT postgres postgres ERROR: permission denied for schema test_schema at character 8 2024-03-30 17:24:32.647 EDT postgres postgres STATEMENT: UPDATE test_schema.test_table SET id = 1 WHERE id = 0; 2024-03-30 17:24:46.197 EDT postgres postgres ERROR: permission denied for schema test_schema 2024-03-30 17:24:46.197 EDT postgres postgres STATEMENT: DROP TABLE test_schema.test_table; 2024-03-30 17:24:51.582 EDT postgres postgres ERROR: must be owner of schema test_schema 2024-03-30 17:24:51.582 EDT postgres postgres STATEMENT: DROP SCHEMA test_schema; If any of the above steps did not create audit records for SELECT, INSERT, UPDATE, and DROP, this is a finding.

Fix: F-65725r1000893_fix

Configure PostgreSQL to produce audit records when unsuccessful attempts to access objects occur. All errors and denials are logged if logging is enabled. To ensure logging is enabled, see the instructions in the supplementary content APPENDIX-C.

b
PostgreSQL must generate audit records for all direct access to the database(s).
AU-12 - Medium - CCI-000172 - V-261964 - SV-261964r1000897_rule
RMF Control
AU-12
Severity
Medium
CCI
CCI-000172
Version
CD16-00-012000
Vuln IDs
  • V-261964
Rule IDs
  • SV-261964r1000897_rule
In this context, direct access is any query, command, or call to PostgreSQL that comes from any source other than the application(s) that it supports. Examples would be the command line or a database management utility program. The intent is to capture all activity from administrative and nonstandard sources.
Checks: C-65818r1000895_chk

As the database administrator, verify pgaudit is enabled by running the following SQL: $ sudo su - postgres $ psql -c "SHOW shared_preload_libraries" If the output does not contain "pgaudit", this is a finding. Verify that connections and disconnections are being logged by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_connections" $ psql -c "SHOW log_disconnections" If the output does not contain "on", this is a finding.

Fix: F-65726r1000896_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging. PostgreSQL can be configured to audit these requests using pgaudit. Refer to supplementary content APPENDIX-B for documentation on installing pgaudit. With pgaudit installed, the following configurations should be made: $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf Add the following parameters (or edit existing parameters): pgaudit.log='ddl, role, read, write' log_connections='on' log_disconnections='on' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}

b
PostgreSQL must implement NIST FIPS 140-2 or 140-3 validated cryptographic modules to generate and validate cryptographic hashes.
SC-13 - Medium - CCI-002450 - V-261965 - SV-261965r1000964_rule
RMF Control
SC-13
Severity
Medium
CCI
CCI-002450
Version
CD16-00-012200
Vuln IDs
  • V-261965
Rule IDs
  • SV-261965r1000964_rule
Use of weak or untested encryption algorithms undermines the purposes of using encryption to protect data. The application must implement cryptographic modules adhering to the higher standards approved by the federal government since this provides assurance they have been tested and validated. For detailed information, refer to NIST FIPS Publication 140-3, Security Requirements For Cryptographic Modules. Note that the product's cryptographic modules must be validated and certified by NIST as FIPS compliant.
Checks: C-65819r1000964_chk

As the system administrator, run the following to ensure FIPS is enabled: $ cat /proc/sys/crypto/fips_enabled If fips_enabled is not "1", this is a finding.

Fix: F-65727r1000899_fix

Configure OpenSSL to be FIPS compliant. PostgreSQL uses OpenSSL for cryptographic modules. To configure OpenSSL to be FIPS 140-2 compliant, refer to the official RHEL Documentation: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening#switching-the-system-to-fips-mode_using-the-system-wide-cryptographic-policies. For more information on configuring PostgreSQL to use SSL, refer to supplementary content APPENDIX-G.

b
PostgreSQL must implement NIST FIPS 140-2 or 140-3 validated cryptographic modules to protect unclassified information requiring confidentiality and cryptographic protection, in accordance with the data owners' requirements.
SC-13 - Medium - CCI-002450 - V-261966 - SV-261966r1000965_rule
RMF Control
SC-13
Severity
Medium
CCI
CCI-002450
Version
CD16-00-012300
Vuln IDs
  • V-261966
Rule IDs
  • SV-261966r1000965_rule
Use of weak or untested encryption algorithms undermines the purposes of using encryption to protect data. The application must implement cryptographic modules adhering to the higher standards approved by the federal government since this provides assurance they have been tested and validated. It is the responsibility of the data owner to assess the cryptography requirements in light of applicable federal laws, Executive Orders, directives, policies, regulations, and standards. For detailed information, refer to NIST FIPS Publication 140-3, Security Requirements For Cryptographic Modules. Note that the product's cryptographic modules must be validated and certified by NIST as FIPS compliant.
Checks: C-65820r1000965_chk

As the system administrator, run the following to ensure FIPS is enabled: $ cat /proc/sys/crypto/fips_enabled If fips_enabled is not "1", this is a finding.

Fix: F-65728r1000902_fix

Configure OpenSSL to be FIPS compliant. PostgreSQL uses OpenSSL for cryptographic modules. To configure OpenSSL to be FIPS 140-2 compliant, refer to the official RHEL Documentation: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening#switching-the-system-to-fips-mode_using-the-system-wide-cryptographic-policies. For more information on configuring PostgreSQL to use SSL, refer to supplementary content APPENDIX-G.

b
PostgreSQL must offload audit data to a separate log management facility; this must be continuous and in near real time for systems with a network connection to the storage facility and weekly or more often for standalone systems.
AU-4 - Medium - CCI-001851 - V-261967 - SV-261967r1000906_rule
RMF Control
AU-4
Severity
Medium
CCI
CCI-001851
Version
CD16-00-012400
Vuln IDs
  • V-261967
Rule IDs
  • SV-261967r1000906_rule
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Offloading is a common process in information systems with limited audit storage capacity. PostgreSQL may write audit records to database tables, to files in the file system, to other kinds of local repository, or directly to a centralized log management system. Whatever the method used, it must be compatible with offloading the records to the centralized system.
Checks: C-65821r1000904_chk

As the database administrator (shown here as "postgres"), ensure PostgreSQL uses syslog by running the following SQL: $ sudo su - postgres $ psql -c "SHOW log_destination" If log_destination is not syslog, this is a finding. As the database administrator, check which log facility is configured by running the following SQL: $ psql -c "SHOW syslog_facility" Check with the organization to refer to how syslog facilities are defined in their organization. If the wrong facility is configured, this is a finding. If PostgreSQL does not have a continuous network connection to the centralized log management system, and PostgreSQL audit records are not transferred to the centralized log management system weekly or more often, this is a finding.

Fix: F-65729r1000905_fix

Note: The following instructions use the PGDATA and PGVER environment variables. Refer to APPENDIX-F for instructions on configuring PGDATA and APPENDIX-H for PGVER. Configure PostgreSQL or deploy and configure software tools to transfer audit records to a centralized log management system, continuously and in near real time where a continuous network connection to the log management system exists, or at least weekly in the absence of such a connection. To ensure logging is enabled, review supplementary content APPENDIX-C for instructions on enabling logging. With logging enabled, as the database administrator (shown here as "postgres"), configure the following parameters in postgresql.conf (the example uses the default values - tailor for environment): Note: Consult the organization on how syslog facilities are defined in the syslog daemon configuration. $ sudo su - postgres $ vi ${PGDATA?}/postgresql.conf log_destination = 'syslog' syslog_facility = 'LOCAL0' syslog_ident = 'postgres' As the system administrator, reload the server with the new configuration: $ sudo systemctl reload postgresql-${PGVER?}