Skip to content

Commit

Permalink
Merge branch 'main' into check-status-code
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Nov 4, 2024
2 parents 13ae21d + ac094c7 commit 5ca4712
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker-compose/ssp/metadata/saml20-idp-hosted.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
'idBrokerAssertValidIp' => Env::get('ID_BROKER_ASSERT_VALID_IP'),
'idBrokerBaseUri' => Env::get('ID_BROKER_BASE_URI'),
'idBrokerTrustedIpRanges' => Env::get('ID_BROKER_TRUSTED_IP_RANGES'),
'mfaLearnMoreUrl' => Env::get('MFA_LEARN_MORE_URL'),
'mfaSetupUrl' => Env::get('MFA_SETUP_URL'),
'loggerClass' => Psr3SamlLogger::class,
],
Expand All @@ -50,6 +49,7 @@
30 => [
'class' => 'profilereview:ProfileReview',
'employeeIdAttr' => 'employeeNumber',
'mfaLearnMoreUrl' => Env::get('MFA_LEARN_MORE_URL'),
'profileUrl' => Env::get('PROFILE_URL'),
'loggerClass' => Psr3SamlLogger::class,
],
Expand Down
3 changes: 3 additions & 0 deletions terraform/010-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ ssl certificate, core application load balancer, and a CloudWatch log group
- Locate ACM certificate for use in ALB listeners
- Create application load balancer (ALB)
- Create CloudWatch log group
- Optionally create a Cloudwatch dashboard
- Optionally create a NAT gateway
- Create a Cloudflare rule to allow access to the NAT gateway (if enabled)

## Required Inputs

Expand Down
32 changes: 31 additions & 1 deletion terraform/010-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ resource "aws_cloudwatch_log_group" "logs" {
* Create CloudWatch Dashboard for services that will be in this cluster
*/
module "ecs-service-cloudwatch-dashboard" {
count = var.create_dashboard ? 1 : 0
count = var.create_dashboard && var.cloudflare_domain != "" ? 1 : 0

source = "silinternational/ecs-service-cloudwatch-dashboard/aws"
version = "~> 3.1"
Expand All @@ -136,3 +136,33 @@ module "ecs-service-cloudwatch-dashboard" {
}

data "aws_region" "current" {}


resource "cloudflare_ruleset" "nat" {
count = var.create_nat_gateway ? 1 : 0

zone_id = data.cloudflare_zone.this.id
name = "Bypass bot protection"
description = "Skip super bot fight mode to ensure id-broker can access MFA API"
kind = "zone"
phase = "http_request_firewall_custom"

rules {
action = "skip"
expression = "(ip.src eq ${module.vpc.nat_gateway_ip})"
description = "${var.idp_name} NAT gateway skip bot protection"
enabled = true
action_parameters {
phases = [
"http_request_sbfm"
]
}
logging {
enabled = true
}
}
}

data "cloudflare_zone" "this" {
name = var.cloudflare_domain
}
6 changes: 6 additions & 0 deletions terraform/010-cluster/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ variable "cert_domain_name" {
type = string
}

variable "cloudflare_domain" {
description = "The base domain name to be used for Cloudflare resources, e.g. example.net"
type = string
default = ""
}

variable "create_dashboard" {
description = "Set to false to remove the Cloudwatch Dashboard"
type = bool
Expand Down
7 changes: 7 additions & 0 deletions terraform/010-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ terraform {
source = "hashicorp/aws"
version = ">= 4.0.0, < 6.0.0"
}
cloudflare = {
source = "cloudflare/cloudflare"

// 4.39.0 deprecated cloudflare_record.value
// While waiting for version 5 to mature, we'll constrain to earlier versions.
version = ">= 2.0.0, < 4.39.0"
}
}
}
1 change: 1 addition & 0 deletions test/010-cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module "cluster" {
aws_instance = { a = "b" }
aws_zones = [""]
cert_domain_name = ""
cloudflare_domain = ""
create_nat_gateway = true
ecs_cluster_name = ""
ecs_instance_profile_id = ""
Expand Down

0 comments on commit 5ca4712

Please sign in to comment.