2.14. Configuring an NFS client with mutual TLS support
If the server supports NFS with TLS encryption, you can configure the NFS server and client to authenticate each other by using TLS protocol.
Prerequisites
- You have configured the NFS server with TLS encryption. For details, see Configuring an NFS server with TLS support.
-
You have installed the
ktls-utilspackage.
Procedure
Create a private key and a certificate signing request (CSR):
# openssl req -new -newkey rsa:4096 -noenc \ -keyout /etc/pki/tls/private/client.example.com.key \ -out /etc/pki/tls/private/client.example.com.csr \ -subj "/C=US/ST=State/L=City/O=Organization/CN=client.example.com" \ -addext "subjectAltName=DNS:client.example.com,IP:192.0.2.2"重要Common Name (CN) and DNS must match the hostname. IP must match IP of the host.
-
Send the
/etc/pki/tls/private/client.example.com.csrfile to a Certificate Authority (CA) and request a client certificate. Store the received CA certificate and the client certificate on the host. Import the CA certificate to the systems’s truststore:
# cp ca.crt /etc/pki/ca-trust/source/anchors # update-ca-trustMove the client certificate to the
/etc/pki/tls/certs/directory:# mv client.example.com.crt /etc/pki/tls/certs/Ensure the SELinux context is correct on the private key and certificates:
# restorecon -Rv /etc/pki/tls/certs/Add the client certificate and private key to the
[authenticate.client]section in the/etc/tlshd.conffile:x509.certificate= /etc/pki/tls/certs/client.example.com.crt x509.private_key= /etc/pki/tls/private/client.example.com.keyLeave the
x509.truststoreparameter unset.Enable and start the
tlshdservice:# systemctl enable --now tlshd.serviceMount an NFS share by using TLS encryption:
# mount -o xprtsec=mtls server.example.com:/nfs/projects/ /mnt/
Verification
Verify that the client successfully mounted NFS share with TLS support:
# journalctl -u tlshd … Apr 01 08:37:56 client.example.com tlshd[10688]: Handshake with server.example.com (192.0.2.1) was successful