-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathfirewalls.tf
104 lines (93 loc) · 2.4 KB
/
firewalls.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# configure http c2 firewall
resource "digitalocean_firewall" "c2-http" {
name = "c2-http"
droplet_ids = [
"${digitalocean_droplet.c2-http.id}",
"${digitalocean_droplet.c2-http-rdr.id}",
"${digitalocean_droplet.phishing.id}",
"${digitalocean_droplet.phishing-rdr.id}"
]
inbound_rule = [
{
protocol = "tcp"
port_range = "22"
source_addresses = ["${var.operator-ip}"]
},
{
protocol = "tcp"
port_range = "80"
source_addresses = ["0.0.0.0/0"]
},
{
protocol = "tcp"
port_range = "443"
source_addresses = ["0.0.0.0/0"]
}
]
outbound_rule = [
{
protocol = "udp"
port_range = "53"
destination_addresses = ["0.0.0.0/0"]
},
{
protocol = "tcp"
port_range = "80"
destination_addresses = ["0.0.0.0/0"]
},
{
protocol = "tcp"
port_range = "443"
destination_addresses = ["0.0.0.0/0"]
}
]
}
resource "digitalocean_firewall" "operator" {
name = "operator"
droplet_ids = [
"${digitalocean_droplet.c2-http.id}"
]
inbound_rule = [
{
protocol = "tcp"
port_range = "50050"
source_addresses = ["${var.operator-ip}"]
}
]
}
resource "digitalocean_firewall" "phishing" {
name = "phishing"
droplet_ids = ["${digitalocean_droplet.phishing.id}"]
inbound_rule = [
{
protocol = "tcp"
port_range = "3333"
source_addresses = ["${var.operator-ip}"]
}
]
outbound_rule = [
{
protocol = "tcp"
port_range = "25"
destination_addresses = ["${digitalocean_droplet.phishing-rdr.ipv4_address}"]
}
]
}
resource "digitalocean_firewall" "stmp-relay" {
name = "stmp-relay"
droplet_ids = ["${digitalocean_droplet.phishing-rdr.id}"]
inbound_rule = [
{
protocol = "tcp"
port_range = "25"
source_addresses = ["${digitalocean_droplet.phishing.ipv4_address}"]
}
]
outbound_rule = [
{
protocol = "tcp"
port_range = "25"
destination_addresses = ["0.0.0.0/0"]
}
]
}