Skip to content

Commit

Permalink
Update JWT expiry in prod and rotate key
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Jan 14, 2025
1 parent 303e9a9 commit 900a810
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions tf/environments/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,8 @@ module "ooniapi_user" {

### Configuration common to all services

resource "random_password" "jwt_secret" {
length = 32
special = false
}

resource "aws_secretsmanager_secret" "jwt_secret" {
name = "oonidevops/ooni_services/jwt_secret"
tags = local.tags
}

resource "aws_secretsmanager_secret_version" "jwt_secret" {
secret_id = aws_secretsmanager_secret.jwt_secret.id
secret_string = random_password.jwt_secret.result
data "aws_ssm_parameter" "jwt_secret" {
name = "/oonidevops/secrets/ooni_services/jwt_secret"
}

resource "random_password" "prometheus_metrics_password" {
Expand Down Expand Up @@ -433,7 +422,7 @@ module "ooniapi_ooniprobe" {

task_secrets = {
POSTGRESQL_URL = aws_secretsmanager_secret_version.oonipg_url.arn
JWT_ENCRYPTION_KEY = aws_secretsmanager_secret_version.jwt_secret.arn
JWT_ENCRYPTION_KEY = data.aws_ssm_parameter.jwt_secret
PROMETHEUS_METRICS_PASSWORD = aws_secretsmanager_secret_version.prometheus_metrics_password.arn
}

Expand Down Expand Up @@ -484,7 +473,7 @@ module "ooniapi_oonirun" {

task_secrets = {
POSTGRESQL_URL = aws_secretsmanager_secret_version.oonipg_url.arn
JWT_ENCRYPTION_KEY = aws_secretsmanager_secret_version.jwt_secret.arn
JWT_ENCRYPTION_KEY = data.aws_ssm_parameter.jwt_secret
PROMETHEUS_METRICS_PASSWORD = aws_secretsmanager_secret_version.prometheus_metrics_password.arn
}

Expand Down Expand Up @@ -532,7 +521,7 @@ module "ooniapi_oonifindings" {

task_secrets = {
POSTGRESQL_URL = aws_secretsmanager_secret_version.oonipg_url.arn
JWT_ENCRYPTION_KEY = aws_secretsmanager_secret_version.jwt_secret.arn
JWT_ENCRYPTION_KEY = data.aws_ssm_parameter.jwt_secret
PROMETHEUS_METRICS_PASSWORD = aws_secretsmanager_secret_version.prometheus_metrics_password.arn
}

Expand Down Expand Up @@ -583,7 +572,7 @@ module "ooniapi_ooniauth" {

task_secrets = {
POSTGRESQL_URL = aws_secretsmanager_secret_version.oonipg_url.arn
JWT_ENCRYPTION_KEY = aws_secretsmanager_secret_version.jwt_secret.arn
JWT_ENCRYPTION_KEY = data.aws_ssm_parameter.jwt_secret
PROMETHEUS_METRICS_PASSWORD = aws_secretsmanager_secret_version.prometheus_metrics_password.arn

AWS_SECRET_ACCESS_KEY = module.ooniapi_user.aws_secret_access_key_arn
Expand All @@ -592,8 +581,8 @@ module "ooniapi_ooniauth" {
task_environment = {
AWS_REGION = var.aws_region
EMAIL_SOURCE_ADDRESS = module.ooniapi_user.email_address
SESSION_EXPIRY_DAYS = 180
LOGIN_EXPIRY_DAYS = 365
SESSION_EXPIRY_DAYS = 2
LOGIN_EXPIRY_DAYS = 7
ADMIN_EMAILS = jsonencode([
"[email protected]",
"[email protected]",
Expand Down

0 comments on commit 900a810

Please sign in to comment.