Bug 151326 - [nfs] nfs exports fail if netgroups contain duplicate entries
Summary: [nfs] nfs exports fail if netgroups contain duplicate entries
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-09 00:30 UTC by Jeff Strunk
Modified: 2018-01-03 05:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Strunk 2010-10-09 00:30:05 UTC
We are setting up a couple of file servers using ZFS to replace our old Debian file servers. We have been using netgroups to allow a group of admin machines to access the files without remapping root to nobody(no_root_squash on linux and -maproot=0 on FreeBSD). All of our machines that access the nfs servers are in the utm netgroup. We use an export line for that netgroup to restrict rw access to our nfs servers.

So, our exports file in FreeBSD looks like(there are more lines, but they all look like these with the filesystem changed):
/thinkmate1     -maproot=0 admin
/thinkmate1     utm 

When mountd is started, it logs:
Oct  8 16:37:21 thinkmate2 mountd[2242]: bad exports list line /thinkmate1      utm

mountd -d shows the following the 2nd time a filesystem is exported:
mountd: can't change attributes for /thinkmate1

When I try to mount /thinkmate1 from an admin machine, it works. Also, root is able to read and write any files. When I try to mount on a non-admin machine, the client reports that it was denied by the server.

If I reverse the exports lines, all hosts in the utm netgroup can access /thinkmate1, but root on admin hosts is mapped to nobody.

I discovered that some hostnames are found in both the admin and utm netgroups. When I took the admin hosts out of the utm netgroup, everything worked. This is not a problem on either Linux or Solaris.

Fix: 

The workaround is to clean up duplicate netgroup entries. It looks like each host can only be in one netgroup.
How-To-Repeat: 1) Create the following files.

/etc/netgroup(replace 4 spaces with tab):
admin \
    (hosta,,domain)

domain \
    (hosta,,domain) \
    (hostb,,domain)

/etc/exports:
/export -maproot=0 admin
/export domain

2) Restart mountd.

3) Try to nfs mount /export from hostb.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2010-10-27 12:26:54 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:34 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped