mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-07-04 18:55:48 +02:00
Land #136, custom readme rails app for Linux
This commit is contained in:
commit
6488953464
1
Vagrantfile
vendored
1
Vagrantfile
vendored
|
@ -169,6 +169,7 @@ Vagrant.configure("2") do |config|
|
|||
chef.add_recipe "metasploitable::docker"
|
||||
chef.add_recipe "metasploitable::samba"
|
||||
chef.add_recipe "metasploitable::unrealircd"
|
||||
chef.add_recipe "metasploitable::readme_app"
|
||||
chef.add_recipe "metasploitable::payroll_app"
|
||||
end
|
||||
end
|
||||
|
|
40
chef/cookbooks/metasploitable/files/readme_app/readme_app
Normal file
40
chef/cookbooks/metasploitable/files/readme_app/readme_app
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: readme_app
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# X-Interactive: false
|
||||
# Short-Description: Init script for readme_app
|
||||
# Description: Start/stop readme_app
|
||||
### END INIT INFO
|
||||
|
||||
DESC="readme_app"
|
||||
NAME=readme_app
|
||||
#DAEMON=
|
||||
|
||||
do_start()
|
||||
{
|
||||
echo "Starting readme_app.";
|
||||
cd /opt/readme_app
|
||||
rails s &
|
||||
}
|
||||
|
||||
do_stop()
|
||||
{
|
||||
echo "Stopping readme_app."
|
||||
killall ruby
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
do_start
|
||||
;;
|
||||
stop)
|
||||
do_stop
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,5 @@
|
|||
description 'Run ReadMe App'
|
||||
author 'metasploitable3'
|
||||
|
||||
start on runlevel [2345]
|
||||
exec "/opt/readme_app/start.sh"
|
5
chef/cookbooks/metasploitable/files/readme_app/start.sh
Normal file
5
chef/cookbooks/metasploitable/files/readme_app/start.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd /opt/readme_app
|
||||
bundle install
|
||||
rails s -b 0.0.0.0 -p 3500
|
38
chef/cookbooks/metasploitable/recipes/readme_app.rb
Normal file
38
chef/cookbooks/metasploitable/recipes/readme_app.rb
Normal file
|
@ -0,0 +1,38 @@
|
|||
#
|
||||
# Cookbook:: metasploitable
|
||||
# Recipe:: readme_app
|
||||
#
|
||||
# Copyright:: 2017, Rapid7, All Rights Reserved.
|
||||
#
|
||||
#
|
||||
|
||||
include_recipe 'metasploitable::ruby23'
|
||||
|
||||
package 'git'
|
||||
package 'nodejs'
|
||||
|
||||
directory '/opt/readme_app' do
|
||||
mode '0777'
|
||||
end
|
||||
|
||||
bash "clone the readme app and install gems" do
|
||||
code <<-EOH
|
||||
cd /opt/
|
||||
git clone https://github.com/jbarnett-r7/metasploitable3-readme.git readme_app
|
||||
EOH
|
||||
end
|
||||
|
||||
cookbook_file '/opt/readme_app/start.sh' do
|
||||
source 'readme_app/start.sh'
|
||||
mode '0777'
|
||||
end
|
||||
|
||||
cookbook_file '/etc/init/readme_app.conf' do
|
||||
source 'readme_app/readme_app.conf'
|
||||
mode '0777'
|
||||
end
|
||||
|
||||
service 'readme_app' do
|
||||
supports restart: false, start: true, reload: false, status: false
|
||||
action [:enable, :start]
|
||||
end
|
19
chef/cookbooks/metasploitable/recipes/ruby23.rb
Normal file
19
chef/cookbooks/metasploitable/recipes/ruby23.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
#
|
||||
# Cookbook:: metasploitable
|
||||
# Recipe:: ruby23
|
||||
#
|
||||
# Copyright:: 2017, Rapid7, All Rights Reserved.
|
||||
#
|
||||
#
|
||||
|
||||
apt_repository 'rvm' do
|
||||
uri 'ppa:brightbox/ruby-ng'
|
||||
end
|
||||
|
||||
execute 'apt-get update' do
|
||||
command 'apt-get update'
|
||||
end
|
||||
|
||||
package 'ruby2.3'
|
||||
package 'ruby2.3-dev'
|
||||
package 'bundler'
|
|
@ -7,14 +7,7 @@
|
|||
#
|
||||
|
||||
include_recipe 'metasploitable::sinatra'
|
||||
|
||||
apt_repository 'rvm' do
|
||||
uri 'ppa:brightbox/ruby-ng'
|
||||
end
|
||||
|
||||
package 'ruby2.3'
|
||||
|
||||
package 'bundler'
|
||||
include_recipe 'metasploitable::ruby23'
|
||||
|
||||
directory '/opt/sinatra' do
|
||||
mode '0777'
|
||||
|
|
Loading…
Reference in New Issue
Block a user