metasploitable3/chef/cookbooks/metasploitable/recipes/apache.rb
Dave Eargle 72dc282aa0 ub1404 dev workflow
Tweaks to the recipes to avoid repetition of work, and ub1404 dev,
* let apt cookbook handle apt-update globally
* do not download, configure, make, make install if the package is
already installed
* add guards for file deletion to first check whether file is present
* use docker cookbook for image building and running, to only build if
not alrady built and only run if not already running
* drop mysql table and recreate each time

Also,
* bump Docker cookbook to 4.9.3
* bump mysql cookbook to 8.5.1
* add apt cookbook for better apt-update management
* bump depends versions and add apt
* modify readme with customization instructions
* modify all chef runlists to call apt first in the runlist
* add a vagrantfile for dev of ub1404
2019-10-29 13:36:27 -06:00

66 lines
1.1 KiB
Ruby

#
# Cookbook:: metasploitable
# Recipe:: apache
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
package 'apache2' do
action :install
end
directory '/var/www/cgi-bin' do
mode '0755'
recursive true
end
directory '/var/www/uploads' do
mode '0777'
recursive true
end
cookbook_file '/var/www/cgi-bin/hello_world.sh' do
source 'apache/hello_world.sh'
mode '0755'
end
cookbook_file '/etc/apache2/conf-available/cgi-bin.conf' do
source 'apache/cgi-bin.conf'
mode '0644'
end
cookbook_file '/etc/apache2/conf-available/dav.conf' do
source 'apache/dav.conf'
mode '0644'
end
bash "configure cgi" do
code <<-EOH
a2enmod cgi
a2enconf cgi-bin
a2disconf serve-cgi-bin
EOH
end
bash "configure webDAV" do
code <<-EOH
a2enmod dav
a2enmod dav_fs
a2enmod dav_lock
a2enmod auth_digest
a2enconf dav
EOH
end
execute 'make /var/www/html writeable' do
command 'chmod o+w /var/www/html'
end
file '/var/www/html/index.html' do
action :delete
only_if { File.exists?('/var/www/html/index.html') }
end
service 'apache2' do
action [:enable, :start]
end