Sliim / pentest-env

Pentest environment deployer (kali linux + targets) using vagrant and chef.
http://sliim.github.io/pentest-env/
GNU General Public License v3.0
632 stars 169 forks source link

Chef never successfully completed #6

Closed iffy closed 8 years ago

iffy commented 8 years ago

Here's what I did:

git clone git@github.com:Sliim/pentest-env.git
cd pentest-env/
vagrant up kali

And here's the abbreviated output of vagrant up kali:

Bringing machine 'kali' up with 'virtualbox' provider...
==> kali: Box 'kali-2016.1' could not be found. Attempting to find and install...
    kali: Box Provider: virtualbox
    kali: Box Version: >= 0
==> kali: Box file was not detected as metadata. Adding it directly...
==> kali: Adding box 'kali-2016.1' (v0) for provider: virtualbox
    kali: Downloading: http://box.hackbbs.org/kali-2016.1.box
==> kali: Successfully added box 'kali-2016.1' (v0) for 'virtualbox'!
==> kali: Importing base box 'kali-2016.1'...
==> kali: Matching MAC address for NAT networking...
==> kali: Setting the name of the VM: pentest-env_kali_1455735303577_33251
==> kali: The cookbook path '/Users/matt/sm/vm/slim/pentest-env/cookbooks' doesn't exist. Ignoring...
==> kali: The cookbook path '/Users/matt/sm/vm/slim/pentest-env/chef-repo/roles' doesn't exist. Ignoring...
==> kali: Clearing any previously set network interfaces...
==> kali: Preparing network interfaces based on configuration...
    kali: Adapter 1: nat
==> kali: Forwarding ports...
    kali: 22 => 2222 (adapter 1)
==> kali: Running 'pre-boot' VM customizations...
==> kali: Booting VM...
==> kali: Waiting for machine to boot. This may take a few minutes...
    kali: SSH address: 127.0.0.1:2222
    kali: SSH username: root
    kali: SSH auth method: private key
    kali: Warning: Connection timeout. Retrying...
==> kali: Machine booted and ready!
==> kali: Checking for guest additions in VM...
==> kali: Mounting shared folders...
    kali: /vagrant => /Users/matt/sm/vm/slim/pentest-env
==> kali: Running provisioner: shell...
    kali: Running: inline script
==> kali: mesg: 
==> kali: ttyname failed
==> kali: : 
==> kali: Inappropriate ioctl for device
==> kali: --2016-02-17 13:55:23--  https://opscode-omnibus-packages.s3.amazonaws.com/debian/6/x86_64/chef_12.2.1-1_amd64.deb
==> kali: Resolving opscode-omnibus-packages.s3.amazonaws.com (opscode-omnibus-packages.s3.amazonaws.com)... 
==> kali: 54.231.8.153
==> kali: Connecting to opscode-omnibus-packages.s3.amazonaws.com (opscode-omnibus-packages.s3.amazonaws.com)|54.231.8.153|:443... 
==> kali: connected.
==> kali: HTTP request sent, awaiting response... 
==> kali: 200 OK
==> kali: Length: 
==> kali: 38763294
==> kali:  (37M)
==> kali:  [application/x-debian-package]
==> kali: Saving to: ‘chef_12.2.1-1_amd64.deb’
==> kali: 
==> kali:      0K
==> kali:  
==> kali: .
...
==> kali: ..... 99% 3.72M 0s
==> kali:  37850K ....                                                  100% 9116G=12s
==> kali: 
==> kali: 2016-02-17 13:55:36 (3.02 MB/s) - ‘chef_12.2.1-1_amd64.deb’ saved [38763294/38763294]
==> kali: Selecting previously unselected package chef.
==> kali: (Reading database ... 309169 files and directories currently installed.)
==> kali: Preparing to unpack chef_12.2.1-1_amd64.deb ...
==> kali: Unpacking chef (12.2.1-1) ...
==> kali: Setting up chef (12.2.1-1) ...
==> kali: Thank you for installing Chef!
==> kali: Running provisioner: chef_solo...
Generating chef JSON and uploading...
==> kali: Running chef-solo...
==> kali: mesg: 
==> kali: ttyname failed
==> kali: : 
==> kali: Inappropriate ioctl for device
==> kali: [2016-02-17T13:55:50-05:00] INFO: Forking chef instance to converge...
==> kali: Starting Chef Client, version 12.2.1
==> kali: [2016-02-17T13:55:50-05:00] INFO: *** Chef 12.2.1 ***
==> kali: [2016-02-17T13:55:50-05:00] INFO: Chef-client pid: 1328
==> kali: [2016-02-17T13:55:52-05:00] INFO: Setting the run_list to ["recipe[apt]", "role[kali-base]"] from CLI options
==> kali: [2016-02-17T13:55:52-05:00] ERROR: Role kali-base (included by 'top level') is in the runlist but does not exist. Skipping expand.
==> kali: 
==> kali: ================================================================================
==> kali: Error expanding the run_list:
==> kali: ================================================================================
==> kali: 
==> kali: 
==> kali: Missing Role(s) in Run List:
==> kali: ----------------------------
==> kali: * kali-base included by 'top level'
==> kali: 
==> kali: 
==> kali: Original Run List
==> kali: -----------------
==> kali: * recipe[apt]
==> kali: 
==> kali: * role[kali-base]
==> kali: 
==> kali: 
==> kali: [2016-02-17T13:55:52-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> kali: Chef Client failed. 0 resources updated in 1.496812778 seconds
==> kali: [2016-02-17T13:55:52-05:00] ERROR: The expanded run list includes nonexistent roles: kali-base
==> kali: [2016-02-17T13:55:52-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
$ vagrant version
Installed Version: 1.7.4
Sliim commented 8 years ago

Hi,

Do you have checkout submodules? It looks you have the chef-repo/ directory but the kali-base role is missing.

What's the content of chef-repo/roles/?

You can try a submodule init/update:

git submodule init
git submodule update

If you don't want Chef provisioning you can remove the chef-repo/ directory.

iffy commented 8 years ago

I tried with the git submodule commands you listed and get this instead:

==> kali: [2016-02-18T10:50:40-05:00] INFO: Forking chef instance to converge...
==> kali: Starting Chef Client, version 12.2.1
==> kali: [2016-02-18T10:50:40-05:00] INFO: *** Chef 12.2.1 ***
==> kali: [2016-02-18T10:50:40-05:00] INFO: Chef-client pid: 1405
==> kali: [2016-02-18T10:50:41-05:00] INFO: Setting the run_list to ["recipe[apt]", "role[kali-base]"] from CLI options
==> kali: [2016-02-18T10:50:41-05:00] INFO: Run List is [recipe[apt], role[kali-base]]
==> kali: [2016-02-18T10:50:41-05:00] INFO: Run List expands to [apt, kali]
==> kali: [2016-02-18T10:50:41-05:00] INFO: Starting Chef Run for kali
==> kali: [2016-02-18T10:50:41-05:00] INFO: Running start handlers
==> kali: [2016-02-18T10:50:41-05:00] INFO: Start handlers complete.
==> kali: 
==> kali: Running handlers:
==> kali: [2016-02-18T10:50:41-05:00] ERROR: Running exception handlers
==> kali: Running handlers complete
==> kali: 
==> kali: [2016-02-18T10:50:41-05:00] ERROR: Exception handlers complete
==> kali: [2016-02-18T10:50:41-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> kali: Chef Client failed. 0 resources updated in 1.510444876 seconds
==> kali: [2016-02-18T10:50:41-05:00] ERROR: You must specify at least one cookbook repo path
==> kali: [2016-02-18T10:50:41-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

I'll try without chef-repo now.

Sliim commented 8 years ago

Ok, now it find the kali-base role. You need to download cookbooks dependencies, you can do it with the rake command (Note: you will need rake and berkshelf gems):

rake

This will download cookbooks deps in cookbooks/ directory which is used as the cookbook path for chef-solo.

You can also find install instructions here: https://github.com/Sliim/pentest-env/wiki/Installation

iffy commented 8 years ago

Oh, okay... the README deceived me :)

Sliim commented 8 years ago

Hmm ok, I will improve it! Thanks.