[root@rhel7server1 ~]# systemctl enable nfs-server Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
rw: Share as read-write. Keep in mind that normal Linux permissions still apply. (Note that this is a default option.)
ro: Share as read-only.
sync: File data changes are made to disk immediately, which has an impact on performance, but is less likely to result in data loss. On some distributions this is the default.
async: The opposite of sync; file data changes are made initially to memory. This speeds up performance but is more likely to result in data loss. On some distributions this is the default.
root_squash: Map the root user and group account from the NFS client to the anonymous accounts, typically either the nobody account or the nfsnobody account. See the next section, “User ID Mapping,” for more details. (Note that this is a default option.)
no_root_squash: Map the root user and group account from the NFS client to the local root and group accounts.
Use Kerberos to control access to NFS network shares
## assume the following servers
## (1) KDC server - 192.168.0.30 : rhel7mgmt1.myexample.com
## (2) NFS client & KDC client - 192.168.0.20 : rhel7client1.myexample.com
## (3) NFS server & KDC client - 192.168.0.10 : rhel7server1.myexample.com
##
## in lieu of DNS, add the following to /etc/hosts file of all the machines
## Assumptions
## (1) KDC server setup already done in the KDC server as described here
## (2) KDC client setup already done in the NFS client as described here
### On the NFS server (rhel7server1.myexample.com) set up the KDC Client
## connect to the kadmin server and add host principal and nfs service principal
[root@rhel7server1 ~]# kadmin Authenticating as principal root/admin@MYEXAMPLE.COM with password.
Password for root/admin@MYEXAMPLE.COM:
kadmin: addprinc -randkey host/rhel7server1.myexample.com WARNING: no policy specified for host/rhel7server1.myexample.com@MYEXAMPLE.COM; defaulting to no policy
Principal "host/rhel7server1.myexample.com@MYEXAMPLE.COM" created.
kadmin: ktadd host/rhel7server1.myexample.com Entry for principal host/rhel7server1.myexample.com with kvno 2, encryption type aes256-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal host/rhel7server1.myexample.com with kvno 2, encryption type aes128-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal host/rhel7server1.myexample.com with kvno 2, encryption type des3-cbc-sha1 added to keytab FILE:/etc/krb5.keytab.
Entry for principal host/rhel7server1.myexample.com with kvno 2, encryption type arcfour-hmac added to keytab FILE:/etc/krb5.keytab.
Entry for principal host/rhel7server1.myexample.com with kvno 2, encryption type camellia256-cts-cmac added to keytab FILE:/etc/krb5.keytab.
Entry for principal host/rhel7server1.myexample.com with kvno 2, encryption type camellia128-cts-cmac added to keytab FILE:/etc/krb5.keytab.
Entry for principal host/rhel7server1.myexample.com with kvno 2, encryption type des-hmac-sha1 added to keytab FILE:/etc/krb5.keytab.
Entry for principal host/rhel7server1.myexample.com with kvno 2, encryption type des-cbc-md5 added to keytab FILE:/etc/krb5.keytab.
kadmin: addprinc -randkey nfs/rhel7server1.myexample.com WARNING: no policy specified for nfs/rhel7server1.myexample.com@MYEXAMPLE.COM; defaulting to no policy
Principal "nfs/rhel7server1.myexample.com@MYEXAMPLE.COM" created.
kadmin: ktadd nfs/rhel7server1.myexample.com Entry for principal nfs/rhel7server1.myexample.com with kvno 2, encryption type aes256-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7server1.myexample.com with kvno 2, encryption type aes128-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7server1.myexample.com with kvno 2, encryption type des3-cbc-sha1 added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7server1.myexample.com with kvno 2, encryption type arcfour-hmac added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7server1.myexample.com with kvno 2, encryption type camellia256-cts-cmac added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7server1.myexample.com with kvno 2, encryption type camellia128-cts-cmac added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7server1.myexample.com with kvno 2, encryption type des-hmac-sha1 added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7server1.myexample.com with kvno 2, encryption type des-cbc-md5 added to keytab FILE:/etc/krb5.keytab.
kadmin: quit
## edit /etc/ssh/ssh_config
[root@rhel7server1 ~]# vi /etc/ssh/ssh_config
# uncomment GSSAPIAuthentication & set the value to yes
# uncomment GSSAPIDelegateCredentials & set the value to yes
[krbtest@rhel7server1 ~]$ kinit Password for krbtest@MYEXAMPLE.COM:
[krbtest@rhel7server1 ~]$ klist Ticket cache: KEYRING:persistent:1001:1001
Default principal: krbtest@MYEXAMPLE.COM
Valid starting Expires Service principal
06/17/2020 13:41:32 06/18/2020 13:41:29 krbtgt/MYEXAMPLE.COM@MYEXAMPLE.COM
[krbtest@rhel7server1 ~]$ ssh rhel7mgmt1.myexample.com The authenticity of host 'rhel7mgmt1.myexample.com (192.168.0.30)' can't be established.
ECDSA key fingerprint is SHA256:vNpmvuXbPajqQUZz4J+wzqni3r6SN0oxJE70Uy6iabg.
ECDSA key fingerprint is MD5:6f:05:e9:4e:37:25:b5:99:e0:49:99:14:d4:1c:e5:cc. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'rhel7mgmt1.myexample.com,192.168.0.30' (ECDSA) to the list of known hosts.
Last login: Wed Jun 17 13:22:37 2020 from rhel7client1.myexample.com [krbtest@rhel7mgmt1 ~]$
### Configure NFS shares to use Kerberos
## Assuming that the server rhel7server1 have been configured to provide NFS shares as describedhere ## create the directory to share
[root@rhel7server1 ~]# showmount -e localhost Export list for localhost:
/krbdata rhel7client1.myexample.com
## reboot the NFS server for consistent behaviour
### Test from NFS client (rhel7client1.myexample.com)
## Assuming that the machine have been configured as NFS client as described here
## connect to kadmin and add the nfs service principal for this client
[root@rhel7client1 ~]# kadmin Authenticating as principal root/admin@MYEXAMPLE.COM with password.
Password for root/admin@MYEXAMPLE.COM:
kadmin: addprinc -randkey nfs/rhel7client1.myexample.com WARNING: no policy specified for nfs/rhel7client1.myexample.com@MYEXAMPLE.COM; defaulting to no policy
Principal "nfs/rhel7client1.myexample.com@MYEXAMPLE.COM" created.
kadmin: ktadd nfs/rhel7client1.myexample.com Entry for principal nfs/rhel7client1.myexample.com with kvno 2, encryption type aes256-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7client1.myexample.com with kvno 2, encryption type aes128-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7client1.myexample.com with kvno 2, encryption type des3-cbc-sha1 added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7client1.myexample.com with kvno 2, encryption type arcfour-hmac added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7client1.myexample.com with kvno 2, encryption type camellia256-cts-cmac added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7client1.myexample.com with kvno 2, encryption type camellia128-cts-cmac added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7client1.myexample.com with kvno 2, encryption type des-hmac-sha1 added to keytab FILE:/etc/krb5.keytab.
Entry for principal nfs/rhel7client1.myexample.com with kvno 2, encryption type des-cbc-md5 added to keytab FILE:/etc/krb5.keytab.