mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-07-04 18:55:48 +02:00
Use upstart script
This commit is contained in:
parent
08e194483b
commit
9360d8376c
|
@ -1,6 +1,5 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
gem 'rack', '1.6.5'
|
gem 'rack', '2.0.1'
|
||||||
gem 'sinatra', '1.4.8'
|
gem 'sinatra', '2.0.0rc2'
|
||||||
gem 'erubis'
|
|
||||||
gem 'erubis'
|
gem 'erubis'
|
||||||
gem 'activesupport'
|
gem 'activesupport'
|
||||||
|
|
|
@ -28,4 +28,4 @@ And then finally:
|
||||||
|
|
||||||
$ ruby start.rb
|
$ ruby start.rb
|
||||||
|
|
||||||
The server should start on port 8080.
|
The server should start on port 8181.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
require 'sinatra'
|
require 'sinatra'
|
||||||
require 'erubis'
|
require 'erubis'
|
||||||
require 'active_support'
|
require 'active_support'
|
||||||
|
require 'webrick'
|
||||||
|
|
||||||
MYSECRET = 'a7aebc287bba0ee4e64f947415a94e5f'
|
MYSECRET = 'a7aebc287bba0ee4e64f947415a94e5f'
|
||||||
|
|
||||||
|
@ -10,6 +11,12 @@ set :environment, :development
|
||||||
set :bind, '0.0.0.0'
|
set :bind, '0.0.0.0'
|
||||||
set :port, 8181
|
set :port, 8181
|
||||||
|
|
||||||
|
# These settings are specific for Sinatra 2.0.0rc2
|
||||||
|
set :logging, false
|
||||||
|
set :quiet, true
|
||||||
|
dev_null = WEBrick::Log::new("/dev/null", 7)
|
||||||
|
set :server_settings, {:Logger => dev_null, :AccessLog => dev_null}
|
||||||
|
|
||||||
use Rack::Session::Cookie,
|
use Rack::Session::Cookie,
|
||||||
:key => "_metasploitable",
|
:key => "_metasploitable",
|
||||||
:path => "/",
|
:path => "/",
|
5
chef/cookbooks/metasploitable/files/sinatra/sinatra.conf
Normal file
5
chef/cookbooks/metasploitable/files/sinatra/sinatra.conf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
description 'Run vulnerable Sinatra'
|
||||||
|
author 'metasploitable3'
|
||||||
|
|
||||||
|
start on runlevel [2345]
|
||||||
|
exec "/opt/sinatra/start.sh"
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
/opt/sinatra/start.rb
|
/opt/sinatra/start.sh
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: start {start}" >&2
|
echo "Usage: start {start}" >&2
|
||||||
|
|
|
@ -9,43 +9,30 @@
|
||||||
include_recipe 'metasploitable::sinatra'
|
include_recipe 'metasploitable::sinatra'
|
||||||
|
|
||||||
apt_repository 'rvm' do
|
apt_repository 'rvm' do
|
||||||
uri 'ppa:rael-gc/rvm'
|
uri 'ppa:brightbox/ruby-ng'
|
||||||
end
|
end
|
||||||
|
|
||||||
package 'rvm'
|
package 'ruby2.3'
|
||||||
|
|
||||||
bash 'run rvm.sh' do
|
package 'bundler'
|
||||||
code <<-EOH
|
|
||||||
source /etc/profile.d/rvm.sh
|
|
||||||
rvmsudo rvm install ruby-2.3.1
|
|
||||||
rvm --default use 2.3.1
|
|
||||||
gem install bundler
|
|
||||||
EOH
|
|
||||||
end
|
|
||||||
|
|
||||||
directory '/opt/sinatra' do
|
directory '/opt/sinatra' do
|
||||||
mode '0777'
|
mode '0777'
|
||||||
end
|
end
|
||||||
|
|
||||||
['Gemfile', 'README.txt', 'check.rb', 'poc.rb', 'start.rb'].each do |fname|
|
['Gemfile', 'README.txt', 'check.rb', 'poc.rb', 'start.sh', 'server.rb'].each do |fname|
|
||||||
cookbook_file "/opt/sinatra/#{fname}" do
|
cookbook_file "/opt/sinatra/#{fname}" do
|
||||||
source "sinatra/#{fname}"
|
source "sinatra/#{fname}"
|
||||||
mode '0777'
|
mode '0777'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
bash 'bundle install sinatra' do
|
cookbook_file '/etc/init/sinatra.conf' do
|
||||||
code <<-EOH
|
source 'sinatra/sinatra.conf'
|
||||||
cd /opt/sinatra
|
|
||||||
bundle install
|
|
||||||
EOH
|
|
||||||
end
|
|
||||||
|
|
||||||
cookbook_file '/etc/init.d/sinatra' do
|
|
||||||
source 'sinatra/sinatra.sh'
|
|
||||||
mode '0777'
|
mode '0777'
|
||||||
end
|
end
|
||||||
|
|
||||||
service 'sinatra' do
|
service 'sinatra' do
|
||||||
|
supports restart: false, start: true, reload: false, status: false
|
||||||
action [:enable, :start]
|
action [:enable, :start]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user