2017-07-13 01:15:48 +02:00
|
|
|
#
|
|
|
|
# Cookbook:: metasploitable
|
|
|
|
# Recipe:: proftpd
|
|
|
|
#
|
|
|
|
# Copyright:: 2017, Rapid7, All Rights Reserved.
|
|
|
|
|
|
|
|
# Install steps taken from https://github.com/rapid7/metasploit-framework/pull/5224
|
|
|
|
|
|
|
|
include_recipe 'metasploitable::apache'
|
|
|
|
|
2017-08-04 18:18:57 +02:00
|
|
|
proftpd_tar = 'proftpd-1.3.5.tar.gz'
|
|
|
|
|
|
|
|
remote_file "#{Chef::Config[:file_cache_path]}/#{proftpd_tar}" do
|
|
|
|
source "#{node[:proftpd][:download_url]}/#{proftpd_tar}"
|
2017-08-21 23:12:02 +02:00
|
|
|
mode '0644'
|
2017-08-04 18:18:57 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
execute "extract proftpd" do
|
|
|
|
cwd Chef::Config[:file_cache_path]
|
|
|
|
command 'tar zxfv proftpd-1.3.5.tar.gz'
|
|
|
|
|
|
|
|
not_if { ::File.exists?(File.join(Chef::Config[:file_cache_path], 'proftpd-1.3.5'))}
|
|
|
|
end
|
|
|
|
|
|
|
|
bash 'compile and install proftpd' do
|
|
|
|
cwd "#{Chef::Config[:file_cache_path]}/proftpd-1.3.5"
|
2017-07-13 01:15:48 +02:00
|
|
|
code <<-EOH
|
|
|
|
./configure --prefix=/opt/proftpd --with-modules=mod_copy
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
EOH
|
|
|
|
end
|
|
|
|
|
2017-09-08 22:04:00 +02:00
|
|
|
execute 'add hostname to /etc/hosts' do
|
|
|
|
command "echo #{node[:ipaddress]} #{node[:hostname]} >> /etc/hosts"
|
|
|
|
end
|
|
|
|
|
2017-07-13 01:15:48 +02:00
|
|
|
cookbook_file '/etc/init.d/proftpd' do
|
|
|
|
source 'proftpd/proftpd'
|
|
|
|
mode '760'
|
|
|
|
end
|
|
|
|
|
2018-10-20 09:51:32 +02:00
|
|
|
execute 'remove_carriage_returns' do
|
|
|
|
command "sed -i -e 's/\r//g' /etc/init.d/proftpd"
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2017-09-12 16:16:20 +02:00
|
|
|
# Setup the IP Renewer
|
|
|
|
cookbook_file '/opt/proftpd/proftpd_ip_renewer.rb' do
|
|
|
|
source 'proftpd/proftpd_ip_renewer.rb'
|
|
|
|
mode '744'
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
end
|
|
|
|
|
2018-10-20 09:51:32 +02:00
|
|
|
|
2017-09-12 16:16:20 +02:00
|
|
|
cookbook_file '/etc/init/proftpd_ip_renewer.conf' do
|
|
|
|
source 'proftpd/proftpd_ip_renewer.conf'
|
|
|
|
mode '0644'
|
|
|
|
end
|
|
|
|
|
|
|
|
cookbook_file '/opt/proftpd/hosts_renewer.rb' do
|
|
|
|
source 'proftpd/hosts_renewer.rb'
|
|
|
|
mode '744'
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
end
|
|
|
|
|
|
|
|
cookbook_file '/etc/init/hosts_renewer.conf' do
|
|
|
|
source 'proftpd/hosts_renewer.conf'
|
|
|
|
mode '0644'
|
|
|
|
end
|
|
|
|
|
2017-07-13 01:15:48 +02:00
|
|
|
service 'proftpd' do
|
|
|
|
action [:enable, :start]
|
|
|
|
end
|
2017-09-12 16:16:20 +02:00
|
|
|
|
|
|
|
service 'proftpd_ip_renewer' do
|
|
|
|
action [:enable, :start]
|
|
|
|
end
|
|
|
|
|
|
|
|
service 'hosts_renewer' do
|
|
|
|
action [:enable, :start]
|
|
|
|
end
|