2.12. Configuring an NFS server with TLS support
Without the RPCSEC_GSS protocol, NFS traffic is unencrypted by default. Starting with Red Hat Enterprise Linux 10, it is possible to configure NFS with TLS, allowing NFS traffic to be encrypted by default.
Prerequisites
- You have configured an NFSv4 server. For instructions, see Configuring an NFSv4-only server.
- You have a Certificate Authority (CA) certificate.
-
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/server.example.com.key \ -out /etc/pki/tls/private/server.example.com.csr \ -subj "/C=US/ST=State/L=City/O=Organization/CN=server.example.com" \ -addext "subjectAltName=DNS:server.example.com,IP:192.0.2.1"重要Common Name (CN) and DNS must match the hostname. IP must match IP of the host.
-
Send the
/etc/pki/tls/private/server.example.com.csrfile to a CA and request a server certificate. Store the received CA certificate and the server 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 server certificate to the
/etc/pki/tls/certs/directory:# mv server.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 server certificate and private key to the
[authenticate.server]section in the/etc/tlshd.conffile:x509.certificate= /etc/pki/tls/certs/server.example.com.crt x509.private_key= /etc/pki/tls/private/server.example.com.keyLeave the
x509.truststoreparameter unset.Enable and start the
tlshdservice:# systemctl enable --now tlshd.service