vagrant-sshfs 1.3.4 → 1.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68c00a268dd8b861a0dccc09d8038bade7d6fdda953fa4790fb057ad304c8f5b
4
- data.tar.gz: f2e5f1162a74cb9bf5034d243167cca7f69f7e5ecf4bff5d74235c134f232674
3
+ metadata.gz: 72b97abe094123820d790b417d595675003b24a8a0ba4adbfc943aa8663076f7
4
+ data.tar.gz: 63fd927bcd56ce74257edff5588d8025057a2746f859c81f1e4c8a311fd635da
5
5
  SHA512:
6
- metadata.gz: 4afe022b17eff7aa2c4bed784dd05e8e9e4701bd6327b9792ff20c4ea551185037dc75a69100dfde7a06f47db9d06c404efeb532161427236d927eaca6257981
7
- data.tar.gz: b9828d27f40ca3318c2877e2a6381f01a7d7594a54f96affbb73b2913843bcf4134f059cc458aaa16b600f395907c900f3767f6ebfaa4d3fa810f6606cbe4ef7
6
+ metadata.gz: 3e810e679a39964500567be12233816f504301b7e0aa4f222b6ac2c1dfbbc2e5b314fc1b40015a70532eae759d978f5820992b448e944be51467ccb328671282
7
+ data.tar.gz: 7c0451482703f81bb0a8a740a4a094b51b7d7529d73e302bdf7312e44e1d84e2cf6c002b40858696a84c67b12c4e01f6a935e0e0c482c035d9ee226751e99c2f
data/Gemfile CHANGED
@@ -6,11 +6,11 @@ group :development do
6
6
  # We depend on Vagrant for development, but we don't add it as a
7
7
  # gem dependency because we expect to be installed within the
8
8
  # Vagrant environment itself using `vagrant plugin`.
9
- gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :ref => 'v2.2.7'
9
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :ref => 'v2.2.19'
10
10
  end
11
11
 
12
12
  group :plugins do
13
13
  # Add vagrant-libvirt plugin here, otherwise you won't be able to
14
14
  # use libvirt as a provider when you execute `bundle exec vagrant up`
15
- gem "vagrant-libvirt" , '0.0.45'
15
+ gem "vagrant-libvirt" , '0.7.0'
16
16
  end
data/build.sh CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash -x
2
2
  set -ex
3
3
 
4
- ctr=$(buildah from registry.fedoraproject.org/fedora:31)
4
+ ctr=$(buildah from registry.fedoraproject.org/fedora:35)
5
5
 
6
6
  rpms=(
7
7
  make gcc ruby ruby-devel redhat-rpm-config # for building gems
@@ -0,0 +1,39 @@
1
+ module VagrantPlugins
2
+ module GuestAlma
3
+ module Cap
4
+ class SSHFSClient
5
+ def self.sshfs_install(machine)
6
+
7
+ case machine.guest.capability("flavor")
8
+ when :alma_8
9
+ # No need to install epel. fuse-sshfs comes from the powertools repo
10
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1758884
11
+ # https://github.com/dustymabe/vagrant-sshfs/issues/123
12
+ machine.communicate.sudo("yum -y install --enablerepo=powertools fuse-sshfs")
13
+ when :alma_9, :alma # alma9 or unknown
14
+ # Install fuse-sshfs from epel
15
+ if !epel_installed(machine)
16
+ epel_install(machine)
17
+ end
18
+ machine.communicate.sudo("yum -y install fuse-sshfs")
19
+ end
20
+ end
21
+
22
+ def self.sshfs_installed(machine)
23
+ machine.communicate.test("rpm -q fuse-sshfs")
24
+ end
25
+
26
+ protected
27
+
28
+ def self.epel_installed(machine)
29
+ machine.communicate.test("rpm -q epel-release")
30
+ end
31
+
32
+ def self.epel_install(machine)
33
+ machine.communicate.sudo("yum -y install epel-release")
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,52 @@
1
+ module VagrantPlugins
2
+ module GuestCentOS
3
+ module Cap
4
+ class SSHFSClient
5
+ def self.sshfs_install(machine)
6
+
7
+ # Until a newer version of Vagrant ships with https://github.com/hashicorp/vagrant/pull/12785
8
+ # we need to handle the case where Alma or Rocky end up here
9
+ if machine.communicate.test("grep 'VERSION_ID=\"8' /etc/os-release")
10
+ machine.communicate.sudo("yum -y install --enablerepo=powertools fuse-sshfs")
11
+ return
12
+ elsif machine.communicate.test("grep 'VERSION_ID=\"9' /etc/os-release")
13
+ if !epel_installed(machine)
14
+ epel_install(machine)
15
+ end
16
+ machine.communicate.sudo("yum -y install fuse-sshfs")
17
+ return
18
+ end
19
+
20
+ case machine.guest.capability("flavor")
21
+ when :centos_8
22
+ # No need to install epel. fuse-sshfs comes from the powertools repo
23
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1758884
24
+ # https://github.com/dustymabe/vagrant-sshfs/issues/123
25
+ machine.communicate.sudo("yum -y install --enablerepo=powertools fuse-sshfs")
26
+ when :centos_9, :centos_7, :centos # centos{9,7,6}
27
+ # Install fuse-sshfs from epel
28
+ if !epel_installed(machine)
29
+ epel_install(machine)
30
+ end
31
+ machine.communicate.sudo("yum -y install fuse-sshfs")
32
+ end
33
+ end
34
+
35
+ def self.sshfs_installed(machine)
36
+ machine.communicate.test("rpm -q fuse-sshfs")
37
+ end
38
+
39
+ protected
40
+
41
+ def self.epel_installed(machine)
42
+ machine.communicate.test("rpm -q epel-release")
43
+ end
44
+
45
+ def self.epel_install(machine)
46
+ machine.communicate.sudo("yum -y install epel-release")
47
+ end
48
+
49
+ end
50
+ end
51
+ end
52
+ end
@@ -4,14 +4,22 @@ module VagrantPlugins
4
4
  class SSHFSClient
5
5
  def self.sshfs_install(machine)
6
6
  machine.communicate.sudo("pkg install -y fusefs-sshfs")
7
- machine.communicate.sudo("kldload fuse")
7
+ # older FreeBSD used fuse, newer uses fusefs
8
+ # https://github.com/dustymabe/vagrant-sshfs/issues/124
9
+ machine.communicate.sudo("kldload fuse || kldload fusefs")
8
10
  end
9
11
 
10
12
  def self.sshfs_installed(machine)
11
13
  installed = machine.communicate.test("pkg info fusefs-sshfs")
12
14
  if installed
13
- # fuse may not get loaded at boot, so check if it's loaded otherwise force load it
14
- machine.communicate.sudo("kldstat -m fuse || kldload fuse")
15
+ # fuse may not get loaded at boot, so check if it's loaded
16
+ # If not loaded then force load it
17
+ loaded = machine.communicate.test("kldstat -m fuse || kldstat -m fusefs")
18
+ if not loaded
19
+ # older FreeBSD used fuse, newer uses fusefs
20
+ # https://github.com/dustymabe/vagrant-sshfs/issues/124
21
+ machine.communicate.sudo("kldload fuse || kldload fusefs")
22
+ end
15
23
  end
16
24
 
17
25
  installed
@@ -2,6 +2,7 @@ require "log4r"
2
2
  require "vagrant/util/retryable"
3
3
  require "vagrant/util/platform"
4
4
  require "tempfile"
5
+ require Vagrant.source_root.join("plugins/synced_folders/unix_mount_helpers")
5
6
 
6
7
  # This is already done for us in lib/vagrant-sshfs.rb. We needed to
7
8
  # do it there before Process.uid is called the first time by Vagrant
@@ -15,6 +16,7 @@ module VagrantPlugins
15
16
  module Cap
16
17
  class MountSSHFS
17
18
  extend Vagrant::Util::Retryable
19
+ extend VagrantPlugins::SyncedFolder::UnixMountHelpers
18
20
  @@logger = Log4r::Logger.new("vagrant::synced_folders::sshfs_mount")
19
21
 
20
22
  def self.list_mounts_command
@@ -80,7 +82,25 @@ module VagrantPlugins
80
82
  hostpath = File.expand_path(opts[:hostpath], machine.env.root_path)
81
83
  hostpath = Vagrant::Util::Platform.fs_real_path(hostpath).to_s
82
84
  end
83
-
85
+
86
+ # Support for user provided mount_options, owner, group
87
+ # https://github.com/hashicorp/vagrant/blob/2c3397c46851ef29a3589bf3214a3eee12da8484/website/content/docs/synced-folders/basic_usage.mdx#options
88
+ mount_options = opts.fetch(:mount_options, [])
89
+ # Determine owner/group info to use
90
+ if (opts.has_key?(:owner) and opts[:owner]) or
91
+ (opts.has_key?(:group) and opts[:group])
92
+ detected_ids = detect_owner_group_ids(
93
+ machine, expanded_guest_path, mount_options, opts)
94
+ mount_uid = detected_ids[:uid]
95
+ mount_gid = detected_ids[:gid]
96
+ mount_options.append("uid=#{mount_uid}")
97
+ mount_options.append("gid=#{mount_gid}")
98
+ end
99
+ # Combine mount_options into sshfs_opts_append (also user provided)
100
+ if not mount_options.empty?()
101
+ opts[:sshfs_opts_append] =
102
+ opts[:sshfs_opts_append].to_s + ' -o ' + mount_options.join(',') + ' '
103
+ end
84
104
 
85
105
  # Add in some sshfs/fuse options that are common to both mount methods
86
106
  opts[:sshfs_opts] = ' -o allow_other ' # allow non-root users to access
@@ -288,8 +308,8 @@ module VagrantPlugins
288
308
  :thread_inherit => true,
289
309
  :startup_info => {:stdin => w1, :stdout => r2, :stderr => f2})
290
310
  else
291
- p1 = spawn(sftp_server_cmd, :out => w2, :in => r1, :err => f1, :pgroup => true)
292
- p2 = spawn(ssh_cmd, :out => w1, :in => r2, :err => f2, :pgroup => true)
311
+ p1 = spawn(sftp_server_cmd, :out => w2, :in => r1, :err => f1, :pgroup => true, :close_others => true)
312
+ p2 = spawn(ssh_cmd, :out => w1, :in => r2, :err => f2, :pgroup => true, :close_others => true)
293
313
 
294
314
  # Detach from the processes so they will keep running
295
315
  Process.detach(p1)
@@ -4,20 +4,17 @@ module VagrantPlugins
4
4
  class SSHFSClient
5
5
  def self.sshfs_install(machine)
6
6
 
7
- rhel_version = machine.guest.capability("flavor")
8
-
9
- # Handle the case where Vagrant doesn't yet know how to
10
- # detect and return :rhel_8 https://github.com/hashicorp/vagrant/pull/11453
11
- if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new('2.2.8')
12
- rhel_version = vagrant_lt_228_flavor_compat(machine)
13
- end
14
-
15
- case rhel_version
7
+ case machine.guest.capability("flavor")
16
8
  when :rhel_8
17
- # No need to install epel. fuse-sshfs comes from the PowerTools repo
18
- # https://bugzilla.redhat.com/show_bug.cgi?id=1758884
19
- machine.communicate.sudo("yum -y install --enablerepo=PowerTools fuse-sshfs")
20
- when :rhel_7, :rhel # rhel7 and rhel6
9
+ # fuse-sshfs isn't in EPEL8 and how to get it from RHEL repos
10
+ # without having to have the system subscribed is unclear:
11
+ # https://github.com/dustymabe/vagrant-sshfs/issues/108#issuecomment-601061947
12
+ # Using fuse-sshfs from EPEL7 works for now so let's just go with it.
13
+ # Do the install in such a way that the epel7 repo doesn't hang around
14
+ # on the system, which may have unintended consequences on RHEL8.
15
+ machine.communicate.sudo("rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7")
16
+ machine.communicate.sudo("yum -y install fuse-sshfs --repofrompath=epel7,'http://download.fedoraproject.org/pub/epel/7/$basearch'")
17
+ when :rhel_9, :rhel_7, :rhel # rhel{9,7,6}
21
18
  # Install fuse-sshfs from epel
22
19
  if !epel_installed(machine)
23
20
  epel_install(machine)
@@ -37,23 +34,19 @@ module VagrantPlugins
37
34
  end
38
35
 
39
36
  def self.epel_install(machine)
40
- machine.communicate.sudo("yum -y install epel-release")
41
- end
42
-
43
- def self.vagrant_lt_228_flavor_compat(machine)
44
- # This is a compatibility function to handle RHEL8 for
45
- # vagrant versions that didn't include:
46
- # https://github.com/hashicorp/vagrant/pull/11453
47
- output = ""
48
- machine.communicate.sudo("cat /etc/redhat-release") do |_, data|
49
- output = data
50
- end
51
- if output =~ /(CentOS|Red Hat Enterprise|Scientific|Cloud|Virtuozzo)\s*Linux( .+)? release 8/i
52
- return :rhel_8
53
- elsif output =~ /(CentOS|Red Hat Enterprise|Scientific|Cloud|Virtuozzo)\s*Linux( .+)? release 7/i
54
- return :rhel_7
55
- else
56
- return :rhel
37
+ case machine.guest.capability("flavor")
38
+ when :rhel_9
39
+ machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm")
40
+ when :rhel_7
41
+ machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm")
42
+ when :rhel # rhel6
43
+ # Until a newer version of Vagrant ships with https://github.com/hashicorp/vagrant/pull/12785
44
+ # we need to handle the case where Alma 9 and RHEL 9 end up here.
45
+ if machine.communicate.test("grep 'VERSION_ID=\"9' /etc/os-release")
46
+ machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm")
47
+ else
48
+ machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm")
49
+ end
57
50
  end
58
51
  end
59
52
  end
@@ -0,0 +1,39 @@
1
+ module VagrantPlugins
2
+ module GuestRocky
3
+ module Cap
4
+ class SSHFSClient
5
+ def self.sshfs_install(machine)
6
+
7
+ case machine.guest.capability("flavor")
8
+ when :rocky_8
9
+ # No need to install epel. fuse-sshfs comes from the powertools repo
10
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1758884
11
+ # https://github.com/dustymabe/vagrant-sshfs/issues/123
12
+ machine.communicate.sudo("yum -y install --enablerepo=powertools fuse-sshfs")
13
+ when :rocky_9, :rocky # rocky9 or unknown
14
+ # Install fuse-sshfs from epel
15
+ if !epel_installed(machine)
16
+ epel_install(machine)
17
+ end
18
+ machine.communicate.sudo("yum -y install fuse-sshfs")
19
+ end
20
+ end
21
+
22
+ def self.sshfs_installed(machine)
23
+ machine.communicate.test("rpm -q fuse-sshfs")
24
+ end
25
+
26
+ protected
27
+
28
+ def self.epel_installed(machine)
29
+ machine.communicate.test("rpm -q epel-release")
30
+ end
31
+
32
+ def self.epel_install(machine)
33
+ machine.communicate.sudo("yum -y install epel-release")
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,3 +1,4 @@
1
+ require "etc"
1
2
  require "log4r"
2
3
  require "vagrant/util/retryable"
3
4
  require "tempfile"
@@ -56,6 +57,12 @@ module VagrantPlugins
56
57
  expanded_guest_path = machine.guest.capability(
57
58
  :shell_expand_guest_path, opts[:guestpath])
58
59
 
60
+ # Create the mountpoint inside the guest
61
+ machine.communicate.tap do |comm|
62
+ comm.sudo("mkdir -p #{expanded_guest_path}")
63
+ comm.sudo("chmod 777 #{expanded_guest_path}")
64
+ end
65
+
59
66
  # Mount path information
60
67
  hostpath = opts[:hostpath].dup
61
68
  hostpath.gsub!("'", "'\\\\''")
@@ -68,10 +75,8 @@ module VagrantPlugins
68
75
  opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives
69
76
 
70
77
  # SSH connection options
71
- # Note the backslash escapes for IdentityFile - handles spaces in key path
72
78
  ssh_opts = opts[:ssh_opts]
73
79
  ssh_opts+= ' -o Port=' + machine.ssh_info[:port].to_s
74
- ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""'
75
80
  ssh_opts+= ' -o UserKnownHostsFile=/dev/null '
76
81
  ssh_opts+= ' -F /dev/null ' # Don't pick up options from user's config
77
82
  if machine.ssh_info.key?(:private_key_path) and
@@ -84,9 +89,35 @@ module VagrantPlugins
84
89
 
85
90
  ssh_opts_append = opts[:ssh_opts_append].to_s # provided by user
86
91
 
92
+ # Support for user provided mount_options, owner, group
93
+ # https://github.com/hashicorp/vagrant/blob/2c3397c46851ef29a3589bf3214a3eee12da8484/website/content/docs/synced-folders/basic_usage.mdx#options
94
+ mount_options = opts.fetch(:mount_options, [])
95
+ if (opts.has_key?(:owner) and opts[:owner]) or
96
+ (opts.has_key?(:group) and opts[:group])
97
+ # Identify the uid
98
+ if opts.has_key?(:owner) and opts[:owner]
99
+ mount_uid = Etc::getpwnam(opts[:owner]).uid
100
+ else
101
+ mount_uid = Etc::getpwnam(Etc.getlogin).uid
102
+ end
103
+ # Identify the gid. If a group was provided use that otherwise use
104
+ # the group detected with the detected user id.
105
+ if opts.has_key?(:group) and opts[:group]
106
+ mount_gid = Etc::getgrnam(opts[:group]).gid
107
+ else
108
+ mount_gid = Etc::getpwnam(Etc.getlogin).gid
109
+ end
110
+ # Add them to the mount options
111
+ mount_options.append("uid=#{mount_uid}")
112
+ mount_options.append("gid=#{mount_gid}")
113
+ end
114
+
87
115
  # SSHFS executable options
88
116
  sshfs_opts = opts[:sshfs_opts]
89
117
  sshfs_opts_append = opts[:sshfs_opts_append].to_s # provided by user
118
+ if not mount_options.empty?()
119
+ sshfs_opts_append+= ' -o ' + mount_options.join(',') + ' '
120
+ end
90
121
 
91
122
  username = machine.ssh_info[:username]
92
123
  host = machine.ssh_info[:host]
@@ -120,7 +151,7 @@ module VagrantPlugins
120
151
  :thread_inherit => true,
121
152
  :startup_info => {:stdin => w2, :stdout => r1, :stderr => f1})
122
153
  else
123
- p1 = spawn(sshfs_cmd, :out => f1, :err => f1, :pgroup => true)
154
+ p1 = spawn(sshfs_cmd, :out => f1, :err => f1, :pgroup => true, :close_others => true)
124
155
  Process.detach(p1) # Detach so process will keep running
125
156
  end
126
157
 
@@ -1,3 +1,4 @@
1
+ require "etc"
1
2
  require "log4r"
2
3
  require "vagrant/util/retryable"
3
4
  require "tempfile"
@@ -55,6 +56,12 @@ module VagrantPlugins
55
56
  expanded_guest_path = machine.guest.capability(
56
57
  :shell_expand_guest_path, opts[:guestpath])
57
58
 
59
+ # Create the mountpoint inside the guest
60
+ machine.communicate.tap do |comm|
61
+ comm.sudo("mkdir -p #{expanded_guest_path}")
62
+ comm.sudo("chmod 777 #{expanded_guest_path}")
63
+ end
64
+
58
65
  # Mount path information
59
66
  hostpath = opts[:hostpath].dup
60
67
  hostpath.gsub!("'", "'\\\\''")
@@ -81,9 +88,35 @@ module VagrantPlugins
81
88
 
82
89
  ssh_opts_append = opts[:ssh_opts_append].to_s # provided by user
83
90
 
91
+ # Support for user provided mount_options, owner, group
92
+ # https://github.com/hashicorp/vagrant/blob/2c3397c46851ef29a3589bf3214a3eee12da8484/website/content/docs/synced-folders/basic_usage.mdx#options
93
+ mount_options = opts.fetch(:mount_options, [])
94
+ if (opts.has_key?(:owner) and opts[:owner]) or
95
+ (opts.has_key?(:group) and opts[:group])
96
+ # Identify the uid
97
+ if opts.has_key?(:owner) and opts[:owner]
98
+ mount_uid = Etc::getpwnam(opts[:owner]).uid
99
+ else
100
+ mount_uid = Etc::getpwnam(Etc.getlogin).uid
101
+ end
102
+ # Identify the gid. If a group was provided use that otherwise use
103
+ # the group detected with the detected user id.
104
+ if opts.has_key?(:group) and opts[:group]
105
+ mount_gid = Etc::getgrnam(opts[:group]).gid
106
+ else
107
+ mount_gid = Etc::getpwnam(Etc.getlogin).gid
108
+ end
109
+ # Add them to the mount options
110
+ mount_options.append("uid=#{mount_uid}")
111
+ mount_options.append("gid=#{mount_gid}")
112
+ end
113
+
84
114
  # SSHFS executable options
85
115
  sshfs_opts = opts[:sshfs_opts]
86
116
  sshfs_opts_append = opts[:sshfs_opts_append].to_s # provided by user
117
+ if not mount_options.empty?()
118
+ sshfs_opts_append+= ' -o ' + mount_options.join(',') + ' '
119
+ end
87
120
 
88
121
  username = machine.ssh_info[:username]
89
122
  host = machine.ssh_info[:host]
@@ -117,7 +150,7 @@ module VagrantPlugins
117
150
  :thread_inherit => true,
118
151
  :startup_info => {:stdin => w2, :stdout => r1, :stderr => f1})
119
152
  else
120
- p1 = spawn(sshfs_cmd, :out => f1, :err => f1, :pgroup => true)
153
+ p1 = spawn(sshfs_cmd, :out => f1, :err => f1, :pgroup => true, :close_others => true)
121
154
  Process.detach(p1) # Detach so process will keep running
122
155
  end
123
156
 
@@ -97,6 +97,36 @@ module VagrantPlugins
97
97
  VagrantPlugins::GuestRedHat::Cap::SSHFSClient
98
98
  end
99
99
 
100
+ guest_capability("centos", "sshfs_installed") do
101
+ require_relative "cap/guest/centos/sshfs_client"
102
+ VagrantPlugins::GuestCentOS::Cap::SSHFSClient
103
+ end
104
+
105
+ guest_capability("centos", "sshfs_install") do
106
+ require_relative "cap/guest/centos/sshfs_client"
107
+ VagrantPlugins::GuestCentOS::Cap::SSHFSClient
108
+ end
109
+
110
+ guest_capability("rocky", "sshfs_installed") do
111
+ require_relative "cap/guest/rocky/sshfs_client"
112
+ VagrantPlugins::GuestRocky::Cap::SSHFSClient
113
+ end
114
+
115
+ guest_capability("rocky", "sshfs_install") do
116
+ require_relative "cap/guest/rocky/sshfs_client"
117
+ VagrantPlugins::GuestRocky::Cap::SSHFSClient
118
+ end
119
+
120
+ guest_capability("alma", "sshfs_installed") do
121
+ require_relative "cap/guest/alma/sshfs_client"
122
+ VagrantPlugins::GuestAlma::Cap::SSHFSClient
123
+ end
124
+
125
+ guest_capability("alma", "sshfs_install") do
126
+ require_relative "cap/guest/alma/sshfs_client"
127
+ VagrantPlugins::GuestAlma::Cap::SSHFSClient
128
+ end
129
+
100
130
  guest_capability("fedora", "sshfs_installed") do
101
131
  require_relative "cap/guest/fedora/sshfs_client"
102
132
  VagrantPlugins::GuestFedora::Cap::SSHFSClient
@@ -110,6 +110,7 @@ module VagrantPlugins
110
110
  ENV['PATH'] += ';C:\cygwin64\usr\sbin'
111
111
  end
112
112
  else
113
+ ENV['PATH'] += ':/usr/libexec/ssh' # Linux (openSUSE/SUSE Family)
113
114
  ENV['PATH'] += ':/usr/libexec/openssh' # Linux (Red Hat Family)
114
115
  ENV['PATH'] += ':/usr/lib/openssh' # Linux (Debian Family)
115
116
  ENV['PATH'] += ':/usr/lib/ssh' # Linux (Arch Linux Family)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module SyncedFolderSSHFS
3
- VERSION = "1.3.4"
3
+ VERSION = "1.3.7"
4
4
  end
5
5
  end
data/test/misc/README.txt CHANGED
@@ -5,32 +5,49 @@
5
5
  # To test we will first create the directory on the machine where
6
6
  # we will mount the guest /etc/ into the host (the reverse mount).
7
7
 
8
- mkdir /tmp/reverse_mount_etc
8
+ mkdir /tmp/reverse_mount_etc_uid_gid/
9
9
 
10
10
  # Next we will define where our 3rd party host is (the normal mount).
11
11
  # This can be another vagrant box or whatever machine you want.
12
- export THIRD_PARTY_HOST='192.168.121.73'
13
- export THIRD_PARTY_HOST_USER='vagrant'
12
+ export THIRD_PARTY_HOST='192.168.121.73'
13
+ export THIRD_PARTY_HOST_USER='vagrant'
14
14
  export THIRD_PARTY_HOST_PASS='vagrant'
15
15
 
16
- # Next vagrant up - will do 4 mounts
16
+ # Open an extra file descriptor to test it is not passed onto child processes
17
+ # https://github.com/dustymabe/vagrant-sshfs/issues/120
18
+ tmpfile=$(mktemp)
19
+ exec {extra_fd}<> "$tmpfile"
20
+
21
+ # Next vagrant up - will do 5 mounts
17
22
  # - slave
23
+ # - slave with owner/group
18
24
  # - slave with sym link
19
- # - normal
20
- # - reverse
25
+ # - normal (from 3rd party host)
26
+ # - reverse with owner/group
21
27
  vagrant up
22
28
 
23
29
  # Next run the script to test the mounts:
24
30
  $ bash dotests.sh
25
31
  Testing slave forward mount!
26
- d635332fe7aa4d4fb48e5cb9357bdedf
32
+ 1358d4a18a2d4ba7be380b991e899952
33
+ Testing slave forward mount with owner/group!
34
+ root:wheel
35
+ 1358d4a18a2d4ba7be380b991e899952
27
36
  Testing slave forward mount with a symlink!
28
- d635332fe7aa4d4fb48e5cb9357bdedf
37
+ 1358d4a18a2d4ba7be380b991e899952
29
38
  Testing normal forward mount!
30
- 6ccc3034df924bd289dd16205bf3d629
31
- Testing reverse mount!
32
- 508619e7e68e446c84d1fcdf7e0dc577
39
+ ef56862ae88f43c0a81962ba6f68a668
40
+ Testing reverse mount with owner/group!
41
+ root:wheel
42
+ ef4f3b50e2034b3593a9eb8b71350abe
43
+
44
+ # We are printing out the machine-id under each mount. The first three
45
+ should be the same, because they are from the same machine (the host).
46
+ The last two should be different; one from 3rd party machine and one
47
+ from the test VM itself (read from the host).
33
48
 
34
- # We are printing out the machine-id under each mount. The first two
35
- should be the same, because they are from the same machine. The last
36
- two should be different.
49
+ # Close our file descriptor. No other process should be using it
50
+ exec {extra_fd}>&-
51
+ if lsof -wn -d $extra_fd | grep "$tmpfile"; then
52
+ echo "Failure: there are processes running that hold an inherited file descriptor"
53
+ fi
@@ -1,28 +1,47 @@
1
1
  Vagrant.configure(2) do |config|
2
2
 
3
- config.ssh.insert_key = 'true'
3
+ config.ssh.insert_key = true
4
4
 
5
5
  # Test a forward slave mount:
6
6
  # mounting /etc/ from the vagrant host into the guest
7
- config.vm.synced_folder "/etc/", "/tmp/forward_slave_mount_etc/", type: "sshfs"
7
+ config.vm.synced_folder "/etc/", "/tmp/forward_slave_mount_etc/",
8
+ type: "sshfs",
9
+ mount_options: ['ro']
10
+
11
+ # Test a forward slave with owner/group info:
12
+ # mounting /etc/ from the vagrant host into the guest
13
+ config.vm.synced_folder "/etc/", "/tmp/forward_slave_mount_etc_uid_gid/",
14
+ type: "sshfs",
15
+ mount_options: ['ro', 'default_permissions'],
16
+ owner: "root",
17
+ group: "wheel"
8
18
 
9
19
  # Test a forward mount to a location that is a symbolic link
10
20
  # https://github.com/dustymabe/vagrant-sshfs/issues/44
11
- config.vm.synced_folder "/etc/", "/sbin/forward_slave_mount_sym_link_test/", type: "sshfs"
21
+ config.vm.synced_folder "/etc/", "/var/run/forward_slave_mount_sym_link_test/",
22
+ type: "sshfs",
23
+ mount_options: ['ro']
12
24
 
13
25
  # Test a forward normal mount:
14
26
  # mounting a folder from a 3rd party host into guest
15
- config.vm.synced_folder "/etc/", "/tmp/forward_normal_mount_etc/", type: "sshfs",
27
+ config.vm.synced_folder "/etc/", "/tmp/forward_normal_mount_etc/",
28
+ type: "sshfs",
16
29
  ssh_host: ENV['THIRD_PARTY_HOST'],
17
30
  ssh_username: ENV['THIRD_PARTY_HOST_USER'],
18
- ssh_password: ENV['THIRD_PARTY_HOST_PASS']
31
+ ssh_password: ENV['THIRD_PARTY_HOST_PASS'],
32
+ mount_options: ['ro']
19
33
 
20
- # Test a reverse mount:
34
+ # Test a reverse mount with owner/group
21
35
  # mounting /etc/ from vagrant guest into vagrant host
22
- config.vm.synced_folder "/tmp/reverse_mount_etc/", "/etc", type: "sshfs", reverse: true
36
+ config.vm.synced_folder "/tmp/reverse_mount_etc_uid_gid/", "/etc",
37
+ type: "sshfs",
38
+ reverse: true,
39
+ owner: "root",
40
+ group: "wheel",
41
+ mount_options: ['ro']
23
42
 
24
43
  host = 'sshfs-tests'
25
- box = 'fedora/31-cloud-base'
44
+ box = 'fedora/36-cloud-base'
26
45
 
27
46
  config.vm.define host do | tmp |
28
47
  tmp.vm.hostname = host
data/test/misc/dotests.sh CHANGED
@@ -6,12 +6,19 @@ set -eu
6
6
  echo -en "Testing slave forward mount!\n\t"
7
7
  vagrant ssh -- cat /tmp/forward_slave_mount_etc/machine-id
8
8
 
9
+ echo -en "Testing slave forward mount with owner/group!\n\t"
10
+ vagrant ssh -- stat --printf '%U:%G' /tmp/forward_slave_mount_etc_uid_gid
11
+ echo -en "\n\t"
12
+ vagrant ssh -- cat /tmp/forward_slave_mount_etc_uid_gid/machine-id
13
+
9
14
  # https://github.com/dustymabe/vagrant-sshfs/issues/44
10
15
  echo -en "Testing slave forward mount with a symlink!\n\t"
11
- vagrant ssh -- cat /usr/sbin/forward_slave_mount_sym_link_test/machine-id
16
+ vagrant ssh -- cat /run/forward_slave_mount_sym_link_test/machine-id
12
17
 
13
18
  echo -en "Testing normal forward mount!\n\t"
14
19
  vagrant ssh -- cat /tmp/forward_normal_mount_etc/machine-id
15
20
 
16
- echo -en "Testing reverse mount!\n\t"
17
- cat /tmp/reverse_mount_etc/machine-id
21
+ echo -en "Testing reverse mount with owner/group!\n\t"
22
+ stat --printf '%U:%G' /tmp/reverse_mount_etc_uid_gid/
23
+ echo -en "\n\t"
24
+ cat /tmp/reverse_mount_etc_uid_gid/machine-id
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-sshfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dusty Mabe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-15 00:00:00.000000000 Z
11
+ date: 2022-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: win32-process
@@ -69,8 +69,10 @@ files:
69
69
  - build.sh
70
70
  - lib/vagrant-sshfs.rb
71
71
  - lib/vagrant-sshfs/action_hostpath_fixup.rb
72
+ - lib/vagrant-sshfs/cap/guest/alma/sshfs_client.rb
72
73
  - lib/vagrant-sshfs/cap/guest/alpine/sshfs_client.rb
73
74
  - lib/vagrant-sshfs/cap/guest/arch/sshfs_client.rb
75
+ - lib/vagrant-sshfs/cap/guest/centos/sshfs_client.rb
74
76
  - lib/vagrant-sshfs/cap/guest/debian/sshfs_client.rb
75
77
  - lib/vagrant-sshfs/cap/guest/fedora/sshfs_client.rb
76
78
  - lib/vagrant-sshfs/cap/guest/freebsd/sshfs_client.rb
@@ -79,6 +81,7 @@ files:
79
81
  - lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
80
82
  - lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
81
83
  - lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb
84
+ - lib/vagrant-sshfs/cap/guest/rocky/sshfs_client.rb
82
85
  - lib/vagrant-sshfs/cap/guest/suse/sshfs_client.rb
83
86
  - lib/vagrant-sshfs/cap/host/darwin/sshfs_reverse_mount.rb
84
87
  - lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb
@@ -98,7 +101,7 @@ homepage: https://github.com/dustymabe/vagrant-sshfs
98
101
  licenses:
99
102
  - GPL-2.0
100
103
  metadata: {}
101
- post_install_message:
104
+ post_install_message:
102
105
  rdoc_options: []
103
106
  require_paths:
104
107
  - lib
@@ -113,8 +116,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
116
  - !ruby/object:Gem::Version
114
117
  version: '0'
115
118
  requirements: []
116
- rubygems_version: 3.0.3
117
- signing_key:
119
+ rubygems_version: 3.2.33
120
+ signing_key:
118
121
  specification_version: 4
119
122
  summary: 'A Vagrant synced folder plugin that mounts folders via SSHFS. This is the
120
123
  successor to Fabio Kreusch''s implementation: https://github.com/fabiokr/vagrant-sshfs'