mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-07-02 17:55:46 +02:00
Use upstart script
This commit is contained in:
parent
08e194483b
commit
9360d8376c
|
@ -1,6 +1,5 @@
|
|||
source 'https://rubygems.org'
|
||||
gem 'rack', '1.6.5'
|
||||
gem 'sinatra', '1.4.8'
|
||||
gem 'erubis'
|
||||
gem 'rack', '2.0.1'
|
||||
gem 'sinatra', '2.0.0rc2'
|
||||
gem 'erubis'
|
||||
gem 'activesupport'
|
||||
|
|
|
@ -28,4 +28,4 @@ And then finally:
|
|||
|
||||
$ ruby start.rb
|
||||
|
||||
The server should start on port 8080.
|
||||
The server should start on port 8181.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
require 'sinatra'
|
||||
require 'erubis'
|
||||
require 'active_support'
|
||||
require 'webrick'
|
||||
|
||||
MYSECRET = 'a7aebc287bba0ee4e64f947415a94e5f'
|
||||
|
||||
|
@ -10,6 +11,12 @@ set :environment, :development
|
|||
set :bind, '0.0.0.0'
|
||||
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,
|
||||
:key => "_metasploitable",
|
||||
: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
|
||||
start)
|
||||
/opt/sinatra/start.rb
|
||||
/opt/sinatra/start.sh
|
||||
;;
|
||||
*)
|
||||
echo "Usage: start {start}" >&2
|
||||
|
|
|
@ -9,43 +9,30 @@
|
|||
include_recipe 'metasploitable::sinatra'
|
||||
|
||||
apt_repository 'rvm' do
|
||||
uri 'ppa:rael-gc/rvm'
|
||||
uri 'ppa:brightbox/ruby-ng'
|
||||
end
|
||||
|
||||
package 'rvm'
|
||||
package 'ruby2.3'
|
||||
|
||||
bash 'run rvm.sh' do
|
||||
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
|
||||
package 'bundler'
|
||||
|
||||
directory '/opt/sinatra' do
|
||||
mode '0777'
|
||||
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
|
||||
source "sinatra/#{fname}"
|
||||
mode '0777'
|
||||
end
|
||||
end
|
||||
|
||||
bash 'bundle install sinatra' do
|
||||
code <<-EOH
|
||||
cd /opt/sinatra
|
||||
bundle install
|
||||
EOH
|
||||
end
|
||||
|
||||
cookbook_file '/etc/init.d/sinatra' do
|
||||
source 'sinatra/sinatra.sh'
|
||||
cookbook_file '/etc/init/sinatra.conf' do
|
||||
source 'sinatra/sinatra.conf'
|
||||
mode '0777'
|
||||
end
|
||||
|
||||
service 'sinatra' do
|
||||
supports restart: false, start: true, reload: false, status: false
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user