-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
156 lines (145 loc) · 6.46 KB
/
Vagrantfile
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
Vagrant.configure("2") do |config|
config.vm.define "opnsense", autostart: true do |opnsense|
opnsense.vm.box = "bento/freebsd-13.2"
opnsense.vm.hostname = 'tartarus-opnsense'
opnsense.vm.box_url = "bento/freebsd-13.2"
opnsense.ssh.shell = '/bin/sh'
opnsense.vm.synced_folder '.', '/vagrant', id: 'vagrant-root', disabled: true
opnsense.vm.provision :shell, path: "OPBootstrap.sh"
opnsense.vm.network :private_network, ip: "192.168.56.2"
opnsense.vm.network :private_network, ip: "192.168.56.254"
opnsense.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--cpus", 2]
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--name", "tartarus-opnsense"]
end
end
config.vm.define "elastic", autostart: true do |elastic|
elastic.vm.box = "bento/rockylinux-8.7"
elastic.vm.hostname = 'tartarus-elastic'
elastic.vm.box_url = "bento/rockylinux-8.7"
elastic.vm.network :private_network, ip: "192.168.56.10", auto_config: false
elastic.vm.network :forwarded_port, guest: 5443, host: 5443, host_ip: "0.0.0.0", id: "kibana", auto_correct: true
elastic.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--cpus", 4]
v.customize ["modifyvm", :id, "--memory", 8192]
v.customize ["modifyvm", :id, "--name", "tartarus-elastic"]
end
elastic.vm.provision "shell", inline: <<-SHELL
systemctl start NetworkManager
systemctl enable NetworkManager
nmcli connection add type ethernet con-name eth1 ifname eth1 ip4 192.168.56.10/25 gw4 192.168.56.2
nmcli connection modify eth1 ipv4.dns "1.1.1.1 1.0.0.1"
nmcli connection modify eth1 ipv4.route-metric 10
nmcli connection up eth1
SHELL
elastic.vm.provision :shell, path: "ESBootstrap.sh"
end
config.vm.define "linux", autostart: false do |linux|
linux.vm.box = "bento/rockylinux-8.7"
linux.vm.hostname = 'tartarus-linux'
linux.vm.box_url = "bento/rockylinux-8.7"
linux.vm.network :private_network, ip: "192.168.56.20"
linux.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--cpus", 1]
v.customize ["modifyvm", :id, "--memory", 4096]
v.customize ["modifyvm", :id, "--name", "tartarus-linux"]
end
linux.vm.provision "shell", inline: <<-SHELL
systemctl start NetworkManager
systemctl enable NetworkManager
nmcli connection add type ethernet con-name eth1 ifname eth1 ip4 192.168.56.20/25 gw4 192.168.56.2
nmcli connection modify eth1 ipv4.dns "1.1.1.1 1.0.0.1"
nmcli connection modify eth1 ipv4.route-metric 10
nmcli connection up eth1
SHELL
linux.vm.provision :shell, path: "ALBootstrap.sh"
end
config.vm.define "ubuntu", autostart: false do |ubuntu|
ubuntu.vm.box = "bento/ubuntu-20.04"
ubuntu.vm.hostname = 'tartarus-ubuntu'
ubuntu.vm.box_url = "bento/ubuntu-20.04"
# Configuring both NAT and private network interfaces
ubuntu.vm.network :private_network, ip: "192.168.56.21", netmask: "255.255.255.128"
ubuntu.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--cpus", 1]
v.customize ["modifyvm", :id, "--memory", 4096]
v.customize ["modifyvm", :id, "--name", "tartarus-ubuntu"]
end
# Provisioning script using Netplan
ubuntu.vm.provision "shell", inline: <<-SHELL
# Create Netplan configuration
cat > /etc/netplan/01-netcfg.yaml << EOF
network:
version: 2
ethernets:
eth0:
dhcp4: true
eth1:
dhcp4: no
addresses:
- 192.168.56.21/25
gateway4: 192.168.56.2
nameservers:
addresses:
- 1.1.1.1
- 1.0.0.1
routes:
- to: default
via: 192.168.56.2
metric: 10
EOF
# Apply Netplan configuration
sudo netplan apply
SHELL
# Additional provisioning script
ubuntu.vm.provision :shell, path: "ALBootstrap.sh"
end
config.vm.define "windows", autostart: false do |windows|
windows.vm.box = "gusztavvargadr/windows-10-21h2-enterprise"
windows.vm.hostname = 'tartarus-windows'
windows.vm.box_url = "gusztavvargadr/windows-10-21h2-enterprise"
windows.vm.network :private_network, ip: "192.168.56.30", auto_config: false
windows.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--cpus", 2]
v.customize ["modifyvm", :id, "--memory", 4096]
v.customize ["modifyvm", :id, "--name", "tartarus-windows"]
end
windows.vm.provision "shell", privileged: true, inline: <<-SHELL
$interfaceIndexEth2 = (Get-NetAdapter -Name 'Ethernet 2').InterfaceIndex
New-NetIPAddress -InterfaceIndex $interfaceIndexEth2 -IPAddress 192.168.56.30 -PrefixLength 25 -DefaultGateway 192.168.56.2
Set-DnsClientServerAddress -InterfaceIndex $interfaceIndexEth2 -ServerAddresses "1.1.1.1", "1.0.0.1"
$interfaceIndexEth1 = (Get-NetAdapter -Name 'Ethernet').InterfaceIndex
route change 0.0.0.0 mask 0.0.0.0 10.0.2.2 metric 1000 IF $interfaceIndexEth1
SHELL
windows.vm.provision :shell, privileged: "true", path: "AWBootstrap.ps1"
end
config.vm.define "kali", autostart: false do |kali|
kali.vm.box = "kalilinux/rolling"
kali.vm.hostname = 'tartarus-kali'
kali.vm.box_url = "kalilinux/rolling"
kali.vm.network :private_network, ip: "192.168.56.129", auto_config: false
kali.vm.network :forwarded_port, guest: 8888, host: 8888, host_ip: "0.0.0.0", id: "caldera", auto_correct: true
kali.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--cpus", 4]
v.customize ["modifyvm", :id, "--memory", 8192]
v.customize ["modifyvm", :id, "--name", "tartarus-kali"]
end
kali.vm.provision "shell", inline: <<-SHELL
systemctl start NetworkManager
systemctl enable NetworkManager
nmcli connection add type ethernet con-name eth1 ifname eth1 ip4 192.168.56.129/25 gw4 192.168.56.254
nmcli connection modify eth1 ipv4.dns "1.1.1.1 1.0.0.1"
nmcli connection modify eth1 ipv4.route-metric 10
nmcli connection up eth1
echo " metric 100" >> /etc/network/interfaces
systemctl restart networking.service
SHELL
end
end