Skip to content

Commit

Permalink
ssh-config: disallow adding keys to agent
Browse files Browse the repository at this point in the history
If a user has set AddKeysToAgent=yes in their ssh config then the
temporary SSH key that vagrant creates could get added to their agent
each time an SSHFS mount is performed for a different machine. Let's
disable that.

Fixes #88
  • Loading branch information
dustymabe committed Feb 12, 2018
1 parent 63e61bc commit a1215ea
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def self.sshfs_forward_mount_folder(machine, opts)
# Add in some ssh options that are common to both mount methods
opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives
opts[:ssh_opts]+= ' -o AddKeysToAgent=no' # don't add keys to Agent #88

# Do a normal mount only if the user provided host information
if opts.has_key?(:ssh_host) and opts[:ssh_host]
Expand Down
1 change: 1 addition & 0 deletions lib/vagrant-sshfs/cap/host/darwin/sshfs_reverse_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def self.sshfs_mount(machine, opts)
# Add in some ssh options that are common to both mount methods
opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives
opts[:ssh_opts]+= ' -o AddKeysToAgent=no' # don't add keys to Agent #88

# SSH connection options
# Note the backslash escapes for IdentityFile - handles spaces in key path
Expand Down
1 change: 1 addition & 0 deletions lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def self.sshfs_mount(machine, opts)
# Add in some ssh options that are common to both mount methods
opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives
opts[:ssh_opts]+= ' -o AddKeysToAgent=no' # don't add keys to Agent #88

# SSH connection options
ssh_opts = opts[:ssh_opts]
Expand Down

0 comments on commit a1215ea

Please sign in to comment.