metasploitable3/chef/cookbooks/metasploitable/recipes/users.rb

30 lines
575 B
Ruby
Raw Normal View History

#
# Cookbook:: metasploitable
# Recipe:: users
#
# Copyright:: 2017, Rapid7, All Rights Reserved.
uid = 1111
2017-06-22 00:15:42 +02:00
node[:users].each do |u, attributes|
user attributes[:username] do
2017-04-10 21:33:00 +02:00
manage_home true
2017-06-22 00:15:42 +02:00
password attributes[:password_hash]
uid uid
gid '100'
2017-06-22 00:15:42 +02:00
home "/home/#{attributes[:username]}"
shell '/bin/bash'
end
uid += 1
end
2017-08-16 00:28:53 +02:00
administrator_members = node[:users].keys.find_all { |user| node[:users][user][:admin] == true }
group 'sudo' do
action :modify
members administrator_members.map { |u| node[:users][u][:username] }
append true
end