security.j 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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}", "${var.VPC-Subnet}"]
  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. egress {
  53. from_port = 8089
  54. to_port = 8089
  55. protocol = "tcp"
  56. cidr_blocks = ["0.0.0.0/0"]
  57. }
  58. egress {
  59. from_port = 9997
  60. to_port = 9997
  61. protocol = "tcp"
  62. cidr_blocks = ["0.0.0.0/0"]
  63. }
  64. }
  65. ##########################
  66. # Splunk Secured Access
  67. resource "aws_security_group" "sg_splunk_secured_access" {
  68. name = "sg_splunk_secured_access"
  69. description = "Allows ssh, http, and https from me. Allows select outbound for updates and such."
  70. vpc_id = "${aws_vpc.vpc_primary.id}"
  71. # SSH for management from me
  72. ingress {
  73. from_port = 22
  74. to_port = 22
  75. protocol = "tcp"
  76. cidr_blocks = ["${var.Trusted-CIDR}"]
  77. }
  78. ingress {
  79. from_port = 80
  80. to_port = 80
  81. protocol = "tcp"
  82. cidr_blocks = ["${var.Trusted-CIDR}"]
  83. }
  84. ingress {
  85. from_port = 443
  86. to_port = 443
  87. protocol = "tcp"
  88. cidr_blocks = ["${var.Trusted-CIDR}"]
  89. }
  90. ingress {
  91. from_port = 8089
  92. to_port = 8089
  93. protocol = "tcp"
  94. cidr_blocks = ["${var.VPC-Subnet}"]
  95. }
  96. ingress {
  97. from_port = 9997
  98. to_port = 9997
  99. protocol = "tcp"
  100. cidr_blocks = ["${var.VPC-Subnet}"]
  101. }
  102. # Outbound Access
  103. egress {
  104. from_port = 20
  105. to_port = 21
  106. protocol = "tcp"
  107. cidr_blocks = ["0.0.0.0/0"]
  108. }
  109. egress {
  110. from_port = 22
  111. to_port = 22
  112. protocol = "tcp"
  113. cidr_blocks = ["0.0.0.0/0"]
  114. }
  115. egress {
  116. from_port = 53
  117. to_port = 53
  118. protocol = "tcp"
  119. cidr_blocks = ["0.0.0.0/0"]
  120. }
  121. egress {
  122. from_port = 53
  123. to_port = 53
  124. protocol = "udp"
  125. cidr_blocks = ["0.0.0.0/0"]
  126. }
  127. egress {
  128. from_port = 80
  129. to_port = 80
  130. protocol = "tcp"
  131. cidr_blocks = ["0.0.0.0/0"]
  132. }
  133. egress {
  134. from_port = 443
  135. to_port = 443
  136. protocol = "tcp"
  137. cidr_blocks = ["0.0.0.0/0"]
  138. }
  139. }
  140. ##########################
  141. # All Open
  142. resource "aws_security_group" "sg_all_open" {
  143. name = "sg_all_open"
  144. description = "Allows everything."
  145. vpc_id = "${aws_vpc.vpc_primary.id}"
  146. # SSH for management from me
  147. ingress {
  148. from_port = 0
  149. to_port = 0
  150. protocol = -1
  151. cidr_blocks = ["0.0.0.0/0"]
  152. }
  153. # Outbound Access
  154. egress {
  155. from_port = 0
  156. to_port = 0
  157. protocol = -1
  158. cidr_blocks = ["0.0.0.0/0"]
  159. }
  160. }