Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

less permissive db permissions #4531

Merged
merged 19 commits into from
Jan 16, 2024
Merged

less permissive db permissions #4531

merged 19 commits into from
Jan 16, 2024

Conversation

wullub
Copy link
Contributor

@wullub wullub commented Jan 12, 2024

less permissive db permissions

less permissive db permissions
@wullub wullub requested review from a team as code owners January 12, 2024 16:55
@github-actions github-actions bot added the environments-repository Used to exclude PRs from this repo in our Slack PR update label Jan 12, 2024
@wullub wullub temporarily deployed to oasys-development January 12, 2024 16:56 — with GitHub Actions Inactive
Copy link
Contributor

Checkov Scan Success

Show Output
*****************************

Checkov will check the following folders:

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:

Trivy Scan

Show Output

Copy link
Contributor

TFSEC Scan Success

Show Output ```hcl

TFSEC will check the following folders:
terraform/environments/nomis-data-hub


Running TFSEC in terraform/environments/nomis-data-hub
Excluding the following checks: AWS095

======================================================
tfsec is joining the Trivy family

tfsec will continue to remain available
for the time being, although our engineering
attention will be directed at Trivy going forward.

You can read more here:
aquasecurity/tfsec#1994

timings
──────────────────────────────────────────
disk i/o 1.506221ms
parsing 148.617356ms
adaptation 110.797µs
checks 3.255124ms
total 153.489498ms

counts
──────────────────────────────────────────
modules downloaded 0
modules processed 5
blocks processed 269
files read 71

results
──────────────────────────────────────────
passed 1
ignored 0
critical 0
high 0
medium 0
low 0

No problems detected!

tfsec_exitcode=0

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:
terraform/environments/nomis-data-hub

*****************************

Running Checkov in terraform/environments/nomis-data-hub
terraform scan results:

Passed checks: 90, Failed checks: 0, Skipped checks: 19


checkov_exitcode=0

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:
terraform/environments/nomis-data-hub

*****************************

Running tflint in terraform/environments/nomis-data-hub
Excluding the following checks: terraform_unused_declarations
tflint_exitcode=0

Trivy Scan

Show Output

Copy link
Contributor

TFSEC Scan Success

Show Output ```hcl

TFSEC will check the following folders:
terraform/environments/nomis-data-hub


Running TFSEC in terraform/environments/nomis-data-hub
Excluding the following checks: AWS095

======================================================
tfsec is joining the Trivy family

tfsec will continue to remain available
for the time being, although our engineering
attention will be directed at Trivy going forward.

You can read more here:
aquasecurity/tfsec#1994

timings
──────────────────────────────────────────
disk i/o 1.45756ms
parsing 141.550039ms
adaptation 114.994µs
checks 3.694093ms
total 146.816686ms

counts
──────────────────────────────────────────
modules downloaded 0
modules processed 5
blocks processed 269
files read 71

results
──────────────────────────────────────────
passed 1
ignored 0
critical 0
high 0
medium 0
low 0

No problems detected!

tfsec_exitcode=0

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:
terraform/environments/nomis-data-hub

*****************************

Running Checkov in terraform/environments/nomis-data-hub
terraform scan results:

Passed checks: 90, Failed checks: 0, Skipped checks: 19


checkov_exitcode=0

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:
terraform/environments/nomis-data-hub

*****************************

Running tflint in terraform/environments/nomis-data-hub
Excluding the following checks: terraform_unused_declarations
tflint_exitcode=0

Trivy Scan

Show Output

Copy link
Contributor

TFSEC Scan Success

Show Output ```hcl

TFSEC will check the following folders:
terraform/environments/hmpps-domain-services


Running TFSEC in terraform/environments/hmpps-domain-services
Excluding the following checks: AWS095

======================================================
tfsec is joining the Trivy family

tfsec will continue to remain available
for the time being, although our engineering
attention will be directed at Trivy going forward.

You can read more here:
aquasecurity/tfsec#1994

timings
──────────────────────────────────────────
disk i/o 1.491173ms
parsing 145.547042ms
adaptation 110.056µs
checks 3.23156ms
total 150.379831ms

counts
──────────────────────────────────────────
modules downloaded 0
modules processed 5
blocks processed 278
files read 73

results
──────────────────────────────────────────
passed 1
ignored 0
critical 0
high 0
medium 0
low 0

No problems detected!

tfsec_exitcode=0

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:
terraform/environments/hmpps-domain-services

*****************************

Running Checkov in terraform/environments/hmpps-domain-services
terraform scan results:

Passed checks: 95, Failed checks: 0, Skipped checks: 19


checkov_exitcode=0

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:
terraform/environments/hmpps-domain-services

*****************************

Running tflint in terraform/environments/hmpps-domain-services
Excluding the following checks: terraform_unused_declarations
tflint_exitcode=0

Trivy Scan

Show Output

Copy link
Contributor

TFSEC Scan Success

Show Output ```hcl

TFSEC will check the following folders:
terraform/environments/hmpps-domain-services


Running TFSEC in terraform/environments/hmpps-domain-services
Excluding the following checks: AWS095

======================================================
tfsec is joining the Trivy family

tfsec will continue to remain available
for the time being, although our engineering
attention will be directed at Trivy going forward.

You can read more here:
aquasecurity/tfsec#1994

timings
──────────────────────────────────────────
disk i/o 1.524286ms
parsing 159.727844ms
adaptation 111.908µs
checks 3.084222ms
total 164.44826ms

counts
──────────────────────────────────────────
modules downloaded 0
modules processed 5
blocks processed 279
files read 73

results
──────────────────────────────────────────
passed 1
ignored 0
critical 0
high 0
medium 0
low 0

No problems detected!

tfsec_exitcode=0

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:
terraform/environments/hmpps-domain-services

*****************************

Running Checkov in terraform/environments/hmpps-domain-services
terraform scan results:

Passed checks: 95, Failed checks: 0, Skipped checks: 19


checkov_exitcode=0

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:
terraform/environments/hmpps-domain-services

*****************************

Running tflint in terraform/environments/hmpps-domain-services
Excluding the following checks: terraform_unused_declarations
tflint_exitcode=0

Trivy Scan

Show Output

Copy link
Contributor

TFSEC Scan Success

Show Output ```hcl

TFSEC will check the following folders:
terraform/environments/hmpps-domain-services


Running TFSEC in terraform/environments/hmpps-domain-services
Excluding the following checks: AWS095

======================================================
tfsec is joining the Trivy family

tfsec will continue to remain available
for the time being, although our engineering
attention will be directed at Trivy going forward.

You can read more here:
aquasecurity/tfsec#1994

timings
──────────────────────────────────────────
disk i/o 1.486387ms
parsing 145.315704ms
adaptation 110.117µs
checks 2.922236ms
total 149.834444ms

counts
──────────────────────────────────────────
modules downloaded 0
modules processed 5
blocks processed 279
files read 73

results
──────────────────────────────────────────
passed 1
ignored 0
critical 0
high 0
medium 0
low 0

No problems detected!

tfsec_exitcode=0

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:
terraform/environments/hmpps-domain-services

*****************************

Running Checkov in terraform/environments/hmpps-domain-services
terraform scan results:

Passed checks: 95, Failed checks: 0, Skipped checks: 19


checkov_exitcode=0

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:
terraform/environments/hmpps-domain-services

*****************************

Running tflint in terraform/environments/hmpps-domain-services
Excluding the following checks: terraform_unused_declarations
tflint_exitcode=0

Trivy Scan

Show Output

Copy link
Contributor

@drobinson-moj drobinson-moj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just worry that this is complicating things somewhat with all the extra outputs. I think if we just set enable_ec2_oracle_enterprise_managed_server = true in hmpps-oem account it eliminates a lot of the code. And effectively an OEM manager is managing itself, so needs to have these permissions.

terraform/environments/hmpps-oem/locals.tf Show resolved Hide resolved
@@ -40,6 +39,58 @@ locals {
baseline_ec2_autoscaling_groups = {}
baseline_ec2_instances = {}
baseline_iam_policies = {
OracleEnterpriseManagementSecretsPolicy = module.baseline_presets.iam_policies_all.OracleEnterpriseManagementSecretsPolicy,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we set enable_ec2_oracle_enterprise_managed_server = true then we don't need this.

@@ -95,6 +146,8 @@ locals {
}
}
baseline_iam_roles = {
# allow EC2 instance profiles ability to assume this role
EC2OracleEnterpriseManagementSecretsRole = module.baseline_presets.iam_roles_all.EC2OracleEnterpriseManagementSecretsRole
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we set enable_ec2_oracle_enterprise_managed_server = true then we don't need this.

@@ -153,6 +206,7 @@ locals {
}
}
}
"account" = module.baseline_presets.ssm_parameters_all.account
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we set enable_ec2_oracle_enterprise_managed_server = true then we don't need this.

"arn:aws:s3:::*"
]
},
DBSecrets = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this being used now - I couldn't see it referenced. But if it is, I'd think about changing the name


value = local.iam_roles
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't need this (or the other 2 outputs either)

Copy link
Contributor

TFSEC Scan Success

Show Output ```hcl

TFSEC will check the following folders:

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:

Trivy Scan

Show Output

@wullub wullub temporarily deployed to hmpps-oem-development January 16, 2024 09:51 — with GitHub Actions Inactive
Copy link
Contributor

TFSEC Scan Success

Show Output ```hcl

TFSEC will check the following folders:

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:

Trivy Scan

Show Output

@wullub wullub merged commit 1b92887 into main Jan 16, 2024
26 checks passed
@wullub wullub deleted the less-permissive-db-permissions branch January 16, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
environments-repository Used to exclude PRs from this repo in our Slack PR update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants