mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-09-21 00:01:14 +02:00
Convert users to use attributes file.
This commit is contained in:
parent
541e39430b
commit
dfcdafe410
2
Vagrantfile
vendored
2
Vagrantfile
vendored
|
@ -145,7 +145,7 @@ Vagrant.configure("2") do |config|
|
||||||
|
|
||||||
trusty.vm.provider "virtualbox" do |v|
|
trusty.vm.provider "virtualbox" do |v|
|
||||||
v.name = "MetasploitableUB"
|
v.name = "MetasploitableUB"
|
||||||
v.memory = 1024
|
v.memory = 2048
|
||||||
end
|
end
|
||||||
|
|
||||||
config.omnibus.chef_version = :latest
|
config.omnibus.chef_version = :latest
|
||||||
|
|
|
@ -3,13 +3,17 @@
|
||||||
# Recipe:: payroll_app
|
# Recipe:: payroll_app
|
||||||
# Copyright:: 2017, Rapid7, All Rights Reserved.
|
# Copyright:: 2017, Rapid7, All Rights Reserved.
|
||||||
|
|
||||||
|
include_recipe 'metasploitable::mysql'
|
||||||
|
include_recipe 'metasploitable::apache'
|
||||||
|
include_recipe 'metasploitable::php_545'
|
||||||
|
|
||||||
cookbook_file '/var/www/html/payroll_app.php' do
|
cookbook_file '/var/www/html/payroll_app.php' do
|
||||||
source 'payroll_app/payroll_app.php'
|
source 'payroll_app/payroll_app.php'
|
||||||
mode '0755'
|
mode '0755'
|
||||||
end
|
end
|
||||||
|
|
||||||
cookbook_file '/tmp/payroll.sql' do
|
template '/tmp/payroll.sql' do
|
||||||
source 'payroll_app/payroll.sql'
|
source 'payroll_app/payroll.sql.erb'
|
||||||
mode '0755'
|
mode '0755'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,31 +6,15 @@
|
||||||
|
|
||||||
# See scripts/configs/create_users.bat for passwords
|
# See scripts/configs/create_users.bat for passwords
|
||||||
|
|
||||||
users = {'leah_organa' => { password: '$1$2ny4/xaH$tAFV5fbEqHx2OkOPIQhpx0' },
|
|
||||||
'luke_skywalker' => { password: '$1$n8tgrGRs$8xaS40CFS1J5iIAEmbnx50' },
|
|
||||||
'han_solo' => { password: '$1$L/2/AWAh$ZMUulbFhP2IesZ6xwBmaV0' },
|
|
||||||
'artoo_detoo' => { password: '$1$DlEuqBUm$u71bKO9I603kDCqEphmon1' },
|
|
||||||
'c_three_pio' => { password: '$1$4JMoAFqs$b5MwsiCfOASdUKktx6wQ7/' },
|
|
||||||
'ben_kenobi' => { password: '$1$vmHrrI9b$OyLulJjgi18GxgREG5V5c1' },
|
|
||||||
'darth_vader' => { password: '$1$c7AfQJ86$zvcdz7pPate7GdCQ.yfTf0' },
|
|
||||||
'anakin_skywalker' => { password: '$1$AvIldIHu$o1s2OCU4n/qSCGQMKMgkH/' },
|
|
||||||
'jarjar_binks' => { password: '$1$SNokFi0c$F.SvjZQjYRSuoBuobRWMh1' },
|
|
||||||
'lando_calrissian' => { password: '$1$8aWC7zHq$bz6K2rZVD7XlMNqBIIMGX.' },
|
|
||||||
'boba_fett' => { password: '$1$TjxlmV4j$k/rG1vb4.pj.z0yFWJ.ZD0' },
|
|
||||||
'jabba_hutt' => { password: '$1$1q5jRHYC$LIp/8O/g9qg3NaeGOxGSl/' },
|
|
||||||
'greedo' => { password: '$1$1lmZ0rOJ$GITT5.sX0tvOQeC2/wWQF1' },
|
|
||||||
'chewbacca' => { password: '$1$AjU5ZLh9$WjO.j9fYh3yms3HSDBKya1' },
|
|
||||||
'kylo_ren' => { password: '$1$Zcw3AKDA$1Mjgzmr/HpmFXuxUjj2Vv1' }
|
|
||||||
}
|
|
||||||
uid = 1111
|
uid = 1111
|
||||||
|
|
||||||
users.each do |username, opts|
|
node[:users].each do |u, attributes|
|
||||||
user username do
|
user attributes[:username] do
|
||||||
manage_home true
|
manage_home true
|
||||||
password opts[:password]
|
password attributes[:password_hash]
|
||||||
uid uid
|
uid uid
|
||||||
gid '100'
|
gid '100'
|
||||||
home "/home/#{username}"
|
home "/home/#{attributes[:username]}"
|
||||||
shell '/bin/bash'
|
shell '/bin/bash'
|
||||||
end
|
end
|
||||||
uid += 1
|
uid += 1
|
||||||
|
|
|
@ -39,21 +39,12 @@ CREATE TABLE IF NOT EXISTS `users` (
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO `users` (`username`, `first_name`, `last_name`, `password`, `salary`) VALUES
|
INSERT INTO `users` (`username`, `first_name`, `last_name`, `password`, `salary`) VALUES
|
||||||
('luke_skywalker', 'Luke', 'Skywalker', 'password', 102000),
|
<%= values = ""
|
||||||
('leia_organa', 'Leia', 'Organa', 'obiwan', 95600),
|
node[:users].keys.each do |u|
|
||||||
('han_solo', 'Han', 'Solo', 'sh00t-first', 12000),
|
values << "('#{node[:users][u][:username]}', '#{node[:users][u][:first_name]}', '#{node[:users][u][:last_name]}', '#{node[:users][u][:password]}', '#{node[:users][u][:salary]}'),"
|
||||||
('artoo_detoo', 'Artoo', 'Detoo', 'beep_b00p', 22000),
|
end
|
||||||
('c_three_pio', 'C', 'Threepio', 'pr0t0c0l', 32000),
|
values[0...-1]
|
||||||
('ben_kenobi', 'Ben', 'Kenobi', 'thats_no_moon', 1000000),
|
%>;
|
||||||
('darth_vader', 'Darth', 'Vader', 'd@rk_sid3', 666000),
|
|
||||||
('anakin_skywalker', 'Anakin', 'Skywalker', 'yipp33!!', 0),
|
|
||||||
('jarjar_binks', 'Jar-Jar', 'Binks', 'mesah_p@ssw0rd', 2000),
|
|
||||||
('lando_calrissian', 'Lando', 'Calrissian', 'b@ckstab', 4000000),
|
|
||||||
('boba_fett', 'Boba', 'Fett', 'mandalorian1', 2000000),
|
|
||||||
('jabba_hutt', 'Jabba', 'The Hutt', 'not-a-slug12', 10000000),
|
|
||||||
('greedo', 'Greedo', 'Rodian', 'hanShotFirst!', 500000),
|
|
||||||
('chewbacca', 'Chewbacca', '', 'rwaaaaawr5', 4500),
|
|
||||||
('kylo_ren', 'Kylo', 'Ren', 'daddy_issues1', 66600);
|
|
||||||
|
|
||||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
Loading…
Reference in New Issue
Block a user