This repository has been archived by the owner on Jun 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
feat: redirect /login to /home #762
Open
patheard
wants to merge
2
commits into
main
Choose a base branch
from
feat/redirect-login-home
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
Add a custom WAF ACL rule that redirecs requests to the login page to the home page.
sylviamclaughlin
approved these changes
Jun 17, 2022
mohdnr
approved these changes
Jun 17, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀 ✅ super convenient
Plan changes✅ Terraform Format: Plan: 0 to add, 1 to change, 0 to destroy Show planResource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# aws_wafv2_web_acl.qrcode_acl will be updated in-place
~ resource "aws_wafv2_web_acl" "qrcode_acl" {
arn = "arn:aws:wafv2:ca-central-1:595701125956:regional/webacl/qrcode/90ed9118-ca41-437c-862b-a8d6cb10a584"
capacity = 1140
id = "90ed9118-ca41-437c-862b-a8d6cb10a584"
lock_token = "24f3ca30-69ba-4f1f-9f0a-ca472def0b2f"
name = "qrcode"
scope = "REGIONAL"
tags = {
"CostCentre" = "CovidPortal_Staging"
}
tags_all = {
"CostCentre" = "CovidPortal_Staging"
}
default_action {
allow {
}
}
+ rule {
+ name = "RedirectLoginToHome"
+ priority = 110
+ action {
+ block {
+ custom_response {
+ response_code = 301
+ response_header {
+ name = "Location"
+ value = "https://staging.covid-hcportal.cdssandbox.xyz"
}
}
}
}
+ statement {
+ byte_match_statement {
+ positional_constraint = "CONTAINS"
+ search_string = "/login"
+ field_to_match {
+ uri_path {}
}
+ text_transformation {
+ priority = 0
+ type = "LOWERCASE"
}
}
}
+ visibility_config {
+ cloudwatch_metrics_enabled = true
+ metric_name = "RedirectLoginToHome"
+ sampled_requests_enabled = true
}
}
- rule {
- name = "CanadaOnlyGeoRestriction" -> null
- priority = 5 -> null
- action {
- block {
- custom_response {
- response_code = 403 -> null
- response_header {
- name = "waf-block" -> null
- value = "CanadaOnlyGeoRestriction" -> null
}
}
}
}
- statement {
- not_statement {
- statement {
- geo_match_statement {
- country_codes = [
- "CA",
] -> null
}
}
}
}
- visibility_config {
- cloudwatch_metrics_enabled = true -> null
- metric_name = "CanadaOnlyGeoRestriction" -> null
- sampled_requests_enabled = true -> null
}
}
+ rule {
+ name = "CanadaOnlyGeoRestriction"
+ priority = 5
+ action {
+ block {
+ custom_response {
+ response_code = 403
+ response_header {
+ name = "waf-block"
+ value = "CanadaOnlyGeoRestriction"
}
}
}
}
+ statement {
+ not_statement {
+ statement {
+ geo_match_statement {
+ country_codes = [
+ "CA",
]
}
}
}
}
+ visibility_config {
+ cloudwatch_metrics_enabled = true
+ metric_name = "CanadaOnlyGeoRestriction"
+ sampled_requests_enabled = true
}
}
rule {
name = "PostRequestLimit"
priority = 102
action {
block {
}
}
statement {
rate_based_statement {
aggregate_key_type = "IP"
limit = 100
scope_down_statement {
byte_match_statement {
positional_constraint = "EXACTLY"
search_string = "post"
field_to_match {
method {}
}
text_transformation {
priority = 1
type = "LOWERCASE"
}
}
}
}
}
visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "PostRequestRateLimit"
sampled_requests_enabled = true
}
}
rule {
name = "AWSManagedRulesAmazonIpReputationList"
priority = 1
override_action {
none {}
}
statement {
managed_rule_group_statement {
name = "AWSManagedRulesAmazonIpReputationList"
vendor_name = "AWS"
}
}
visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "AWSManagedRulesAmazonIpReputationList"
sampled_requests_enabled = true
}
}
rule {
name = "AWSManagedRulesCommonRuleSet"
priority = 2
override_action {
none {}
}
statement {
managed_rule_group_statement {
name = "AWSManagedRulesCommonRuleSet"
vendor_name = "AWS"
}
}
visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "AWSManagedRulesCommonRuleSet"
sampled_requests_enabled = true
}
}
rule {
name = "AWSManagedRulesKnownBadInputsRuleSet"
priority = 3
override_action {
none {}
}
statement {
managed_rule_group_statement {
name = "AWSManagedRulesKnownBadInputsRuleSet"
vendor_name = "AWS"
}
}
visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "AWSManagedRulesKnownBadInputsRuleSet"
sampled_requests_enabled = true
}
}
rule {
name = "AWSManagedRulesLinuxRuleSet"
priority = 4
override_action {
none {}
}
statement {
managed_rule_group_statement {
name = "AWSManagedRulesLinuxRuleSet"
vendor_name = "AWS"
}
}
visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "AWSManagedRulesLinuxRuleSet"
sampled_requests_enabled = true
}
}
visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "covid_portal_global_rule"
sampled_requests_enabled = false
}
}
Plan: 0 to add, 1 to change, 0 to destroy.
Changes to Outputs:
ecs_cluster = {
arn = "arn:aws:ecs:ca-central-1:595701125956:cluster/covid-portal_staging"
capacity_providers = [
"FARGATE",
]
configuration = []
default_capacity_provider_strategy = [
{
base = 2
capacity_provider = "FARGATE"
weight = 1
},
]
id = "arn:aws:ecs:ca-central-1:595701125956:cluster/covid-portal_staging"
name = "covid-portal_staging"
setting = [
{
name = "containerInsights"
value = "enabled"
},
]
tags = {
"CostCentre" = "CovidPortal_Staging"
}
tags_all = {
"CostCentre" = "CovidPortal_Staging"
}
}
security_group_egress = {
arn = "arn:aws:ec2:ca-central-1:595701125956:security-group/sg-006789af77a3fbdcb"
description = "Egress - CovidShield External Services"
egress = [
{
cidr_blocks = [
"0.0.0.0/0",
]
description = "Security group rule for Portal New Relic egress"
from_port = 443
ipv6_cidr_blocks = []
prefix_list_ids = []
protocol = "tcp"
security_groups = []
self = false
to_port = 443
},
{
cidr_blocks = [
"0.0.0.0/0",
]
description = "Security group rule for Portal email egress"
from_port = 587
ipv6_cidr_blocks = []
prefix_list_ids = []
protocol = "tcp"
security_groups = []
self = false
to_port = 587
},
]
id = "sg-006789af77a3fbdcb"
ingress = []
name = "egress-anywhere"
name_prefix = ""
owner_id = "595701125956"
revoke_rules_on_delete = false
tags = {
"CostCentre" = "CovidPortal_Staging"
}
tags_all = {
"CostCentre" = "CovidPortal_Staging"
}
timeouts = null
vpc_id = "vpc-0e71ff594dff0ef9d"
}
security_group_load_balancer = {
arn = "arn:aws:ec2:ca-central-1:595701125956:security-group/sg-0ddadcce9ea825a8e"
description = "Ingress - covidportal Load Balancer"
egress = [
{
cidr_blocks = [
"172.16.0.0/16",
]
description = ""
from_port = 8000
ipv6_cidr_blocks = []
prefix_list_ids = []
protocol = "tcp"
security_groups = []
self = false
to_port = 8000
},
]
id = "sg-0ddadcce9ea825a8e"
ingress = [
{
cidr_blocks = [
"0.0.0.0/0",
]
description = ""
from_port = 443
ipv6_cidr_blocks = []
prefix_list_ids = []
protocol = "tcp"
security_groups = []
self = false
to_port = 443
},
{
cidr_blocks = [
"0.0.0.0/0",
]
description = ""
from_port = 80
ipv6_cidr_blocks = []
prefix_list_ids = []
protocol = "tcp"
security_groups = []
self = false
to_port = 80
},
]
name = "covidportal-load-balancer"
name_prefix = ""
owner_id = "595701125956"
revoke_rules_on_delete = false
tags = {
"CostCentre" = "CovidPortal_Staging"
}
tags_all = {
"CostCentre" = "CovidPortal_Staging"
}
timeouts = null
vpc_id = "vpc-0e71ff594dff0ef9d"
}
Warning: Argument is deprecated
on s3.tf line 4, in resource "aws_s3_bucket" "firehose_waf_logs":
4: resource "aws_s3_bucket" "firehose_waf_logs" {
Use the aws_s3_bucket_server_side_encryption_configuration resource instead
(and 8 more similar warnings elsewhere)
------------------------------------------------------------------------
This plan was saved to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Releasing state lock. This may take a few moments...
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add a custom WAF ACL rule that redirects requests
to the login page to the home page.