Describes how to configure and use NFSv4 on Kerberos.
mapr and group
maprgrp.# klist
klist: No credentials cache found (filename: /tmp/krb5cc_0)
nfs4ad.com domain:
# klist -kt
Keytab name: FILE:/etc/krb5.keytab
KVNO Timestamp Principal
---- ------------------- ------------------------------------------------------
2 04/10/2018 23:51:24 host/atsqa4-161.nfs4ad.com@NFS4AD.COM
2 04/10/2018 23:51:24 host/ATSQA4-161@NFS4AD.COM
2 04/10/2018 23:51:24 host/atsqa4-161.nfs4ad.com@NFS4AD.COM
2 04/10/2018 23:51:24 host/ATSQA4-161@NFS4AD.COM
2 04/10/2018 23:51:24 host/atsqa4-161.nfs4ad.com@NFS4AD.COM
2 04/10/2018 23:51:24 host/ATSQA4-161@NFS4AD.COM
2 04/10/2018 23:51:25 host/atsqa4-161.nfs4ad.com@NFS4AD.COM
2 04/10/2018 23:51:25 host/ATSQA4-161@NFS4AD.COM
2 04/10/2018 23:51:25 host/atsqa4-161.nfs4ad.com@NFS4AD.COM
2 04/10/2018 23:51:25 host/ATSQA4-161@NFS4AD.COM
2 04/10/2018 23:51:25 ATSQA4-161$@NFS4AD.COM
2 04/10/2018 23:51:25 ATSQA4-161$@NFS4AD.COM
2 04/10/2018 23:51:25 ATSQA4-161$@NFS4AD.COM
2 04/10/2018 23:51:25 ATSQA4-161$@NFS4AD.COM
2 04/10/2018 23:51:25 ATSQA4-161$@NFS4AD.COMkinit
command.
[root@atsqa4-161 ~]# kinit -k ATSQA4-161$
[root@atsqa4-161 ~]# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: ATSQA4-161$@NFS4AD.COM
Valid starting Expires Service principal
04/11/2018 03:04:38 04/11/2018 13:04:38 krbtgt/NFS4AD.COM@NFS4AD.COM
renew until 04/18/2018 03:04:38setspn command.
nfs4ad.com domain, run the following
command:
C:\Users\Administrator>setspn -A nfs/atsqa4-161.nfs4ad.com mapr
Checking domain DC=nfs4ad,DC=com
Registering ServicePrincipalNames for CN=mapr,CN=Users,DC=nfs4ad,DC=com
nfs/atsqa4-164.nfs4ad.com
Updated objectkvno command.
# kvno nfs/atsqa4-164.nfs4ad.com@NFS4AD.COM
nfs/atsqa4-164.nfs4ad.com@NFS4AD.COM: kvno = 46
kvno nfs/qa108-43.nfs4ad.com@NFS4AD.COM/etc/krb5.keytab:
# ktutil
ktutil: addent -password -p nfs/atsqa4-164.nfs4ad.com@NFS4AD.COM -k 46 -e RC4-HMAC
Ex: addent -password -p nfs/qa108-43.nfs4ad.com@NFS4AD.COM -k 46 -e RC4-HMAC
Password for nfs/atsqa4-164.nfs4ad.com@NFS4AD.COM:
( Give mapr user password i.e nfs4AD123 )
ktutil: l
slot KVNO Principal
---- ---- ---------------------------------------------------------------------
1 46 nfs/atsqa4-164.nfs4ad.com@NFS4AD.COM
ktutil: wkt /etc/krb5.keytab
ktutil: q
/etc/krb5.keytab file by running the
klist command.
nfs4ad.com, run the following
command and verify the entries in the file:
# klist -kt /etc/krb5.keytab
Keytab name: FILE:/etc/krb5.keytab
KVNO Timestamp Principal
---- ------------------- ------------------------------------------------------
4 08/01/2018 00:29:21 host/atsqa4-161.nfs4ad.com@NFS4AD.COM
4 08/01/2018 00:29:21 host/ATSQA4-161@NFS4AD.COM
4 08/01/2018 00:29:21 host/atsqa4-161.nfs4ad.com@NFS4AD.COM
4 08/01/2018 00:29:21 host/ATSQA4-161@NFS4AD.COM
4 08/01/2018 00:29:21 host/atsqa4-161.nfs4ad.com@NFS4AD.COM
4 08/01/2018 00:29:21 host/ATSQA4-161@NFS4AD.COM
4 08/01/2018 00:29:21 host/atsqa4-161.nfs4ad.com@NFS4AD.COM
4 08/01/2018 00:29:21 host/ATSQA4-161@NFS4AD.COM
4 08/01/2018 00:29:21 host/atsqa4-161.nfs4ad.com@NFS4AD.COM
4 08/01/2018 00:29:21 host/ATSQA4-161@NFS4AD.COM
4 08/01/2018 00:29:21 ATSQA4-161$@NFS4AD.COM
4 08/01/2018 00:29:21 ATSQA4-161$@NFS4AD.COM
4 08/01/2018 00:29:22 ATSQA4-161$@NFS4AD.COM
4 08/01/2018 00:29:22 ATSQA4-161$@NFS4AD.COM
4 08/01/2018 00:29:22 ATSQA4-161$@NFS4AD.COM
46 08/01/2018 02:58:01 nfs/atsqa4-161.nfs4ad.com@NFS4AD.COM/etc/krb5.keytab file is owned by user
mapr and if necessary, change ownership to user
mapr.
[root@qa108-41 ~]# chown mapr:root /etc/krb5.keytab
[root@qa108-41 ~]# ls -l /etc/krb5.keytab
-rw------- 1 mapr root 4175 Jul 22 23:53 /etc/krb5.keytabrpcgssd service on the host to establish GSS
security contexts.
service rpcgssd start
service gssd restart
SecType, in the NFSv4 server
configuration file at /opt/mapr/conf/nfs4server.conf.
# Security type (krb5,krb5i,krb5p)
SecType = krb5;showmount -e
command.
showmount command will not
return the list of exported NFS shares. Instead, to view the export list, run
the following command:
/opt/mapr/server/nfs4mgr list-exportslist-exports command runs
successfully.
# maprcli nfs4mgmt list-exports
Export Id Path
30 /mapr
0 /maprcli node services -nfs4 stop -nodes `hostname` ; service rpcgssd restart; sleep 1; service rpcbind restart ; sleep 1; service nfs restart ; service nfs stop ; sleep 2; maprcli node services -nfs4 start -nodes `hostname`
maprcli node services -nfs4 stop -nodes `hostname` ; service gssd restart; sleep 1; service rpcbind restart ; sleep 1; service nfs-kernel-server restart ; service nfs-kernel-server stop ; sleep 2; maprcli node services -nfs4 start -nodes `hostname`
/etc/hosts file on the NFSv4 server host first
and then on the AD server host.
10.10.88.14 nfsvirtualip1
10.10.88.15 nfsvirtualip2setspn command.
C:\Users\Administrator>setspn -A host/nfsvirtualip1 nfsserver
C:\Users\Administrator>setspn -A nfs/nfsvirtualip1 nfsserver
C:\Users\Administrator>setspn -A host/nfsvirtualip2 nfsserver
C:\Users\Administrator>setspn -A nfs/nfsvirtualip2 nfsserverrpcgssd service on the host to
re-establish GSS security contexts.
service rpcgssd restartnfs as the service
name.
For example: nfs/host.domain.com@REALM
/etc/krb5.keytab file, and set correct permissions on the
file.SecType, in the NFSv4 server
configuration file at /opt/mapr/conf/nfs4server.conf.
# Security type (krb5,krb5i,krb5p)
SecType = krb5;showmount -e
command.
showmount command will not
return the list of exported NFS shares. Instead, to view the export list, run
the following command:
/opt/mapr/server/nfs4mgr list-exportslist-exports command runs
successfully.
# maprcli nfs4mgmt list-exports
Export Id Path
30 /mapr
0 //etc/krb5.keytab file with a
valid principal similar to one of the following:
nfs/<client_fqdn>@<domain>@<REALM>,
host/<client_fqdn>@<domain>@<REALM>, or
<HOSTNAME>$@<REALM>.
keytab file
with the principal, which will be used to mount the share, for the OS (as
mentioned in the OS vendor documentation).mount command.
mount -t nfs4 -o sec=<security-type> <nfs4-server-hostname>:/<pseudo-path> <mount-point>
For example:
# mount -t nfs4 -o sec=krb5 <FQDN>:/mapr /mnt/nfs4mnt
mapr on domain
nfs4ad.com, run one of the following commands to
generate the ticket:kinit mapr@NFS4AD.COM
<Enter password>
echo usr2AD123 | kinit user2@NFS4AD.COM
service rpcgssd restart; sleep 1; service rpcbind restart ; sleep 1; service nfs stopservice rpcgssd restart; sleep 1; service rpcbind restart ; sleep 1; service nfs stopWorkaround: Restart the
rpcgssd service with the new ticket to make the
mount point accessible and re-trigger the IO to proceed.