mirror_zfs/include/os/freebsd/zfs/sys
Brian Behlendorf d34d4f97a8
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
2024-10-02 09:12:02 -07:00
..
abd_impl_os.h abd_os: break out platform-specific header parts 2024-08-21 13:37:18 -07:00
abd_os.h Adding Direct IO Support 2024-09-14 13:47:59 -07:00
arc_os.h FreeBSD: Reduce divergence from in-tree sources 2023-10-09 13:27:18 -07:00
freebsd_crypto.h module: icp: fold away all key formats except CRYPTO_KEY_RAW 2022-02-15 16:25:07 -08:00
freebsd_event.h FreeBSD: Reduce divergence from in-tree sources 2023-10-09 13:27:18 -07:00
vdev_os.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_bootenv_os.h zfs label bootenv should store data as nvlist 2020-09-15 15:42:27 -07:00
zfs_context_os.h FreeBSD: Reduce divergence from in-tree sources 2023-10-09 13:27:18 -07:00
zfs_ctldir.h snapdir: add 'disabled' value to make .zfs inaccessible 2024-10-02 09:12:02 -07:00
zfs_dir.h Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_ioctl_compat.h freebsd: add ifdefs around legacy ioctl support 2022-11-07 15:55:26 -08:00
zfs_vfsops_os.h snapdir: add 'disabled' value to make .zfs inaccessible 2024-10-02 09:12:02 -07:00
zfs_vnops_os.h Linux 6.3 compat: idmapped mount API changes 2023-04-10 14:15:36 -07:00
zfs_znode_impl.h Support for longnames for files/directories (Linux part) 2024-10-01 13:40:27 -07:00
zpl.h Add FreeBSD support to OpenZFS 2020-04-14 11:36:28 -07:00