SV-224191r508023_rule
V-224191
SRG-APP-000328-DB-000301
EP11-00-007300
CAT II
10
Implement the organization's DAC policy in the security configuration of the database and EDB Postgres Advanced Server, and, if applicable, the security configuration of the application(s) using the database.
If an unapproved user or group role is the owner of a database object, change the owner to an approved user or group role using one of the following ALTER SQL commands as appropriate:
The syntax is:
ALTER DATABASE <database name> OWNER TO <new_owner>
ALTER SCHEMA <schema name> OWNER TO <new_owner>
ALTER TABLE <table name> OWNER TO <new_owner>
ALTER SEQUENCE <sequence name> OWNER TO <new_owner>
ALTER VIEW <view name> OWNER TO <new_owner>
ALTER FUNCTION <function name> (<args>) OWNER TO <new_owner>
ALTER PROCEDURE <procedure name> (<args>) OWNER TO <new_owner>
Examples:
ALTER DATABASE test_db OWNER TO app_admin
ALTER SCHEMA test_schema OWNER TO app_admin
ALTER TABLE test_tbl OWNER TO app_admin
ALTER SEQUENCE test_seq OWNER TO app_admin
ALTER VIEW test_vw OWNER TO app_admin
ALTER FUNCTION test_func (p1 numeric, p2 text) OWNER TO app_admin
ALTER PROCEDURE test_proc (p1 numeric, p2 text) OWNER TO app_admin
If a user or group role has been granted an unapproved role or object privilege, execute the appropriate REVOKE command as documented here:
http://www.postgresql.org/docs/current/static/sql-revoke.html
Review system documentation to identify the required discretionary access control (DAC).
Review the security configuration of the database and EDB Postgres Advanced Server. If applicable, review the security configuration of the application(s) using the database.
If the discretionary access control defined in the documentation is not implemented in the security configuration, this is a finding.
Check the EDB Postgres instance for the ownership and privileges assigned to database objects.
# Check for object ownership and privileges
# Check for database owners and granted privileges
To list all the databases contained in an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the databases, connect to a database as a database superuser using psql and execute the following psql command:
\l
Review the results of the above command.
If any database is owned by a user or group role that is not documented as being approved to own the database, this is a finding.
If any user or group role has been granted privileges on a database that is not documented and approved, this is a finding.
# Check for schema owners and granted privileges
To list all the schemas contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the schemas, connect to the database as a database superuser using psql and execute the following psql command:
\dn+ *
Review the results of the above command.
If any schema is owned by a user or group role that is not documented as being approved to own the schema, this is a finding.
If any user or group role has been granted privileges on a schema that is not documented and approved, this is a finding.
# Check for table, sequence, and view owners
To list all the tables, sequences, and views contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners, connect to the database as a database superuser using psql and execute the following psql commands:
\dt *.*
\ds *.*
\dv *.*
Review the results of the above commands.
If any table, sequence, or view is owned by a user or group role that is not documented as being approved to own the object, this is a finding.
# Check for table, sequence, and view access privileges
To list all the privileges that have been granted on the tables, sequences, and views in a database, connect to the database as a database superuser using psql and execute the following psql command:
\dp *.*
Review the results of the above command.
If any user or group role has been granted privileges on an object that is not documented and approved, this is a finding.
# Check for function/procedure owners and access privileges
To list all the functions and procedures contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the schemas, connect to the database as a database superuser using psql and execute the following SQL statement:
SELECT r.rolname as owner
, n.nspname as namespace
, p.proname as name
, pg_get_function_identity_arguments(p.oid)
, p.prokind as kind
, p.proacl as access_privileges
FROM pg_proc p
JOIN pg_namespace n ON p.pronamespace = n.oid
JOIN pg_authid r ON p.proowner = r.oid
ORDER BY 1, 2, 3, 4;
Review the results of the above query.
If any function or procedure is owned by a user or group role that is not documented as being approved to own the object, this is a finding.
If any user or group role has been granted privileges on a function or procedure that is not documented and approved, this is a finding.
V-224191
False
EP11-00-007300
Review system documentation to identify the required discretionary access control (DAC).
Review the security configuration of the database and EDB Postgres Advanced Server. If applicable, review the security configuration of the application(s) using the database.
If the discretionary access control defined in the documentation is not implemented in the security configuration, this is a finding.
Check the EDB Postgres instance for the ownership and privileges assigned to database objects.
# Check for object ownership and privileges
# Check for database owners and granted privileges
To list all the databases contained in an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the databases, connect to a database as a database superuser using psql and execute the following psql command:
\l
Review the results of the above command.
If any database is owned by a user or group role that is not documented as being approved to own the database, this is a finding.
If any user or group role has been granted privileges on a database that is not documented and approved, this is a finding.
# Check for schema owners and granted privileges
To list all the schemas contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the schemas, connect to the database as a database superuser using psql and execute the following psql command:
\dn+ *
Review the results of the above command.
If any schema is owned by a user or group role that is not documented as being approved to own the schema, this is a finding.
If any user or group role has been granted privileges on a schema that is not documented and approved, this is a finding.
# Check for table, sequence, and view owners
To list all the tables, sequences, and views contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners, connect to the database as a database superuser using psql and execute the following psql commands:
\dt *.*
\ds *.*
\dv *.*
Review the results of the above commands.
If any table, sequence, or view is owned by a user or group role that is not documented as being approved to own the object, this is a finding.
# Check for table, sequence, and view access privileges
To list all the privileges that have been granted on the tables, sequences, and views in a database, connect to the database as a database superuser using psql and execute the following psql command:
\dp *.*
Review the results of the above command.
If any user or group role has been granted privileges on an object that is not documented and approved, this is a finding.
# Check for function/procedure owners and access privileges
To list all the functions and procedures contained in a database within an EDB Postgres Advanced Server cluster (i.e., instance) as well as their owners and the privileges that have been granted on the schemas, connect to the database as a database superuser using psql and execute the following SQL statement:
SELECT r.rolname as owner
, n.nspname as namespace
, p.proname as name
, pg_get_function_identity_arguments(p.oid)
, p.prokind as kind
, p.proacl as access_privileges
FROM pg_proc p
JOIN pg_namespace n ON p.pronamespace = n.oid
JOIN pg_authid r ON p.proowner = r.oid
ORDER BY 1, 2, 3, 4;
Review the results of the above query.
If any function or procedure is owned by a user or group role that is not documented as being approved to own the object, this is a finding.
If any user or group role has been granted privileges on a function or procedure that is not documented and approved, this is a finding.
M
4107