security.j 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. {% import 'variables.include' as var %}
  2. ##########################
  3. # Honeypot Secured Access
  4. resource "aws_security_group" "sg_honeypot_secured_access" {
  5. name = "sg_honeypot_secured_access"
  6. description = "Allows ssh from me. Allows select outbound for updates and such."
  7. vpc_id = "${aws_vpc.vpc_primary.id}"
  8. # SSH for management from me
  9. ingress {
  10. from_port = 22
  11. to_port = 22
  12. protocol = "tcp"
  13. cidr_blocks = ["${var.Trusted-CIDR}"]
  14. }
  15. # Outbound Access
  16. egress {
  17. from_port = 20
  18. to_port = 21
  19. protocol = "tcp"
  20. cidr_blocks = ["0.0.0.0/0"]
  21. }
  22. egress {
  23. from_port = 22
  24. to_port = 22
  25. protocol = "tcp"
  26. cidr_blocks = ["0.0.0.0/0"]
  27. }
  28. egress {
  29. from_port = 53
  30. to_port = 53
  31. protocol = "tcp"
  32. cidr_blocks = ["0.0.0.0/0"]
  33. }
  34. egress {
  35. from_port = 53
  36. to_port = 53
  37. protocol = "udp"
  38. cidr_blocks = ["0.0.0.0/0"]
  39. }
  40. egress {
  41. from_port = 80
  42. to_port = 80
  43. protocol = "tcp"
  44. cidr_blocks = ["0.0.0.0/0"]
  45. }
  46. egress {
  47. from_port = 443
  48. to_port = 443
  49. protocol = "tcp"
  50. cidr_blocks = ["0.0.0.0/0"]
  51. }
  52. }
  53. ##########################
  54. # Splunk Secured Access
  55. resource "aws_security_group" "sg_splunk_secured_access" {
  56. name = "sg_splunk_secured_access"
  57. description = "Allows ssh, http, and https from me. Allows select outbound for updates and such."
  58. vpc_id = "${aws_vpc.vpc_primary.id}"
  59. # SSH for management from me
  60. ingress {
  61. from_port = 22
  62. to_port = 22
  63. protocol = "tcp"
  64. cidr_blocks = ["${var.Trusted-CIDR}"]
  65. }
  66. ingress {
  67. from_port = 80
  68. to_port = 80
  69. protocol = "tcp"
  70. cidr_blocks = ["${var.Trusted-CIDR}"]
  71. }
  72. ingress {
  73. from_port = 443
  74. to_port = 443
  75. protocol = "tcp"
  76. cidr_blocks = ["${var.Trusted-CIDR}"]
  77. }
  78. # Outbound Access
  79. egress {
  80. from_port = 20
  81. to_port = 21
  82. protocol = "tcp"
  83. cidr_blocks = ["0.0.0.0/0"]
  84. }
  85. egress {
  86. from_port = 22
  87. to_port = 22
  88. protocol = "tcp"
  89. cidr_blocks = ["0.0.0.0/0"]
  90. }
  91. egress {
  92. from_port = 53
  93. to_port = 53
  94. protocol = "tcp"
  95. cidr_blocks = ["0.0.0.0/0"]
  96. }
  97. egress {
  98. from_port = 53
  99. to_port = 53
  100. protocol = "udp"
  101. cidr_blocks = ["0.0.0.0/0"]
  102. }
  103. egress {
  104. from_port = 80
  105. to_port = 80
  106. protocol = "tcp"
  107. cidr_blocks = ["0.0.0.0/0"]
  108. }
  109. egress {
  110. from_port = 443
  111. to_port = 443
  112. protocol = "tcp"
  113. cidr_blocks = ["0.0.0.0/0"]
  114. }
  115. }
  116. ##########################
  117. # All Open
  118. resource "aws_security_group" "sg_all_open" {
  119. name = "sg_all_open"
  120. description = "Allows everything."
  121. vpc_id = "${aws_vpc.vpc_primary.id}"
  122. # SSH for management from me
  123. ingress {
  124. from_port = 0
  125. to_port = 0
  126. protocol = -1
  127. cidr_blocks = ["0.0.0.0/0"]
  128. }
  129. # Outbound Access
  130. egress {
  131. from_port = 0
  132. to_port = 0
  133. protocol = -1
  134. cidr_blocks = ["0.0.0.0/0"]
  135. }
  136. }