2018-06-12 17:49:10 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module HostWindows
|
|
|
|
module Cap
|
|
|
|
class SSH
|
|
|
|
# Set the ownership and permissions for SSH
|
|
|
|
# private key
|
|
|
|
#
|
|
|
|
# @param [Vagrant::Environment] env
|
|
|
|
# @param [Pathname] key_path
|
|
|
|
def self.set_ssh_key_permissions(env, key_path)
|
|
|
|
script_path = Host.scripts_path.join("set_ssh_key_permissions.ps1")
|
|
|
|
result = Vagrant::Util::PowerShell.execute(
|
2018-06-12 23:20:49 +00:00
|
|
|
script_path.to_s, "-KeyPath", key_path.to_s,
|
2018-06-12 18:56:37 +00:00
|
|
|
module_path: Host.modules_path.to_s
|
2018-06-12 17:49:10 +00:00
|
|
|
)
|
|
|
|
if result.exit_code != 0
|
|
|
|
raise Vagrant::Errors::PowerShellError,
|
|
|
|
script: script_path,
|
|
|
|
stderr: result.stderr
|
|
|
|
end
|
2018-06-12 18:56:37 +00:00
|
|
|
result
|
2018-06-12 17:49:10 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|