waf.tf 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_alb.external.arn
  8. fqdns = [ # first entry in list will be the WAF name
  9. "${var.instance_name}.${var.dns_info["public"]["zone"]}"
  10. # example, to add additional valid hostnames
  11. # keys(module.public_dns_record_cust-auth-elb.forward),
  12. ]
  13. # Set to 'false' to set as 'count only'
  14. block_settings = {
  15. default = false, # Default action. False = count
  16. custom = false, # XDR Custom Rules. False = count
  17. admin = false, # /admin folder
  18. AWSManagedRulesCommonRuleSet = false,
  19. AWSManagedRulesAmazonIpReputationList = false,
  20. AWSManagedRulesKnownBadInputsRuleSet = false,
  21. AWSManagedRulesSQLiRuleSet = false,
  22. AWSManagedRulesLinuxRuleSet = false,
  23. AWSManagedRulesUnixRuleSet = false,
  24. }
  25. excluded_rules_AWSManagedRulesSQLiRuleSet = [
  26. ]
  27. excluded_rules_AWSManagedRulesUnixRuleSet = [
  28. ]
  29. excluded_rules_AWSManagedRulesLinuxRuleSet = [
  30. "LFI_URIPATH", # /web/config.js needed
  31. ]
  32. excluded_rules_AWSManagedRulesCommonRuleSet = [
  33. "SizeRestrictions_BODY", # for SAML
  34. "EC2MetaDataSSRF_BODY", # for SAML
  35. "GenericRFI_BODY", # for SAML
  36. ]
  37. # These are passed through and should be the same for module
  38. tags = merge(local.standard_tags, var.tags)
  39. aws_partition = var.aws_partition
  40. aws_region = var.aws_region
  41. aws_account_id = var.aws_account_id
  42. }
  43. # Example: If you want to attach the WAF to an additional ALB
  44. #
  45. # Share a WAF for both services, should be cheaper due to scale, but can be easily separated out
  46. # using the commented section below, if the need arises.
  47. #resource "aws_wafv2_web_acl_association" "associate-auth-to-waf" {
  48. # resource_arn = aws_lb.searchhead-auth-alb.arn
  49. # web_acl_arn = module.waf.web_acl_id
  50. #}
  51. # Example: If you want a second WAF, that should be straightforward
  52. #module "waf-auth" {
  53. # source = "../../../submodules/wafv2"
  54. #
  55. # # Custom to resource
  56. # allowed_ips = [ ] # bypasses filters, so should not be needed/used unless warranted
  57. # additional_blocked_ips = [ ] # NOTE: There is a standard list in the submodule
  58. # resource_arn = aws_lb.searchhead-auth-alb.arn
  59. # fqdns = keys(module.public_dns_record_cust-auth-elb.forward) # first entry in list will be the WAF name
  60. #
  61. # # These are passed through and should be the same for module
  62. # tags = merge(local.standard_tags, var.tags)
  63. # aws_partition = var.aws_partition
  64. # aws_region = var.aws_region
  65. # aws_account_id = var.aws_account_id
  66. #}