waf.tf 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. module "waf" {
  2. source = "../../../submodules/wafv2"
  3. # Custom to resource
  4. allowed_ips = [] # bypasses filters, so should not be needed/used unless warranted
  5. admin_ips = concat(local.zscalar_ips, local.admin_ips)
  6. additional_blocked_ips = [] # NOTE: There is a standard list in the submodule
  7. resource_arn = aws_lb.searchhead-alb.arn
  8. fqdns = concat( # first entry in list will be the WAF name
  9. module.public_dns_record_cust-elb.forward,
  10. # example, to add additional valid hostnames
  11. # keys(module.public_dns_record_cust-auth-elb.forward),
  12. )
  13. excluded_rules_AWSManagedRulesCommonRuleSet = [
  14. "CrossSiteScripting_BODY",
  15. "SizeRestrictions_BODY",
  16. "SizeRestrictions_QUERYSTRING",
  17. "RestrictedExtensions_URIPATH",
  18. "RestrictedExtensions_QUERYARGUMENTS",
  19. "EC2MetaDataSSRF_BODY",
  20. "GenericLFI_BODY",
  21. ]
  22. excluded_rules_AWSManagedRulesSQLiRuleSet = [
  23. "SQLi_QUERYARGUMENTS",
  24. "SQLi_BODY",
  25. ]
  26. excluded_rules_AWSManagedRulesUnixRuleSet = [
  27. "UNIXShellCommandsVariables_BODY",
  28. "UNIXShellCommandsVariables_QUERYARGUMENTS",
  29. ]
  30. excluded_rules_AWSManagedRulesLinuxRuleSet = [
  31. "LFI_QUERYSTRING",
  32. ]
  33. # These are passed through and should be the same for module
  34. tags = merge(local.standard_tags, var.tags)
  35. aws_partition = var.aws_partition
  36. aws_region = var.aws_region
  37. aws_account_id = var.aws_account_id
  38. }
  39. # Example: If you want to attach the WAF to an additional ALB
  40. #
  41. # Share a WAF for both services, should be cheaper due to scale, but can be easily separated out
  42. # using the commented section below, if the need arises.
  43. #resource "aws_wafv2_web_acl_association" "associate-auth-to-waf" {
  44. # resource_arn = aws_lb.searchhead-auth-alb.arn
  45. # web_acl_arn = module.waf.web_acl_id
  46. #}
  47. # Example: If you want a second WAF, that should be straightforward
  48. #module "waf-auth" {
  49. # source = "../../../submodules/wafv2"
  50. #
  51. # # Custom to resource
  52. # allowed_ips = [ ] # bypasses filters, so should not be needed/used unless warranted
  53. # additional_blocked_ips = [ ] # NOTE: There is a standard list in the submodule
  54. # resource_arn = aws_lb.searchhead-auth-alb.arn
  55. # fqdns = keys(module.public_dns_record_cust-auth-elb.forward) # first entry in list will be the WAF name
  56. #
  57. # # These are passed through and should be the same for module
  58. # tags = merge(local.standard_tags, var.tags)
  59. # aws_partition = var.aws_partition
  60. # aws_region = var.aws_region
  61. # aws_account_id = var.aws_account_id
  62. #}