securitygroup-server.tf 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # SG Summary - Server
  2. # Ingress:
  3. # 22 - sync from other security centers
  4. # 443 - User access
  5. # Egress:
  6. # 25 - smtp
  7. # 443 - updates
  8. # tcp/1243 - "Communicating with Log Correlation Engine" (unneeded in xdr)
  9. # tcp/8834-8835 - Communicating With Nessus - to vpc-scanners
  10. resource "aws_security_group" "security_center" {
  11. name_prefix = "security_center"
  12. tags = merge( var.standard_tags, var.tags, { Name = "security_center" } )
  13. vpc_id = var.vpc_id
  14. description = "Nessus Security Scanner"
  15. }
  16. #-----------------------------------------------------------------
  17. # Inbound access
  18. #-----------------------------------------------------------------
  19. resource "aws_security_group_rule" "security_center_inbound_443" {
  20. security_group_id = aws_security_group.security_center.id
  21. type = "ingress"
  22. cidr_blocks = var.cidr_map["vpc-access"]
  23. from_port = 443
  24. to_port = 443
  25. protocol = "tcp"
  26. description = "Inbound 443 (from access, for testing)"
  27. }
  28. resource "aws_security_group_rule" "security_center_inbound_443_from_alb" {
  29. security_group_id = aws_security_group.security_center.id
  30. type = "ingress"
  31. source_security_group_id = aws_security_group.security_center_alb_server_internal.id
  32. from_port = 443
  33. to_port = 443
  34. protocol = "tcp"
  35. description = "Inbound 443 from the ALB"
  36. }
  37. #-----------------------------------------------------------------
  38. # Outbound access
  39. #-----------------------------------------------------------------
  40. resource "aws_security_group_rule" "security_center_outbound_nessus" {
  41. security_group_id = aws_security_group.security_center.id
  42. type = "egress"
  43. cidr_blocks = concat(var.cidr_map["vpc-scanners"], var.cidr_map["vpc-private-services"]) # Scanners and managers
  44. from_port = 8834
  45. to_port = 8835
  46. protocol = "tcp"
  47. description = "Outbound to Scanners and Managers"
  48. }