forked from bcgov/supreme-court-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JASPER-223: Secure JASPER to VPN'd users only (#114)
* - Implement WAF to secure jasper to VPN'd users only - Fixed existing tfsec issues - Fixed publish-infra error - Deleted jasper-aws-bootstrap folder as it is no longer needed - Include sonarlint extension to identify sonar issues earlier * Upgrade Terraform version to 1.10.2 --------- Co-authored-by: Ronaldo Macapobre <[email protected]>
- Loading branch information
1 parent
837f39e
commit 2cd8b3b
Showing
25 changed files
with
153 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
output "default_lb_dns_name" { | ||
value = data.aws_lb.default_lb.dns_name | ||
} | ||
|
||
output "default_lb_arn" { | ||
value = data.aws_lb.default_lb.arn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
locals { | ||
ip_list = split(",", var.allowed_ip_ranges) | ||
} | ||
|
||
resource "aws_wafv2_ip_set" "waf_ip_set" { | ||
name = "${var.app_name}-bcgov-ip-set-${var.environment}" | ||
description = "BC Gov CIDRs ranges to restrict JASPER access to users connected to VPN only" | ||
scope = "REGIONAL" | ||
ip_address_version = "IPV4" | ||
addresses = local.ip_list | ||
} | ||
|
||
resource "aws_wafv2_web_acl" "waf_web_acl" { | ||
name = "${var.app_name}-waf-web-acl-${var.environment}" | ||
description = "Load Balancer Web Application Firewall" | ||
scope = "REGIONAL" | ||
|
||
default_action { | ||
block {} | ||
} | ||
|
||
visibility_config { | ||
cloudwatch_metrics_enabled = true | ||
metric_name = "lb-waf-web-acl-metric" | ||
sampled_requests_enabled = true | ||
} | ||
|
||
rule { | ||
name = "${var.app_name}-allow-bcgov-ips-rule-${var.environment}" | ||
priority = 1 | ||
|
||
statement { | ||
ip_set_reference_statement { | ||
arn = aws_wafv2_ip_set.waf_ip_set.arn | ||
|
||
ip_set_forwarded_ip_config { | ||
header_name = "X-Forwarded-For" | ||
position = "ANY" | ||
fallback_behavior = "NO_MATCH" | ||
} | ||
} | ||
} | ||
|
||
action { | ||
allow {} | ||
} | ||
|
||
visibility_config { | ||
cloudwatch_metrics_enabled = true | ||
metric_name = "allow-bcgov-ips-rule-metric" | ||
sampled_requests_enabled = true | ||
} | ||
} | ||
} | ||
|
||
resource "aws_wafv2_web_acl_association" "waf_web_acl_assoc" { | ||
resource_arn = var.default_lb_arn | ||
web_acl_arn = aws_wafv2_web_acl.waf_web_acl.arn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
variable "app_name" { | ||
description = "The name of the application" | ||
type = string | ||
} | ||
|
||
variable "environment" { | ||
description = "The AWS environment to deploy to" | ||
type = string | ||
} | ||
|
||
variable "region" { | ||
description = "The AWS region" | ||
type = string | ||
} | ||
|
||
variable "allowed_ip_ranges" { | ||
description = "Comma delimited list of BC Gov CIDR IP addresses or CIDR ranges" | ||
type = string | ||
sensitive = true | ||
} | ||
|
||
variable "default_lb_arn" { | ||
description = "The default Load Balancer ARN" | ||
type = string | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
infrastructure/jasper-aws-bootstrap/bin/jasper-aws-bootstrap.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.