-
Notifications
You must be signed in to change notification settings - Fork 1
/
firewall.tf
37 lines (30 loc) · 976 Bytes
/
firewall.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
# Firewall that blocks all inbound traffic except https for tailscale, outbound traffic is allowed
resource "digitalocean_firewall" "only-tailscale" {
name = "only-tailscale-${var.instance_name}"
droplet_ids = [digitalocean_droplet.ubi.id]
inbound_rule {
protocol = "tcp"
port_range = "443"
source_addresses = ["0.0.0.0/0", "::/0"]
}
inbound_rule {
protocol = "icmp"
source_addresses = ["0.0.0.0/0", "::/0"]
}
outbound_rule {
protocol = "tcp"
port_range = "1-65535"
destination_addresses = ["0.0.0.0/0", "::/0"]
}
outbound_rule {
protocol = "udp"
port_range = "1-65535"
destination_addresses = ["0.0.0.0/0", "::/0"]
}
outbound_rule {
protocol = "icmp"
destination_addresses = ["0.0.0.0/0", "::/0"]
}
# Tailscale must be installed & up before we block outside access
depends_on = [null_resource.ansible]
}