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

Procedure

  1. 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.

  2. Send the /etc/pki/tls/private/client.example.com.csr file to a Certificate Authority (CA) and request a client certificate. Store the received CA certificate and the client certificate on the host.
  3. Import the CA certificate to the systems’s truststore:

    # cp ca.crt /etc/pki/ca-trust/source/anchors
    # update-ca-trust
  4. Move the client certificate to the /etc/pki/tls/certs/ directory:

    # mv client.example.com.crt /etc/pki/tls/certs/
  5. Ensure the SELinux context is correct on the private key and certificates:

    # restorecon -Rv /etc/pki/tls/certs/
  6. Add the client certificate and private key to the [authenticate.client] section in the /etc/tlshd.conf file:

    x509.certificate= /etc/pki/tls/certs/client.example.com.crt
    x509.private_key= /etc/pki/tls/private/client.example.com.key

    Leave the x509.truststore parameter unset.

  7. Enable and start the tlshd service:

    # systemctl enable --now tlshd.service
  8. Mount 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
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部