The encryption in transit feature of Apsara File Storage NAS protects the data transmitted between your Elastic Compute Service (ECS) instances and NAS file systems against interception or tampering by using the Transport Layer Security (TLS) protocol. This topic describes how to enable encryption in transit when you use the NAS client to mount a file system.

How it works

The NAS client defines a type of network file system (NFS) called alinas. The NFS is compatible with the standard form of the mount command. If you specify the tls parameter when you mount an alinas NFS on an ECS instance, the NAS client starts a process named stunnel. The process forwards and encrypts access requests from the ECS instance to the NAS server. The process also triggers a backend process named aliyun-alinas-mount-watchdog to ensure the availability of the stunnel process.

Usage notes

Important If an NFS file system is already mounted to a directory (for example, /mnt) of the ECS instance when you enable encryption in transit, you must unmount the NFS file system and then mount the NFS file system again. For more information about how to unmount an NFS file system, see Unmount a file system from a Linux ECS instance.
  • The encryption in transit feature applies only to General-purpose NFS file systems.
  • Operating systems supported by the NAS client
    Operating systemOperating system version
    Alibaba Cloud LinuxAlibaba Cloud 2.1903 64-bit
    Red Hat
    • Red Hat Enterprise Linux 7.x 64-bit
    • Red Hat Enterprise Linux 8.x 64-bit
    • CentOS 7.x 64-bit
    • CentOS 8.x 64-bit
    • Ubuntu 16.04 64-bit
    • Ubuntu 18.04 64-bit
    • Ubuntu 20.04 64-bit
    • Debian 9.x 64-bit
    • Debian 10.x 64-bit
  • Performance loss

    Compared with a file system for which you disable encryption in transit, a file system for which you enable encryption in transit can be accessed with a 10% more latency and 10% less IOPS.

  • Usage notes of the NAS client
    • The NAS client uses the stunnel process as an TLS encryption wrapper. For high-throughput applications, the stunnel process consumes a large number of CPU resources to perform encryption and decryption. In extreme cases, each mount operation consumes the capacity of an entire core.
    • The NAS client requires a third-party certificate to encrypt data in transit. The certificate must be updated at regular intervals. NAS sends update notifications to you one month in advance by using emails and internal messages. After you receive these notifications, you must update the aliyun-alinas-utils tool at your earliest opportunity. Otherwise, the mounted NAS file system stops responding after the certificate expires.
    • If you use the NAS client, the /etc/hosts file of the ECS instances within your Alibaba Cloud account is modified. Therefore, when you mount a file system, the new mount target is written to the /etc/hosts file. When you unmount the file system, the mount target is deleted from the file.
    • When the NAS client uses the stunnel process as an TLS encryption wrapper, the stunnel process listens on an IP address from to on port 12049. You must make sure that IP addresses and port are available.

      You can run the SS -ant | grep -w 12049 command to check whether the port is occupied. If no value is returned, the port is available. If the port is occupied, modify the configuration file. For more information about how to modify the configuration file of the NAS client, see Troubleshooting in this topic.

Supported regions

The encryption in transit feature is available in all regions of the Alibaba Cloud public cloud, and all regions of Alibaba Finance Cloud except China South 1 Finance.

Step 1: Download and install the NAS client

  1. Download the NAS client.
    • Alibaba Cloud Linux
    • Red Hat Enterprise Linux 7.x and CentOS 7.x
    • Red Hat Enterprise Linux 8.x and CentOS 8.x
    • Ubuntu and Debian
  2. Install the NAS client.
    • Alibaba Cloud Linux and CentOS
      sudo yum install aliyun-alinas-utils-*.rpm
    • Red Hat Enterprise Linux
      sudo yum --disablerepo=rhui-rhel-7-server-rhui-extras-debug-rpms install aliyun-alinas-utils-*.rpm
    • Ubuntu and Debian
      sudo apt update
      sudo dpkg -i aliyun-alinas-utils-*.deb
      sudo apt-get install -f
      sudo dpkg -i aliyun-alinas-utils-*.deb
  3. Check whether the NAS client is installed.
    which mount.alinas
    The information in the following figure indicates a successful installation. Installation result

Step 2: Mount a NFS file system with encryption in transit enabled

  1. Mount the NFS file system.
    • NFSv3 protocol
      sudo mount -t alinas -o tls,vers=3 /mnt
    • NFSv4.0 protocol
      sudo mount -t alinas -o tls,vers=4.0 /mnt
    The following table lists the parameters that are used in the mount command.
    Note The NAS client tool uses the parameters that can ensure the optimal performance when it mounts the file system. Therefore, you do not have to set the parameters by yourself. For more information, see the mount parameters described in Mount an NFS file system on a Linux ECS instance.
    ParameterDescription /mntThe command syntax is <Domain name of a mount target>:<Name of a shared directory><Path of a mount directory>. You must replace the domain name, directory name, and directory path with their actual values.
    • Domain name of a mount target: To view the domain name, perform the following steps: Log on to the NAS console. In the left-side navigation pane, click File System List. On the page that appears, find the file system that you want to manage and click Manage in the Actions column. On the page that appears, click Mount Targets. On the tab that appears, view the domain name of the mount target. For more information, see View the endpoint of a mount target.
    • Name of a shared directory: specifies the root directory / or a subdirectory. If you specify a subdirectory such as /share, make sure that the subdirectory exists in the NAS file system.
    • Path of a mount directory: specifies a subdirectory such as /mnt of a Linux ECS instance. Make sure that the subdirectory exists in the local file system.
    versThe protocol version of the file system.
    • vers=3: Uses NFSv3 to mount the file system.
    • vers=4: Uses NFSv4 to mount the file system.
    tlsEnables TLS.
  2. Run the mount -l command to view the mount result.
    If an output similar to the following example appears, the mount is successful. Mount result

    After the file system is mounted, you can run the df -h command to view the capacity of the file system.

  3. Optional:Enable automatic mount at startup.

    When you restart the ECS instance to which the file system is mounted, the information about all the mounted file systems may be lost. To prevent the loss of such information, you can edit the /etc/fstab configuration file in the Linux ECS instance to enable automatic mount of NFS file system at startup.

    1. Open the /etc/fstab configuration file. /mnt alinas _netdev,tls 0 0
      For more information, see Mount an NFS file system on a Linux ECS instance. The following table describes the parameters that are not included in the preceding table.
      _netdevPrevents automatic mounting before the network is connected.
      0 (the first value after tls)Specifies whether to back up the file system by running the dump command. If a value is not zero, it indicates that a file system is backed up. For a NAS file system, the default value is 0.
      0 (the second value after tls)The order in which the fsck command checks file systems at startup. For a NAS file system, the default value is 0. It indicates that the fsck command is not run at startup.
    2. Run the reboot command to restart the ECS instance.
      Note Before you restart the ECS instance, make sure that the manual mount is successful. Otherwise, the ECS instance may fail to restart. If the automatic mount is enabled, after the ECS instance is restarted, you can view the NAS file systems that are mounted by running the df -h command.

NAS client logs

You can locate the mount error by opening the log file of the NAS client in the /var/log/aliyun/alinas/ directory. You can also modify the parameters in the log configuration file /etc/aliyun/alinas/alinas-utils.conf to configure the NAS client log. After you modify the configuration file, run the sudo service aliyun-alinas-mount-watchdog restart command. Then, the backend watchdog is restarted.

The following table describes the parameters in the log configuration file.
logging_levelThe level of the log entry. Default value: INFO.
logging_max_bytesThe maximum size of log files. Default value: 1048576 bytes. The maximum size of a single log file is 1 MB.
logging_file_countThe maximum number of log files that are retained. Default value: 10. A maximum of 10 log files can be retained.
stunnel_debug_enabledThe debug logs of stunnel. Default value: false. When the parameter is enabled, a large amount of storage capacity is used.
stunnel_check_cert_hostnameChecks the hostname in the certificate. Default value: false.
stunnel_check_cert_validityChecks the validity of the certificate. Default value: false.


  • Issue
    When the file system is being mounted, the following error message is returned:Error message for port occupancy
  • Cause

    The IP address or port 12049 on which stunnel listens is used by other processes. As a result, the file system fails to be mounted.

  • Solution
    • Solution 1: Find and terminate the process that uses port 12049. Then, mount the file system again.
    • Solution 2: Edit the configuration file of the client tool in the /etc/aliyun/alinas/alinas-utils.conf directory. Modify the proxy_port parameter to an unused port number. Then, mount the file system again. Change the port number