Skip to content

Commit f69f255

Browse files
committed
Land #491, update docs for using vagrant to develop ub1404
2 parents 45f2737 + ea810af commit f69f255

File tree

2 files changed

+49
-28
lines changed

2 files changed

+49
-28
lines changed

README.md

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,39 @@ Requirements:
6161

6262
### ub1404 Development and Modification
6363

64-
Using Vagrant and a lightweight Ubuntu 14.04 vagrant cloud box image, you can quickly set up and customize ub1404 Metasploitable3 for development or customization.
65-
To do so, install Vagrant and a hypervisor such as VirtualBox. Then, visit the `bento/ubuntu-14.04` page and find a version that supports
66-
your hypervisor. For instance, version `v201808.24.0` is compatible with VirtualBox.
64+
Using Vagrant and a lightweight Ubuntu 14.04 vagrant cloud box image, you can
65+
quickly set up and customize ub1404 Metasploitable3 for development or
66+
customization. To do so, install Vagrant and a hypervisor such as VirtualBox,
67+
VMWare, or libvirt.
6768

68-
Install the vagrant virtualbox vbguest plugin:
69+
Install the relevant provider plugin:
6970

71+
# virtualbox
7072
vagrant plugin install vagrant-vbguest
71-
72-
Then, navigate to the `/chef/dev/ub1404` directory in this repository. Examine the Vagrantfile there. Metasploitable ub1404 uses the vagrant `chef-solo` provisioner.
73-
To this Vagrantfile, add the metasploitable chef recipes that you desire -- you can browse them in the `/chef/cookbooks/metasploitable` folder. Or,
74-
add or edit your own cookbook and/or recipes there.
75-
76-
From the `/chef/dev/ub1404` directory, you can run `vagrant up` to get a development virtual ub1404 instance. After the initial `up` build and provision,
77-
when you edit the chef runlist or when you edit a chef recipe, run `vagrant provision` from the same directory. For faster development, you can comment-out
78-
recipes that you do not need to rerun -- but even if they are all enabled, vagrant provisioning should not take longer one or two minutes.
79-
Chef aims to be idempotent, so you can rerun this command often.
80-
81-
Consider taking a snapshot (e.g., `vagrant snapshot new fresh`) before modifying recipes, so that you can always return to an initial state (`vagrant restore fresh`).
82-
If you want a _totally_ fresh snapshot, you can do the initialization with `vagrant up --no-provision`, then take a snapshot, followed by `vagrant provision`.
73+
74+
# libvirt
75+
vagrant plugin install vagrant-libvirt
76+
77+
Then, navigate to the [chef/dev/ub1404](chef/dev/ub1404) directory in this repository.
78+
Examine the Vagrantfile there. Select a base box that supports your provider.
79+
80+
Metasploitable ub1404 uses the vagrant `chef-solo` provisioner. Configure the
81+
chef_solo block in the Vagrantfile with the metasploitable chef recipes that you
82+
desire -- you can browse them in the [chef/cookbooks/metasploitable](chef/cookbooks/metasploitable)
83+
folder. Or, add or edit your own cookbook and/or recipes there.
84+
85+
From the [chef/dev/ub1404](chef/dev/ub1404) directory, you can run `vagrant up`
86+
to get a development virtual ub1404 instance. After the initial `up` build and provision,
87+
when you edit the chef runlist or when you edit a chef recipe, run
88+
`vagrant rsync && vagrant provision` from the same directory. For faster
89+
development, you can comment-out recipes that you do not need to rerun -- but
90+
even if they are all enabled, vagrant re-provisioning should not take longer than
91+
one or two minutes. Chef aims to be idempotent, so you can rerun this command often.
92+
93+
Consider taking a snapshot (e.g., `vagrant snapshot save fresh`) before modifying
94+
recipes, so that you can always return to an initial state (`vagrant restore fresh`).
95+
If you want a _totally_ fresh snapshot, you can do the initialization with
96+
`vagrant up --no-provision`, then take a snapshot, followed by `vagrant provision`.
8397

8498

8599
## Vulnerabilities

chef/dev/ub1404/Vagrantfile

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
# This Vagrantfile can be used to quickly spin up a development instance of ub1404
22

33
Vagrant.configure("2") do |config|
4-
config.vm.define "dev" do |dev|
5-
dev.vm.box = "bento/ubuntu-14.04"
6-
dev.vm.box_version = "201808.24.0"
7-
dev.ssh.username = 'vagrant'
8-
dev.ssh.password = 'vagrant'
9-
dev.vm.network "forwarded_port", guest: 21, host:2121
104

11-
dev.vm.provider "virtualbox" do |v|
12-
v.name = "Metasploitable3-ub1404-dev"
13-
v.memory = 2048
14-
end
5+
config.vm.define "Metasploitable3-dev"
6+
config.vm.box = "bento/ubuntu-14.04"
7+
config.vm.box_version = "201808.24.0"
8+
9+
config.vm.provider :libvirt do |libvirt, override|
10+
override.vm.box = "peru/ubuntu-14.04-server-amd64"
11+
override.vm.box_version = "20190901.01"
12+
libvirt.memory = 2048
1513
end
16-
14+
15+
config.ssh.username = 'vagrant'
16+
config.ssh.password = 'vagrant'
17+
config.vm.network "forwarded_port", guest: 21, host:2121
18+
19+
# manually rsync recipe changes before re-provisioning. e.g.,
20+
# `vagrant rsync && vagrant provision`
1721
config.vm.provision "chef_solo" do |chef|
1822
chef.arguments = '--chef-license accept'
1923
chef.cookbooks_path = [ '../../cookbooks' ]
@@ -41,4 +45,7 @@ Vagrant.configure("2") do |config|
4145
chef.add_recipe "metasploitable::flags"
4246
chef.add_recipe "metasploitable::clear_cache"
4347
end
44-
end
48+
49+
# Disable NFS sharing (==> default: Mounting NFS shared folders...)
50+
config.vm.synced_folder ".", "/vagrant", type: "nfs", disabled: true
51+
end

0 commit comments

Comments
 (0)