mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
snapdir: add 'disabled' value to make .zfs inaccessible
In some environments, just making the .zfs control dir hidden from sight
might not be enough. In particular, the following scenarios might
warrant not allowing access at all:
- old snapshots with wrong permissions/ownership
- old snapshots with exploitable setuid/setgid binaries
- old snapshots with sensitive contents
Introducing a new 'disabled' value that not only hides the control dir,
but prevents access to its contents by returning ENOENT solves all of
the above.
The new property value takes advantage of 'iuv' semantics ("ignore
unknown value") to automatically fall back to the old default value when
a pool is accessed by an older version of ZFS that doesn't yet know
about 'disabled' semantics.
I think that technically the zfs_dirlook change is enough to prevent
access, but preventing lookups and dir entries in an already opened .zfs
handle might also be a good idea to prevent races when modifying the
property at runtime.
Add zfs_snapshot_no_setuid parameter to control whether automatically
mounted snapshots have the setuid mount option set or not.
this could be considered a partial fix for one of the scenarios
mentioned in desired.
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Co-authored-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Closes #3963
Closes #16587
This commit is contained in:
@@ -1570,6 +1570,15 @@ which have the
|
||||
.Em no_root_squash
|
||||
option set.
|
||||
.
|
||||
.It Sy zfs_snapshot_no_setuid Ns = Ns Sy 0 Ns | Ns 1 Pq int
|
||||
Whether to disable
|
||||
.Em setuid/setgid
|
||||
support for snapshot mounts triggered by access to the
|
||||
.Sy .zfs/snapshot
|
||||
directory by setting the
|
||||
.Em nosuid
|
||||
mount option.
|
||||
.
|
||||
.It Sy zfs_flags Ns = Ns Sy 0 Pq int
|
||||
Set additional debugging flags.
|
||||
The following flags may be bitwise-ored together:
|
||||
|
||||
@@ -71,7 +71,7 @@ File system snapshots can be accessed under the
|
||||
directory in the root of the file system.
|
||||
Snapshots are automatically mounted on demand and may be unmounted at regular
|
||||
intervals.
|
||||
The visibility of the
|
||||
The availability and visibility of the
|
||||
.Pa .zfs
|
||||
directory can be controlled by the
|
||||
.Sy snapdir
|
||||
|
||||
+3
-3
@@ -1848,11 +1848,11 @@ Controls whether the volume snapshot devices under
|
||||
are hidden or visible.
|
||||
The default value is
|
||||
.Sy hidden .
|
||||
.It Sy snapdir Ns = Ns Sy hidden Ns | Ns Sy visible
|
||||
.It Sy snapdir Ns = Ns Sy disabled Ns | Ns Sy hidden Ns | Ns Sy visible
|
||||
Controls whether the
|
||||
.Pa .zfs
|
||||
directory is hidden or visible in the root of the file system as discussed in
|
||||
the
|
||||
directory is disabled, hidden or visible in the root of the file system as
|
||||
discussed in the
|
||||
.Sx Snapshots
|
||||
section of
|
||||
.Xr zfsconcepts 7 .
|
||||
|
||||
Reference in New Issue
Block a user