securitygroup-server.tf 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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(local.standard_tags, var.tags, { Name = "security_center" })
  13. vpc_id = var.vpc_id
  14. description = "Nessus Security Scanner"
  15. }
  16. #-----------------------------------------------------------------
  17. # Ingress
  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. description = "443 - Inbound (from access, for testing)"
  23. cidr_blocks = local.cidr_map["vpc-access"]
  24. from_port = 443
  25. to_port = 443
  26. protocol = "tcp"
  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. # Egress
  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(local.cidr_map["vpc-scanners"], local.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. }