From e5107b898813201af1a8cb3e6335c8193243d083 Mon Sep 17 00:00:00 2001 From: seanlongcc Date: Fri, 2 Feb 2024 12:09:11 -0500 Subject: [PATCH] started mongo role development --- .../ansible/rhel8-stig-hardening-playbook.yml | 3 +- .../roles/mongo-stig/defaults/main.yml | 3 + spec/ansible/roles/mongo-stig/tasks/cat1.yml | 217 +++++ spec/ansible/roles/mongo-stig/tasks/cat2.yml | 821 ++++++++++++++++++ spec/ansible/roles/mongo-stig/tasks/cat3.yml | 1 + spec/ansible/roles/mongo-stig/tasks/main.yml | 20 + spec/ansible/roles/prep/tasks/_packages.yml | 1 + ubi8-hardening.pkr.hcl | 4 +- 8 files changed, 1067 insertions(+), 3 deletions(-) create mode 100644 spec/ansible/roles/mongo-stig/tasks/cat1.yml create mode 100644 spec/ansible/roles/mongo-stig/tasks/cat2.yml create mode 100644 spec/ansible/roles/mongo-stig/tasks/cat3.yml diff --git a/spec/ansible/rhel8-stig-hardening-playbook.yml b/spec/ansible/rhel8-stig-hardening-playbook.yml index 6ac3661..3fe1692 100644 --- a/spec/ansible/rhel8-stig-hardening-playbook.yml +++ b/spec/ansible/rhel8-stig-hardening-playbook.yml @@ -3,7 +3,8 @@ - localhost roles: - roles/prep # basic update and config tasks - - rhel8STIG # apply STIG requirement controls + #- rhel8STIG # apply STIG requirement controls + - mongo-stig serial: 50 user: 0 vars: diff --git a/spec/ansible/roles/mongo-stig/defaults/main.yml b/spec/ansible/roles/mongo-stig/defaults/main.yml index 8f4ebe1..9f9b3e5 100644 --- a/spec/ansible/roles/mongo-stig/defaults/main.yml +++ b/spec/ansible/roles/mongo-stig/defaults/main.yml @@ -1,2 +1,5 @@ --- # defaults file for mongo-stig +mongostig_cat1: true +mongostig_cat2: true +mongostig_cat3: true \ No newline at end of file diff --git a/spec/ansible/roles/mongo-stig/tasks/cat1.yml b/spec/ansible/roles/mongo-stig/tasks/cat1.yml new file mode 100644 index 0000000..11d099b --- /dev/null +++ b/spec/ansible/roles/mongo-stig/tasks/cat1.yml @@ -0,0 +1,217 @@ +--- +- name: "HIGH | V-252139 | If passwords are used for authentication, MongoDB must transmit only encrypted representations of passwords." + community.mongodb.mongodb_parameter: + login_user: root + login_password: admin + param: tlsMode + value: requireTLS + param_type: str + register: result + changed_when: no + ignore_errors: yes + tags: + - cat1 + - high + - V-252139 + - audit + +# - name: "HIGH | V-252146 | AUDIT | MongoDB must use NIST FIPS 140-2 or 140-3 validated cryptographic modules for cryptographic operations." +# command: true +# register: result +# always_run: yes +# changed_when: no +# ignore_errors: yes +# tags: +# - cat1 +# - high +# - V-252146 +# - audit + +# - name: "HIGH | V-252146 | PATCH | MongoDB must use NIST FIPS 140-2 or 140-3 validated cryptographic modules for cryptographic operations." +# command: true +# tags: +# - cat1 +# - high +# - V-252146 +# - patch + +# - name: "HIGH | V-252149 | AUDIT | MongoDB must integrate with an organization-level authentication/access mechanism providing account management and automation for all users, groups, roles, and any other principals." +# command: true +# register: result +# always_run: yes +# changed_when: no +# ignore_errors: yes +# tags: +# - cat1 +# - high +# - V-252149 +# - audit + +# - name: "HIGH | V-252149 | PATCH | MongoDB must integrate with an organization-level authentication/access mechanism providing account management and automation for all users, groups, roles, and any other principals." +# command: true +# tags: +# - cat1 +# - high +# - V-252149 +# - patch + +# - name: "HIGH | V-252150 | AUDIT | MongoDB must enforce approved authorizations for logical access to information and system resources in accordance with applicable access control policies." +# command: true +# register: result +# always_run: yes +# changed_when: no +# ignore_errors: yes +# tags: +# - cat1 +# - high +# - V-252150 +# - audit + +# - name: "HIGH | V-252150 | PATCH | MongoDB must enforce approved authorizations for logical access to information and system resources in accordance with applicable access control policies." +# command: true +# tags: +# - cat1 +# - high +# - V-252150 +# - patch + +# - name: "HIGH | V-252152 | AUDIT | MongoDB software installation account must be restricted to authorized users." +# command: true +# register: result +# always_run: yes +# changed_when: no +# ignore_errors: yes +# tags: +# - cat1 +# - high +# - V-252152 +# - audit + +# - name: "HIGH | V-252152 | PATCH | MongoDB software installation account must be restricted to authorized users." +# command: true +# tags: +# - cat1 +# - high +# - V-252152 +# - patch + +# - name: "HIGH | V-252158 | AUDIT | If passwords are used for authentication, MongoDB must implement LDAP or Kerberos for authentication to enforce the DoD standards for password complexity and lifetime." +# command: true +# register: result +# always_run: yes +# changed_when: no +# ignore_errors: yes +# tags: +# - cat1 +# - high +# - V-252158 +# - audit + +# - name: "HIGH | V-252158 | PATCH | If passwords are used for authentication, MongoDB must implement LDAP or Kerberos for authentication to enforce the DoD standards for password complexity and lifetime." +# command: true +# tags: +# - cat1 +# - high +# - V-252158 +# - patch + +# - name: "HIGH | V-252159 | AUDIT | If passwords are used for authentication, MongoDB must store only hashed, salted representations of passwords." +# command: true +# register: result +# always_run: yes +# changed_when: no +# ignore_errors: yes +# tags: +# - cat1 +# - high +# - V-252159 +# - audit + +# - name: "HIGH | V-252159 | PATCH | If passwords are used for authentication, MongoDB must store only hashed, salted representations of passwords." +# command: true +# tags: +# - cat1 +# - high +# - V-252159 +# - patch + +# - name: "HIGH | V-252160 | AUDIT | MongoDB must enforce authorized access to all PKI private keys stored/utilized by MongoDB." +# command: true +# register: result +# always_run: yes +# changed_when: no +# ignore_errors: yes +# tags: +# - cat1 +# - high +# - V-252160 +# - audit + +# - name: "HIGH | V-252160 | PATCH | MongoDB must enforce authorized access to all PKI private keys stored/utilized by MongoDB." +# command: true +# tags: +# - cat1 +# - high +# - V-252160 +# - patch + +# - name: "HIGH | V-252162 | AUDIT | MongoDB must obscure feedback of authentication information during the authentication process to protect the information from possible exploitation/use by unauthorized individuals." +# command: true +# register: result +# always_run: yes +# changed_when: no +# ignore_errors: yes +# tags: +# - cat1 +# - high +# - V-252162 +# - audit + +# - name: "HIGH | V-252162 | PATCH | MongoDB must obscure feedback of authentication information during the authentication process to protect the information from possible exploitation/use by unauthorized individuals." +# command: true +# tags: +# - cat1 +# - high +# - V-252162 +# - patch + +# - name: "HIGH | V-252165 | AUDIT | MongoDB must protect the confidentiality and integrity of all information at rest." +# command: true +# register: result +# always_run: yes +# changed_when: no +# ignore_errors: yes +# tags: +# - cat1 +# - high +# - V-252165 +# - audit + +# - name: "HIGH | V-252165 | PATCH | MongoDB must protect the confidentiality and integrity of all information at rest." +# command: true +# tags: +# - cat1 +# - high +# - V-252165 +# - patch + +# - name: "HIGH | V-252184 | AUDIT | MongoDB products must be a version supported by the vendor." +# command: true +# register: result +# always_run: yes +# changed_when: no +# ignore_errors: yes +# tags: +# - cat1 +# - high +# - V-252184 +# - audit + +# - name: "HIGH | V-252184 | PATCH | MongoDB products must be a version supported by the vendor." +# command: true +# tags: +# - cat1 +# - high +# - V-252184 +# - patch + diff --git a/spec/ansible/roles/mongo-stig/tasks/cat2.yml b/spec/ansible/roles/mongo-stig/tasks/cat2.yml new file mode 100644 index 0000000..db7e264 --- /dev/null +++ b/spec/ansible/roles/mongo-stig/tasks/cat2.yml @@ -0,0 +1,821 @@ +--- +- name: "MEDIUM | V-252134 | AUDIT | MongoDB must provide audit record generation for DoD-defined auditable events within all DBMS/database components." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252134 + - audit + +- name: "MEDIUM | V-252134 | PATCH | MongoDB must provide audit record generation for DoD-defined auditable events within all DBMS/database components." + command: true + tags: + - cat2 + - medium + - V-252134 + - patch + +- name: "MEDIUM | V-252135 | AUDIT | The audit information produced by MongoDB must be protected from unauthorized access." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252135 + - audit + +- name: "MEDIUM | V-252135 | PATCH | The audit information produced by MongoDB must be protected from unauthorized access." + command: true + tags: + - cat2 + - medium + - V-252135 + - patch + +- name: "MEDIUM | V-252136 | AUDIT | MongoDB must protect its audit features from unauthorized access." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252136 + - audit + +- name: "MEDIUM | V-252136 | PATCH | MongoDB must protect its audit features from unauthorized access." + command: true + tags: + - cat2 + - medium + - V-252136 + - patch + +- name: "MEDIUM | V-252137 | AUDIT | Unused database components that are integrated in MongoDB and cannot be uninstalled must be disabled." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252137 + - audit + +- name: "MEDIUM | V-252137 | PATCH | Unused database components that are integrated in MongoDB and cannot be uninstalled must be disabled." + command: true + tags: + - cat2 + - medium + - V-252137 + - patch + +- name: "MEDIUM | V-252138 | AUDIT | Unused database components that are integrated in MongoDB and cannot be uninstalled must be disabled." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252138 + - audit + +- name: "MEDIUM | V-252138 | PATCH | Unused database components that are integrated in MongoDB and cannot be uninstalled must be disabled." + command: true + tags: + - cat2 + - medium + - V-252138 + - patch + +- name: "MEDIUM | V-252140 | AUDIT | MongoDB must uniquely identify and authenticate non-organizational users (or processes acting on behalf of non-organizational users)." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252140 + - audit + +- name: "MEDIUM | V-252140 | PATCH | MongoDB must uniquely identify and authenticate non-organizational users (or processes acting on behalf of non-organizational users)." + command: true + tags: + - cat2 + - medium + - V-252140 + - patch + +- name: "MEDIUM | V-252141 | AUDIT | MongoDB must fail to a secure state if system initialization fails, shutdown fails, or aborts fail." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252141 + - audit + +- name: "MEDIUM | V-252141 | PATCH | MongoDB must fail to a secure state if system initialization fails, shutdown fails, or aborts fail." + command: true + tags: + - cat2 + - medium + - V-252141 + - patch + +- name: "MEDIUM | V-252142 | AUDIT | MongoDB must prevent unauthorized and unintended information transfer via shared system resources." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252142 + - audit + +- name: "MEDIUM | V-252142 | PATCH | MongoDB must prevent unauthorized and unintended information transfer via shared system resources." + command: true + tags: + - cat2 + - medium + - V-252142 + - patch + +- name: "MEDIUM | V-252143 | AUDIT | MongoDB and associated applications must reserve the use of dynamic code execution for situations that require it." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252143 + - audit + +- name: "MEDIUM | V-252143 | PATCH | MongoDB and associated applications must reserve the use of dynamic code execution for situations that require it." + command: true + tags: + - cat2 + - medium + - V-252143 + - patch + +- name: "MEDIUM | V-252144 | AUDIT | MongoDB must associate organization-defined types of security labels having organization-defined security label values with information in storage and transmission." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252144 + - audit + +- name: "MEDIUM | V-252144 | PATCH | MongoDB must associate organization-defined types of security labels having organization-defined security label values with information in storage and transmission." + command: true + tags: + - cat2 + - medium + - V-252144 + - patch + +- name: "MEDIUM | V-252145 | AUDIT | MongoDB must enforce discretionary access control policies, as defined by the data owner, over defined subjects and objects." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252145 + - audit + +- name: "MEDIUM | V-252145 | PATCH | MongoDB must enforce discretionary access control policies, as defined by the data owner, over defined subjects and objects." + command: true + tags: + - cat2 + - medium + - V-252145 + - patch + +- name: "MEDIUM | V-252147 | AUDIT | MongoDB 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." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252147 + - audit + +- name: "MEDIUM | V-252147 | PATCH | MongoDB 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." + command: true + tags: + - cat2 + - medium + - V-252147 + - patch + +- name: "MEDIUM | V-252148 | AUDIT | MongoDB must limit the total number of concurrent connections to the database." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252148 + - audit + +- name: "MEDIUM | V-252148 | PATCH | MongoDB must limit the total number of concurrent connections to the database." + command: true + tags: + - cat2 + - medium + - V-252148 + - patch + +- name: "MEDIUM | V-252151 | AUDIT | MongoDB must limit privileges to change software modules, to include stored procedures, functions and triggers, and links to software external to MongoDB." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252151 + - audit + +- name: "MEDIUM | V-252151 | PATCH | MongoDB must limit privileges to change software modules, to include stored procedures, functions and triggers, and links to software external to MongoDB." + command: true + tags: + - cat2 + - medium + - V-252151 + - patch + +- name: "MEDIUM | V-252153 | AUDIT | Database software, including DBMS configuration files, must be stored in dedicated directories, or DASD pools, separate from the host OS and other applications." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252153 + - audit + +- name: "MEDIUM | V-252153 | PATCH | Database software, including DBMS configuration files, must be stored in dedicated directories, or DASD pools, separate from the host OS and other applications." + command: true + tags: + - cat2 + - medium + - V-252153 + - patch + +- name: "MEDIUM | V-252154 | AUDIT | Database objects (including but not limited to tables, indexes, storage, stored procedures, functions, triggers, links to software external to MongoDB, etc.) must be owned by database/DBMS principals authorized for ownership." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252154 + - audit + +- name: "MEDIUM | V-252154 | PATCH | Database objects (including but not limited to tables, indexes, storage, stored procedures, functions, triggers, links to software external to MongoDB, etc.) must be owned by database/DBMS principals authorized for ownership." + command: true + tags: + - cat2 + - medium + - V-252154 + - patch + +- name: "MEDIUM | V-252155 | AUDIT | 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 MongoDB, etc.) must be restricted to authorized users." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252155 + - audit + +- name: "MEDIUM | V-252155 | PATCH | 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 MongoDB, etc.) must be restricted to authorized users." + command: true + tags: + - cat2 + - medium + - V-252155 + - patch + +- name: "MEDIUM | V-252156 | AUDIT | Unused database components that are integrated in MongoDB and cannot be uninstalled must be disabled." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252156 + - audit + +- name: "MEDIUM | V-252156 | PATCH | Unused database components that are integrated in MongoDB and cannot be uninstalled must be disabled." + command: true + tags: + - cat2 + - medium + - V-252156 + - patch + +- name: "MEDIUM | V-252157 | AUDIT | MongoDB must uniquely identify and authenticate organizational users (or processes acting on behalf of organizational users)." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252157 + - audit + +- name: "MEDIUM | V-252157 | PATCH | MongoDB must uniquely identify and authenticate organizational users (or processes acting on behalf of organizational users)." + command: true + tags: + - cat2 + - medium + - V-252157 + - patch + +- name: "MEDIUM | V-252161 | AUDIT | MongoDB must map the PKI-authenticated identity to an associated user account." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252161 + - audit + +- name: "MEDIUM | V-252161 | PATCH | MongoDB must map the PKI-authenticated identity to an associated user account." + command: true + tags: + - cat2 + - medium + - V-252161 + - patch + +- name: "MEDIUM | V-252163 | AUDIT | MongoDB must uniquely identify and authenticate non-organizational users (or processes acting on behalf of non-organizational users)." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252163 + - audit + +- name: "MEDIUM | V-252163 | PATCH | MongoDB must uniquely identify and authenticate non-organizational users (or processes acting on behalf of non-organizational users)." + command: true + tags: + - cat2 + - medium + - V-252163 + - patch + +- name: "MEDIUM | V-252164 | AUDIT | MongoDB must maintain the authenticity of communications sessions by guarding against man-in-the-middle attacks that guess at Session ID values." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252164 + - audit + +- name: "MEDIUM | V-252164 | PATCH | MongoDB must maintain the authenticity of communications sessions by guarding against man-in-the-middle attacks that guess at Session ID values." + command: true + tags: + - cat2 + - medium + - V-252164 + - patch + +- name: "MEDIUM | V-252166 | AUDIT | Database contents must be protected from unauthorized and unintended information transfer by enforcement of a data-transfer policy." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252166 + - audit + +- name: "MEDIUM | V-252166 | PATCH | Database contents must be protected from unauthorized and unintended information transfer by enforcement of a data-transfer policy." + command: true + tags: + - cat2 + - medium + - V-252166 + - patch + +- name: "MEDIUM | V-252167 | AUDIT | MongoDB must check the validity of all data inputs except those specifically identified by the organization." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252167 + - audit + +- name: "MEDIUM | V-252167 | PATCH | MongoDB must check the validity of all data inputs except those specifically identified by the organization." + command: true + tags: + - cat2 + - medium + - V-252167 + - patch + +- name: "MEDIUM | V-252168 | AUDIT | MongoDB must provide non-privileged users with error messages that provide information necessary for corrective actions without revealing information that could be exploited by adversaries." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252168 + - audit + +- name: "MEDIUM | V-252168 | PATCH | MongoDB must provide non-privileged users with error messages that provide information necessary for corrective actions without revealing information that could be exploited by adversaries." + command: true + tags: + - cat2 + - medium + - V-252168 + - patch + +- name: "MEDIUM | V-252169 | AUDIT | MongoDB must reveal detailed error messages only to the ISSO, ISSM, SA, and DBA." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252169 + - audit + +- name: "MEDIUM | V-252169 | PATCH | MongoDB must reveal detailed error messages only to the ISSO, ISSM, SA, and DBA." + command: true + tags: + - cat2 + - medium + - V-252169 + - patch + +- name: "MEDIUM | V-252170 | AUDIT | MongoDB must automatically terminate a user session after organization-defined conditions or trigger events requiring session disconnect." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252170 + - audit + +- name: "MEDIUM | V-252170 | PATCH | MongoDB must automatically terminate a user session after organization-defined conditions or trigger events requiring session disconnect." + command: true + tags: + - cat2 + - medium + - V-252170 + - patch + +- name: "MEDIUM | V-252171 | AUDIT | MongoDB must utilize centralized management of the content captured in audit records generated by all components of MongoDB." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252171 + - audit + +- name: "MEDIUM | V-252171 | PATCH | MongoDB must utilize centralized management of the content captured in audit records generated by all components of MongoDB." + command: true + tags: + - cat2 + - medium + - V-252171 + - patch + +- name: "MEDIUM | V-252172 | AUDIT | MongoDB must allocate audit record storage capacity in accordance with site audit record storage requirements." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252172 + - audit + +- name: "MEDIUM | V-252172 | PATCH | MongoDB must allocate audit record storage capacity in accordance with site audit record storage requirements." + command: true + tags: + - cat2 + - medium + - V-252172 + - patch + +- name: "MEDIUM | V-252173 | AUDIT | MongoDB must provide a warning to appropriate support staff when allocated audit record storage volume reaches 75 percent of maximum audit record storage capacity." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252173 + - audit + +- name: "MEDIUM | V-252173 | PATCH | MongoDB must provide a warning to appropriate support staff when allocated audit record storage volume reaches 75 percent of maximum audit record storage capacity." + command: true + tags: + - cat2 + - medium + - V-252173 + - patch + +- name: "MEDIUM | V-252174 | AUDIT | MongoDB must prohibit user installation of logic modules (stored procedures, functions, triggers, views, etc.) without explicit privileged status." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252174 + - audit + +- name: "MEDIUM | V-252174 | PATCH | MongoDB must prohibit user installation of logic modules (stored procedures, functions, triggers, views, etc.) without explicit privileged status." + command: true + tags: + - cat2 + - medium + - V-252174 + - patch + +- name: "MEDIUM | V-252175 | AUDIT | MongoDB must enforce access restrictions associated with changes to the configuration of MongoDB or database(s)." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252175 + - audit + +- name: "MEDIUM | V-252175 | PATCH | MongoDB must enforce access restrictions associated with changes to the configuration of MongoDB or database(s)." + command: true + tags: + - cat2 + - medium + - V-252175 + - patch + +- name: "MEDIUM | V-252176 | AUDIT | MongoDB must require users to reauthenticate when organization-defined circumstances or situations require reauthentication." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252176 + - audit + +- name: "MEDIUM | V-252176 | PATCH | MongoDB must require users to reauthenticate when organization-defined circumstances or situations require reauthentication." + command: true + tags: + - cat2 + - medium + - V-252176 + - patch + +- name: "MEDIUM | V-252177 | AUDIT | MongoDB must prohibit the use of cached authenticators after an organization-defined time period." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252177 + - audit + +- name: "MEDIUM | V-252177 | PATCH | MongoDB must prohibit the use of cached authenticators after an organization-defined time period." + command: true + tags: + - cat2 + - medium + - V-252177 + - patch + +- name: "MEDIUM | V-252178 | AUDIT | MongoDB must only accept end entity certificates issued by DoD PKI or DoD-approved PKI Certification Authorities (CAs) for the establishment of all encrypted sessions." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252178 + - audit + +- name: "MEDIUM | V-252178 | PATCH | MongoDB must only accept end entity certificates issued by DoD PKI or DoD-approved PKI Certification Authorities (CAs) for the establishment of all encrypted sessions." + command: true + tags: + - cat2 + - medium + - V-252178 + - patch + +- name: "MEDIUM | V-252179 | AUDIT | MongoDB must maintain the confidentiality and integrity of information during preparation for transmission." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252179 + - audit + +- name: "MEDIUM | V-252179 | PATCH | MongoDB must maintain the confidentiality and integrity of information during preparation for transmission." + command: true + tags: + - cat2 + - medium + - V-252179 + - patch + +- name: "MEDIUM | V-252180 | AUDIT | MongoDB must maintain the confidentiality and integrity of information during reception." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252180 + - audit + +- name: "MEDIUM | V-252180 | PATCH | MongoDB must maintain the confidentiality and integrity of information during reception." + command: true + tags: + - cat2 + - medium + - V-252180 + - patch + +- name: "MEDIUM | V-252181 | AUDIT | When invalid inputs are received, MongoDB must behave in a predictable and documented manner that reflects organizational and system objectives." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252181 + - audit + +- name: "MEDIUM | V-252181 | PATCH | When invalid inputs are received, MongoDB must behave in a predictable and documented manner that reflects organizational and system objectives." + command: true + tags: + - cat2 + - medium + - V-252181 + - patch + +- name: "MEDIUM | V-252182 | AUDIT | When updates are applied to MongoDB software, any software components that have been replaced or made unnecessary must be removed." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252182 + - audit + +- name: "MEDIUM | V-252182 | PATCH | When updates are applied to MongoDB software, any software components that have been replaced or made unnecessary must be removed." + command: true + tags: + - cat2 + - medium + - V-252182 + - patch + +- name: "MEDIUM | V-252183 | AUDIT | Security-relevant software updates to MongoDB must be installed within the time period directed by an authoritative source (e.g., IAVM, CTOs, DTMs, and STIGs)." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252183 + - audit + +- name: "MEDIUM | V-252183 | PATCH | Security-relevant software updates to MongoDB must be installed within the time period directed by an authoritative source (e.g., IAVM, CTOs, DTMs, and STIGs)." + command: true + tags: + - cat2 + - medium + - V-252183 + - patch + +- name: "MEDIUM | V-252185 | AUDIT | MongoDB must be configured in accordance with the security configuration settings based on DoD security configuration and implementation guidance, including STIGs, NSA configuration guides, CTOs, DTMs, and IAVMs." + command: true + register: result + always_run: yes + changed_when: no + ignore_errors: yes + tags: + - cat2 + - medium + - V-252185 + - audit + +- name: "MEDIUM | V-252185 | PATCH | MongoDB must be configured in accordance with the security configuration settings based on DoD security configuration and implementation guidance, including STIGs, NSA configuration guides, CTOs, DTMs, and IAVMs." + command: true + tags: + - cat2 + - medium + - V-252185 + - patch + diff --git a/spec/ansible/roles/mongo-stig/tasks/cat3.yml b/spec/ansible/roles/mongo-stig/tasks/cat3.yml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/spec/ansible/roles/mongo-stig/tasks/cat3.yml @@ -0,0 +1 @@ +--- diff --git a/spec/ansible/roles/mongo-stig/tasks/main.yml b/spec/ansible/roles/mongo-stig/tasks/main.yml index 43a4cc9..b93502a 100644 --- a/spec/ansible/roles/mongo-stig/tasks/main.yml +++ b/spec/ansible/roles/mongo-stig/tasks/main.yml @@ -1,2 +1,22 @@ --- # tasks file for mongo-stig +- name: Include CAT I + ansible.builtin.import_tasks: cat1.yml + when: mongostig_cat1 + tags: + - CAT1 + - high + +# - name: Include CAT II +# ansible.builtin.import_tasks: cat2.yml +# when: mongostig_cat2 +# tags: +# - CAT2 +# - medium + +# - name: Include CAT III +# ansible.builtin.import_tasks: cat3.yml +# when: mongostig_cat3 +# tags: +# - CAT3 +# - low \ No newline at end of file diff --git a/spec/ansible/roles/prep/tasks/_packages.yml b/spec/ansible/roles/prep/tasks/_packages.yml index 604791a..1a20e96 100644 --- a/spec/ansible/roles/prep/tasks/_packages.yml +++ b/spec/ansible/roles/prep/tasks/_packages.yml @@ -15,5 +15,6 @@ pip: name: - jmespath + - pymongo state: latest executable: "{{ ansible_pip_executable }}" diff --git a/ubi8-hardening.pkr.hcl b/ubi8-hardening.pkr.hcl index 80c6f11..43e76ef 100644 --- a/ubi8-hardening.pkr.hcl +++ b/ubi8-hardening.pkr.hcl @@ -58,7 +58,7 @@ source "docker" "target" { image = "${var.input_image.tag}:${var.input_image.version}" commit = true pull = true - run_command = ["-d", "-i", "-t", "--name", var.output_image.name, "--user", "root", "{{.Image}}", "/bin/bash"] + run_command = ["-d", "-i", "-t", "--name", var.output_image.name, "--user", "root","-e","MONGO_INITDB_ROOT_USERNAME=root", "-e","MONGO_INITDB_ROOT_PASSWORD=admin","-p","27017:27017", "{{.Image}}", "/bin/bash"] } build { @@ -96,7 +96,7 @@ build { "REPORT_DIR=${var.scan.report_dir}", "REPORT_FILE=${var.scan.inspec_report_filename}", "INPUT_FILE=${var.scan.inspec_input_file}", - "TARGET_IMAGE=${var.output_image.name}" + "TARGET_IMAGE=${var.output_image.name}", ] valid_exit_codes = [0, 100, 101] # inspec has multiple valid exit codes scripts = ["spec/scripts/scan.sh"]