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

secure database secrets and ensure middleware access #423

Merged

Conversation

marycrawford
Copy link
Collaborator

@marycrawford marycrawford commented Nov 25, 2024

Description

Utilize infrastructure as code to automate the creation of the database user and secrets, as well as keeping it secure by storing it in Azure key vault. Passing the values to the middleware to access (while still making sure security is added with the sslmode).

Related Issues

[Link any related issues or tasks from your project management system.]

Checklist

  • The title of this PR is descriptive and concise.
  • My changes follow the style guidelines of this project.
  • Considered an architectural design with a security first approach to keep the secret for the database safe.
  • I've let the team know about this PR by linking it in the review channel

@marycrawford marycrawford self-assigned this Nov 25, 2024
@marycrawford marycrawford marked this pull request as draft November 25, 2024 16:21
@@ -98,6 +98,10 @@ module "ocr_autoscale" {
weekend_capacity_instances = 1
}

module "vault" {
location = data.azurerm_resource_group.rg.location
Copy link
Collaborator

@derekadombek derekadombek Nov 25, 2024

Choose a reason for hiding this comment

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

We should pre-create/manually create vault secrets ahead and bringing them in as data sources similar to how we are with the Resource Group's, like this for example: https://github.com/CDCgov/prime-simplereport/blob/593c56c62847fbf398a0a8cddc5e4069a1499bd1/ops/prod/_data.tf#L50 This is also how CDC azure access will be.

I do agree that we should make things repeatable for whoever follows, however the type of 3tier'd cloud design we have isn't meant to be repeatable. It's meant to reside in a central location and not be able to scale to other organizations as well as other designs.

Unfortunately it looks like we might not have permissions to create key vault secrets at the moment in Azure. I ping'd Josh earlier to see if he can add a role to allow it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We met with Josh Dorothy on Tuesday, November 26 and received permissions. In that meeting you agreed on this architectural design. In that meeting, I re-iterated the manual creation of the secret may not be the best practice or most secure.

@marycrawford marycrawford changed the title 415 db secure db secrets and ensure middleware access secure database secrets and ensure middleware access Nov 26, 2024
@marycrawford marycrawford force-pushed the 415-db-secure-db-secrets-and-ensure-middleware-access branch from 28c3096 to d49dfe8 Compare December 5, 2024 10:14
@marycrawford marycrawford marked this pull request as ready for review December 5, 2024 18:44
Copy link
Collaborator

@arinkulshi-skylight arinkulshi-skylight left a comment

Choose a reason for hiding this comment

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

LG pending any changes from Derek!

@@ -30,9 +30,11 @@ services:
ports:
- "5432:5432"
environment:
POSTGRES_DB: reportvision
POSTGRES_USER: postgres
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might need to make a separate app.yaml file but this is something we can handle as part of next steps. This looks ok!

@marycrawford marycrawford added this pull request to the merge queue Dec 6, 2024
Merged via the queue into main with commit 4b7c5ae Dec 6, 2024
1 check passed
@marycrawford marycrawford deleted the 415-db-secure-db-secrets-and-ensure-middleware-access branch December 6, 2024 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants