Land #491, update docs for using vagrant to develop ub1404
This commit is contained in:
commit
f69f255723
42
README.md
42
README.md
|
@ -61,25 +61,39 @@ Requirements:
|
||||||
|
|
||||||
### ub1404 Development and Modification
|
### ub1404 Development and Modification
|
||||||
|
|
||||||
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.
|
Using Vagrant and a lightweight Ubuntu 14.04 vagrant cloud box image, you can
|
||||||
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
|
quickly set up and customize ub1404 Metasploitable3 for development or
|
||||||
your hypervisor. For instance, version `v201808.24.0` is compatible with VirtualBox.
|
customization. To do so, install Vagrant and a hypervisor such as VirtualBox,
|
||||||
|
VMWare, or libvirt.
|
||||||
|
|
||||||
Install the vagrant virtualbox vbguest plugin:
|
Install the relevant provider plugin:
|
||||||
|
|
||||||
|
# virtualbox
|
||||||
vagrant plugin install vagrant-vbguest
|
vagrant plugin install vagrant-vbguest
|
||||||
|
|
||||||
Then, navigate to the `/chef/dev/ub1404` directory in this repository. Examine the Vagrantfile there. Metasploitable ub1404 uses the vagrant `chef-solo` provisioner.
|
|
||||||
To this Vagrantfile, add the metasploitable chef recipes that you desire -- you can browse them in the `/chef/cookbooks/metasploitable` folder. Or,
|
|
||||||
add or edit your own cookbook and/or recipes there.
|
|
||||||
|
|
||||||
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,
|
# libvirt
|
||||||
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
|
vagrant plugin install vagrant-libvirt
|
||||||
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.
|
|
||||||
Chef aims to be idempotent, so you can rerun this command often.
|
|
||||||
|
|
||||||
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`).
|
Then, navigate to the [chef/dev/ub1404](chef/dev/ub1404) directory in this repository.
|
||||||
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`.
|
Examine the Vagrantfile there. Select a base box that supports your provider.
|
||||||
|
|
||||||
|
Metasploitable ub1404 uses the vagrant `chef-solo` provisioner. Configure the
|
||||||
|
chef_solo block in the Vagrantfile with the metasploitable chef recipes that you
|
||||||
|
desire -- you can browse them in the [chef/cookbooks/metasploitable](chef/cookbooks/metasploitable)
|
||||||
|
folder. Or, add or edit your own cookbook and/or recipes there.
|
||||||
|
|
||||||
|
From the [chef/dev/ub1404](chef/dev/ub1404) directory, you can run `vagrant up`
|
||||||
|
to get a development virtual ub1404 instance. After the initial `up` build and provision,
|
||||||
|
when you edit the chef runlist or when you edit a chef recipe, run
|
||||||
|
`vagrant rsync && vagrant provision` from the same directory. For faster
|
||||||
|
development, you can comment-out recipes that you do not need to rerun -- but
|
||||||
|
even if they are all enabled, vagrant re-provisioning should not take longer than
|
||||||
|
one or two minutes. Chef aims to be idempotent, so you can rerun this command often.
|
||||||
|
|
||||||
|
Consider taking a snapshot (e.g., `vagrant snapshot save fresh`) before modifying
|
||||||
|
recipes, so that you can always return to an initial state (`vagrant restore fresh`).
|
||||||
|
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`.
|
||||||
|
|
||||||
|
|
||||||
## Vulnerabilities
|
## Vulnerabilities
|
||||||
|
|
|
@ -1,19 +1,23 @@
|
||||||
# This Vagrantfile can be used to quickly spin up a development instance of ub1404
|
# This Vagrantfile can be used to quickly spin up a development instance of ub1404
|
||||||
|
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
config.vm.define "dev" do |dev|
|
|
||||||
dev.vm.box = "bento/ubuntu-14.04"
|
|
||||||
dev.vm.box_version = "201808.24.0"
|
|
||||||
dev.ssh.username = 'vagrant'
|
|
||||||
dev.ssh.password = 'vagrant'
|
|
||||||
dev.vm.network "forwarded_port", guest: 21, host:2121
|
|
||||||
|
|
||||||
dev.vm.provider "virtualbox" do |v|
|
config.vm.define "Metasploitable3-dev"
|
||||||
v.name = "Metasploitable3-ub1404-dev"
|
config.vm.box = "bento/ubuntu-14.04"
|
||||||
v.memory = 2048
|
config.vm.box_version = "201808.24.0"
|
||||||
end
|
|
||||||
|
config.vm.provider :libvirt do |libvirt, override|
|
||||||
|
override.vm.box = "peru/ubuntu-14.04-server-amd64"
|
||||||
|
override.vm.box_version = "20190901.01"
|
||||||
|
libvirt.memory = 2048
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config.ssh.username = 'vagrant'
|
||||||
|
config.ssh.password = 'vagrant'
|
||||||
|
config.vm.network "forwarded_port", guest: 21, host:2121
|
||||||
|
|
||||||
|
# manually rsync recipe changes before re-provisioning. e.g.,
|
||||||
|
# `vagrant rsync && vagrant provision`
|
||||||
config.vm.provision "chef_solo" do |chef|
|
config.vm.provision "chef_solo" do |chef|
|
||||||
chef.arguments = '--chef-license accept'
|
chef.arguments = '--chef-license accept'
|
||||||
chef.cookbooks_path = [ '../../cookbooks' ]
|
chef.cookbooks_path = [ '../../cookbooks' ]
|
||||||
|
@ -41,4 +45,7 @@ Vagrant.configure("2") do |config|
|
||||||
chef.add_recipe "metasploitable::flags"
|
chef.add_recipe "metasploitable::flags"
|
||||||
chef.add_recipe "metasploitable::clear_cache"
|
chef.add_recipe "metasploitable::clear_cache"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
# Disable NFS sharing (==> default: Mounting NFS shared folders...)
|
||||||
|
config.vm.synced_folder ".", "/vagrant", type: "nfs", disabled: true
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue