Mark passwords as sensitive within guest capabilities
This commit is contained in:
parent
88d2b3676f
commit
2caf109a03
|
@ -20,6 +20,9 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
smb_password = Shellwords.shellescape(options[:smb_password])
|
smb_password = Shellwords.shellescape(options[:smb_password])
|
||||||
|
# Ensure password is scrubbed
|
||||||
|
Vagrant::Util::CredentialScrubber.sensitive(smb_password)
|
||||||
|
|
||||||
mount_options = options[:mount_options];
|
mount_options = options[:mount_options];
|
||||||
mount_command = "mount -t smbfs " +
|
mount_command = "mount -t smbfs " +
|
||||||
(mount_options ? "-o '#{mount_options.join(",")}' " : "") +
|
(mount_options ? "-o '#{mount_options.join(",")}' " : "") +
|
||||||
|
|
|
@ -22,6 +22,8 @@ module VagrantPlugins
|
||||||
# If a domain is provided in the username, separate it
|
# If a domain is provided in the username, separate it
|
||||||
username, domain = (options[:smb_username] || '').split('@', 2)
|
username, domain = (options[:smb_username] || '').split('@', 2)
|
||||||
smb_password = options[:smb_password]
|
smb_password = options[:smb_password]
|
||||||
|
# Ensure password is scrubbed
|
||||||
|
Vagrant::Util::CredentialScrubber.sensitive(smb_password)
|
||||||
|
|
||||||
options[:mount_options] ||= []
|
options[:mount_options] ||= []
|
||||||
if machine.env.host.capability?(:smb_mount_options)
|
if machine.env.host.capability?(:smb_mount_options)
|
||||||
|
@ -61,9 +63,8 @@ SCRIPT
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if status != 0 || no_such_device
|
if status != 0 || no_such_device
|
||||||
clean_command = mount_command.gsub(smb_password, "PASSWORDHIDDEN")
|
|
||||||
raise Vagrant::Errors::LinuxMountFailed,
|
raise Vagrant::Errors::LinuxMountFailed,
|
||||||
command: clean_command,
|
command: mount_command,
|
||||||
output: stderr
|
output: stderr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,10 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.mount_smb_shared_folder(machine, name, guestpath, options)
|
def self.mount_smb_shared_folder(machine, name, guestpath, options)
|
||||||
|
if !options[:smb_password].to_s.empty?
|
||||||
|
# Ensure password is scrubbed
|
||||||
|
Vagrant::Util::CredentialScrubber.sensitive(options[:smb_password])
|
||||||
|
end
|
||||||
machine.communicate.execute("cmdkey /add:#{options[:smb_host]} /user:#{options[:smb_username]} /pass:#{options[:smb_password]}", {shell: :powershell, elevated: true})
|
machine.communicate.execute("cmdkey /add:#{options[:smb_host]} /user:#{options[:smb_username]} /pass:#{options[:smb_password]}", {shell: :powershell, elevated: true})
|
||||||
mount_shared_folder(machine, name, guestpath, "\\\\#{options[:smb_host]}\\")
|
mount_shared_folder(machine, name, guestpath, "\\\\#{options[:smb_host]}\\")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue