-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvagrant-whonix-gateway.pkr.hcl
62 lines (55 loc) · 2.09 KB
/
vagrant-whonix-gateway.pkr.hcl
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
variable "do_api_token" {
type = string
default = "${env("DO_API_TOKEN")}"
}
source "digitalocean" "vagrant-whonix-gateway" {
api_token = "${var.do_api_token}"
image = "debian-10-x64"
region = "nyc3"
size = "s-1vcpu-1gb"
ssh_username = "root"
}
# a build block invokes sources and runs provisioning steps on them.
build {
sources = ["source.digitalocean.vagrant-whonix-gateway"]
provisioner "file" {
destination = "/root/torrc.sh"
source = "./torrc.sh"
}
provisioner "file" {
destination = "/root/build.sh"
source = "./build.sh"
}
provisioner "shell" {
inline = [
"DEBIAN_FRONTEND=noninteractive",
"sudo apt-get update",
"DEBIAN_FRONTEND=noninteractive; echo \"no\n\" | apt-get install -y apt-cacher-ng",
"sudo apt-get install -y gnupg2 sudo git apt-utils wget time curl lsb-release fakeroot dpkg-dev procps",
"apt-get install -y adduser",
"wget https://www.whonix.org/patrick.asc -O ~/patrick.asc",
"gpg --import ~/patrick.asc",
"gpg --keyid-format long --import --import-options show-only --with-fingerprint ~/patrick.asc",
"sudo apt-key --keyring /etc/apt/trusted.gpg.d/whonix.gpg add ~/patrick.asc",
"echo \"deb http://deb.whonix.org buster main\" | tee /etc/apt/sources.list.d/whonix.list",
"apt-get update && apt-get upgrade -y",
"apt-get install -y genmkfile",
"adduser --quiet --disabled-password --home /home/user --gecos 'user,,,,' user",
"echo \"user:changeme\" | chpasswd",
"addgroup user sudo",
"apt-get install -y net-tools tor",
"sh ~/torrc.sh",
"pkill tor",
"tor 2>&1 &",
"sleep 5",
"apt-get update && apt-get dist-upgrade -y",
"chmod +x /root/build.sh",
"reboot"
]
}
provisioner "shell2" {
script = "sh /root/build.sh"
pause_before = "30s"
}
post-processor "vagrant" {}
}