Page MenuHomeFreeBSD

mountd(8): parsecred(): Fallback to "nogroup" or GID_NOGROUP
Needs ReviewPublic

Authored by olce on Tue, Oct 8, 1:43 PM.
Tags
None
Referenced Files
F100690432: D47011.diff
Fri, Oct 18, 10:17 AM
Unknown Object (File)
Tue, Oct 15, 6:57 AM
Unknown Object (File)
Thu, Oct 10, 4:59 AM
Unknown Object (File)
Wed, Oct 9, 8:03 AM
Subscribers

Details

Reviewers
rmacklem
Summary

In the 'uid:gid:gid:...' case (for '-maproot' or '-mapall'), if no GID
is specified at all (i.e., input is of the form 'uid:', with the colon
at the end), mountd(8) would pass credentials with an empty array of
groups to the kernel.

For security reasons, we have put in place a kernel fallback a few
commits ago, which currently is the value of
NFSD_VNET(nfsrv_defaultgid). That value is by default GID_NOGROUP, and
may be set by nfsuserd(8) based on the content of '/etc/group' on the
host (or some other source, depending on 'nsswitch.conf'). As,
according to rmacklem@, lots of installations do not run nfsuserd(8), we
emulate its effect here by first trying to find the GID number
corresponding to "nogroup" and falling back to GID_NOGROUP.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59974
Build 56859: arc lint + arc unit

Event Timeline

olce requested review of this revision.Tue, Oct 8, 1:43 PM

Simplify by using getgrnam() instead of getgrnam_r(), as mountd() is not multi-threaded and already uses getgrnam().

Isolate the fallback logic in a separate function (nogroup()) and substitute all uses of GID_NOGROUP with it.