Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Jun 2022 11:14:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 264570] nfsuserd: Mapping of Userids mismatched
Message-ID:  <bug-264570-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264570

            Bug ID: 264570
           Summary: nfsuserd: Mapping of Userids mismatched
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: georg-bsd@schorsch-tech.de

I got 2 fresh installed 13.1-RELEASE VMs in bhyve.

fs (nfs server)
admin: uid 1001
u1   : uid 1002
u2   : uid 1003

fc (nfs client)
admin: uid 1001
u1   : uid 1003
u2   : uid 1002

I intentionally crossed the u1 and u2 uids on these two accounts to test the
nfsuserd.

Settings on the server
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

admin@fs:~ # id u1
uid=3D1002(u1) gid=3D1002(u1) groups=3D1002(u1)
admin@fs:~ # id u2
uid=3D1003(u2) gid=3D1003(u2) groups=3D1003(u2)
admin@fs:~ $ hostname -f
fs.me.local
admin@fs:~ $ ls -la /zroot/nfsv4/test/
total 3
drwxr-xr-x  2 root   wheel  5 Jun  7 17:46 .
drwxr-xr-x  3 root   wheel  3 Jun  7 17:46 ..
-rw-r--r--  1 admin  wheel  0 Jun  7 17:46 hallo_admin
-rw-r--r--  1 u1     u1     0 Jun  7 17:46 hallo_u1
-rw-r--r--  1 u2     u2     0 Jun  7 17:46 hallo_u2

admin@fs:~ $ cat /etc/rc.conf
hostname=3D"fs.me.local"
keymap=3D"de.kbd"
ifconfig_vtnet0=3D"DHCP"
ifconfig_vtnet0_ipv6=3D"inet6 accept_rtadv"
sshd_enable=3D"YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev=3D"NO"
zfs_enable=3D"YES"

nfs_server_enable=3D"YES"
nfsv4_server_enable=3D"YES"
nfs_client_enable=3D"YES"
nfsuserd_enable=3D"YES"
nfsuserd_flags=3D"-domain me.local -verbose"
nfscbd_enable=3D"YES"
mountd_enable=3D"YES"
mountd_flags=3D"-r"

hostid_enable=3D"YES"

admin@fs:~ $ cat /etc/exports
/zroot/nfsv4/test                -alldirs -network 192.168.160.0/24
V4: /zroot/nfsv4                 -sec=3Dsys -network 192.168.160.0/24


sysctl.conf
vfs.nfs.enable_uidtostring=3D1
vfs.nfsd.enable_stringtouid=3D0

Settings on the client
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
root@fc:~ # id u1
uid=3D1003(u1) gid=3D1003(u1) groups=3D1003(u1)
root@fc:~ # id u2
uid=3D1002(u2) gid=3D1002(u2) groups=3D1002(u2)
root@fc:~ # hostname -f
fc.me.local
root@fc:~ # mount -t nfs -o nfsv4 192.168.160.66:/test /mnt
root@fc:~ # nfsstat -m
192.168.160.66:/test on /mnt
nfsv4,minorversion=3D2,tcp,resvport,nconnect=3D1,hard,cto,sec=3Dsys,acdirmi=
n=3D3,acdirmax=3D60,acregmin=3D5,acregmax=3D60,nametimeo=3D60,negnametimeo=
=3D60,rsize=3D65536,wsize=3D65536,readdirsize=3D65536,readahead=3D1,wcommit=
size=3D8388608,timeout=3D120,retrans=3D2147483647
root@fc:~ # ls -la /mnt/
total 11
drwxr-xr-x   2 root   wheel   5 Jun  7 17:46 .
drwxr-xr-x  19 root   wheel  25 Jun  7 17:44 ..
-rw-r--r--   1 admin  wheel   0 Jun  7 17:46 hallo_admin
-rw-r--r--   1 u2     u2      0 Jun  7 17:46 hallo_u1
-rw-r--r--   1 u1     u1      0 Jun  7 17:46 hallo_u2
root@fc:~ #

rc.conf:
--------
hostname=3D"fc.me.local"
keymap=3D"de.kbd"
ifconfig_vtnet0=3D"DHCP"
ifconfig_vtnet0_ipv6=3D"inet6 accept_rtadv"
sshd_enable=3D"YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev=3D"NO"
zfs_enable=3D"YES"

nfs_client_enable=3D"YES"
nfsuserd_enable=3D"YES"
nfsuserd_flags=3D"-domain me.local -verbose"
nfscbd_enable=3D"YES"

rpc_lockd_enable=3D"YES"
rpc_statd_enable=3D"YES"
mountd_flags=3D"-r"

hostid_enable=3D"YES"

sysctl.conf
vfs.nfs.enable_uidtostring=3D1
vfs.nfsd.enable_stringtouid=3D0

Test:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
On the client i mounted with:
mount -t nfs -o nfsv4 fs:/test /mnt

root@fc:/mnt # ls -la
total 11
drwxr-xr-x   2 root   wheel   5 Jun  7 17:46 .
drwxr-xr-x  19 root   wheel  25 Jun  8 05:50 ..
-rw-r--r--   1 admin  wheel   0 Jun  7 17:46 hallo_admin
-rw-r--r--   1 u1     u1      0 Jun  7 17:46 hallo_u1
-rw-r--r--   1 u2     u2      0 Jun  7 17:46 hallo_u2

This looks good! But the problem is: I created on the server in the
/zroot/nfsv4/test a nuew subfolder "sub" with u+w,g+w,o+w. In this folder i=
 try
to create a new file.

On the client:
u1@fc:~ $ touch /mnt/sub/hello_feom_client_u1
u1@fc:~ $ ls -la /mnt/sub/
total 2
drwxr-xrwx  2 u2  u2  3 Jun  8 18:04 .
drwxrwxr-x  3 u2  u2  6 Jun  8 06:07 ..
-rw-r--r--  1 u1  u2  0 Jun  8 18:04 hello_feom_client_u1
u1@fc:~ $ ls -ln /mnt/sub/
total 1
-rw-r--r--  1 1003  1002  0 Jun  8 18:04 hello_feom_client_u1


And the server shows:
admin@fs:~ $ sudo ls -la /zroot/nfsv4/test/sub/
total 3
drwxr-xrwx  2 u1  u1  3 Jun  8 18:04 .
drwxrwxr-x  3 u1  u1  6 Jun  8 06:07 ..
-rw-r--r--  1 u2  u1  0 Jun  8 18:04 hello_feom_client_u1
admin@fs:~ $ sudo ls -ln /zroot/nfsv4/test/sub/
total 1
-rw-r--r--  1 1003  1002  0 Jun  8 18:04 hello_feom_client_u1


Please see the mismatched uids! I touch the file as u1 on the client. The
client u1 "ls -la" shows that the new file is from u2. And also on the serv=
er
the new file is from u2.

I dont run any NIS, LDAP or kerberos. Also the version used is NFS4.2. I tr=
ied
to downgrade to 4.1 and 4.0 but the behaviour stays the same.

I set the two sysctl variables explicit to use the names in the nfs  protoc=
ol
and not the uids that i explicit use nfsuserd and dont rely on the same uid=
s on
all clients,servers.

I read that post from rick:
https://forums.freebsd.org/threads/nfsv4-without-kerberos.71899/#post-436567
or better from the mailing list
https://www.mail-archive.com/freebsd-stable@freebsd.org/msg139428.html

So my question is: Is this a bug or just wrong configured?

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-264570-227>