Use host capability to update key file permissions if available
This commit is contained in:
parent
5325000fa6
commit
5ba91de4d8
|
@ -194,17 +194,9 @@ module VagrantPlugins
|
|||
f.write(priv)
|
||||
end
|
||||
|
||||
# Adjust private key file permissions
|
||||
if Vagrant::Util::Platform.windows?
|
||||
begin
|
||||
priv_path = @machine.data_dir.join("private_key").to_s
|
||||
File.set_permissions(priv_path, Etc.getlogin => File::FULL)
|
||||
rescue => e
|
||||
@logger.warn("Error encountered during private key permissions set - " \
|
||||
"#{e.class}: #{e.message}")
|
||||
end
|
||||
else
|
||||
@machine.data_dir.join("private_key").chmod(0600)
|
||||
# Adjust private key file permissions if host provides capability
|
||||
if @machine.env.host.has_capability?(:set_ssh_key_permissions)
|
||||
@machine.env.host.capability(:set_ssh_key_permissions, @machine.data_dir.join("private_key"))
|
||||
end
|
||||
|
||||
# Remove the old key if it exists
|
||||
|
|
Loading…
Reference in New Issue