Add php 5.4.5 and phpmyadmin 3.5.8

This commit is contained in:
James Barnett 2017-03-21 13:50:39 -05:00
parent 8ae68cb895
commit 3566e9f009
No known key found for this signature in database
GPG Key ID: 647983861A4EC5EA
7 changed files with 141 additions and 2 deletions

2
Vagrantfile vendored
View File

@ -153,6 +153,8 @@ Vagrant.configure("2") do |config|
chef.add_recipe "metasploitable::mysql"
chef.add_recipe "metasploitable::apache_continuum"
chef.add_recipe "metasploitable::apache"
chef.add_recipe "metasploitable::php_545"
chef.add_recipe "metasploitable::phpmyadmin"
chef.add_recipe "metasploitable::users"
end
end

View File

@ -0,0 +1,17 @@
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".+\.phps$">
SetHandler application/x-httpd-php-source
Order Deny,Allow
Deny from all
</FilesMatch>
<FilesMatch "^\.ph(p[345]?|t|tml|ps)$">
Order Deny,Allow
Deny from all
</FilesMatch>
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_flag engine Off
</Directory>
</IfModule>

View File

@ -0,0 +1 @@
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

View File

@ -0,0 +1,30 @@
<?php
/*
* Generated configuration file
* Generated by: phpMyAdmin 3.5.8 setup script
* Date: Mon, 20 Mar 2017 17:50:57 +0000
*/
/* Servers configuration */
$i = 0;
/* Server: metasploitable [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'metasploitable';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
/* End of servers configuration */
$cfg['blowfish_secret'] = '58d0142a394148.57231469';
$cfg['DefaultLang'] = 'en';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>

View File

@ -42,5 +42,3 @@ end
service 'apache2' do
action [:enable, :start]
end

View File

@ -0,0 +1,66 @@
#
# Cookbook:: metasploitable
# Recipe:: php_545
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
# General steps pulled from here: http://askubuntu.com/questions/597462/how-to-install-php-5-2-x-on-ubuntu-14-04
execute "apt-get update" do
command "apt-get update"
end
execute "install prereqs" do
command "apt-get install -y gcc make build-essential \
libxml2-dev libcurl4-openssl-dev libpcre3-dev libbz2-dev libjpeg-dev \
libpng12-dev libfreetype6-dev libt1-dev libmcrypt-dev libmhash-dev \
freetds-dev libmysqlclient-dev unixodbc-dev \
libxslt1-dev php5-mysql apache2-dev"
end
execute "fix freetype bug" do
command "mkdir -pv /usr/include/freetype2/freetype && ln -sf /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h"
end
bash "download, extract, and patch php source" do
code <<-EOH
wget -c -t 3 -O /home/vagrant/php-5.4.5.tar.gz http://museum.php.net/php5/php-5.4.5.tar.gz
tar xvfz /home/vagrant/php-5.4.5.tar.gz -C /home/vagrant/
cd /home/vagrant/php-5.4.5
wget -c -t 3 -O ./libxml29_compat.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
patch -p0 -b < libxml29_compat.patch
EOH
end
bash "compile and install php" do
code <<-EOH
cd /home/vagrant/php-5.4.5
./configure --with-apxs2=/usr/bin/apxs --with-mysql
make
make install
EOH
end
cookbook_file 'etc/apache2/mods-available/php5.conf' do
source 'apache/php5.conf'
end
cookbook_file 'etc/apache2/mods-available/php5.load' do
source 'apache/php5.load'
end
bash "enable php modules" do
code <<-EOH
cd /etc/apache2/mods-enabled
a2enmod php5
a2dismod mpm_event
a2enmod mpm_prefork
EOH
end
# ln -s ../mods-available/php5.conf
# ln -s ../mods-available/php5.load
service 'apache2' do
action [:restart]
end

View File

@ -0,0 +1,25 @@
#
# Cookbook:: metasploitable
# Recipe:: phpmyadmin
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
include_recipe 'metasploitable::mysql'
include_recipe 'metasploitable::apache'
include_recipe 'metasploitable::php_545'
bash "download and extract phpmyadmin" do
code <<-EOH
wget -c -t 3 -O /tmp/phpMyAdmin-3.5.8-all-languages.tar.gz https://files.phpmyadmin.net/phpMyAdmin/3.5.8/phpMyAdmin-3.5.8-all-languages.tar.gz
tar xvfz /tmp/phpMyAdmin-3.5.8-all-languages.tar.gz -C /var/www/html
mv /var/www/html/phpMyAdmin-3.5.8-all-languages /var/www/html/phpmyadmin
EOH
end
cookbook_file 'var/www/html/phpmyadmin/config.inc.php' do
source 'phpmyadmin/config.inc.php'
end
service 'apache2' do
action [:restart]
end