Is this a real security issue or just a information about using the dataset of / when exporting some directory of it?
The NFS sharing happens in a jail. The root of the jail is a ZFS dataset. I just want to know if this warning is a serious issue. The share works and i cannot access the upper directories. It confuses me.
The warning can be safely ignored. It is a false positive warning.
The warning is triggered by
mountd.c because there seems no logic implemented to distinguish between real and false entire file system shared mount points settings.
If you have made sure the root file system is not exposed, and you want the warning silenced, use the "mountd_flags=" -A ..." in addition to /etc/defaults/rc.conf: mountd_flags.
My /etc/exports file is very simple:
/shares/test -ro -alldirs
The potentially problematic flag in your /etc/exports is "-alldirs".
If "-alldirs" is set on a regular directory on one file system, here /share/test, then the entire "/" root file system is accessible. To prevent this, remove "-alldirs".
mountd(8) still complains, but any attempt to mount parent directories (/share, /) should be refused with permission denied.
See
exports(5)
Rich (BB code):
...
There are three forms of the directory path specification.
...
The second is to specify the pathname of the root of the file system
followed by the -alldirs flag; this form allows the host(s) to mount at
any point within the file system, including regular files if the -r
option is used on mountd(8).
...
"-alldirs" in a "sharenfs" set property has no effect on parent datasets (ie.: zroot/share, zroot), since every dataset is a separate file system . In this configuration
mountd(8) won't complain about exporting an entire file system.
When using "sharenfs" on datasets, make sure to remove any exported mount entries from /etc/exports.
"sharenfs" set properties have an immediate effect by mountd restarting automatically.
In case you weren't aware, "sharenfs" exports are registered in the /etc/zfs/exports file.