/usr/lib/ruby/vendor_ruby/chef_zero/endpoints/organization_validator_key_endpoint.rb is in chef-zero 4.5.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | require 'ffi_yajl'
require 'chef_zero/rest_base'
require 'uuidtools'
module ChefZero
module Endpoints
# /organizations/NAME/_validator_key
class OrganizationValidatorKeyEndpoint < RestBase
def post(request)
org_name = request.rest_path[-2]
validator_path = [ 'organizations', org_name, 'clients', "#{org_name}-validator"]
validator = FFI_Yajl::Parser.parse(get_data(request, validator_path), :create_additions => false)
private_key, public_key = server.gen_key_pair
validator['public_key'] = public_key
set_data(request, validator_path, FFI_Yajl::Encoder.encode(validator, :pretty => true))
json_response(200, { 'private_key' => private_key })
end
end
end
end
|