---
title: "Encrypt with TLS"
description: "Mount over RPC-with-TLS, set up a client to trust the EZGH Cloud Root CA, and require TLS for a file system."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Encrypt with TLS

Files serves NFS over TLS ([RFC 9289](https://www.rfc-editor.org/rfc/rfc9289), RPC-with-TLS), so the
connection from each client is encrypted and the client checks it's talking to Files. Clients mount
with `xprtsec=tls`, by the mount target's `hostname`:

```sh
sudo mount -t nfs4 -o nfsvers=4.1,xprtsec=tls,hard,noresvport,rsize=1048576,wsize=1048576,timeo=600,retrans=2 \
  dfc6fl64neocrciu5ogrl4kccq.fs.us-west-1.ezghcompute.com:/fsy_4k2m9x0a7qpe /mnt/shared
```

Every mount target's certificate is for `*.fs.us-west-1.ezghcompute.com`, issued by EZGH Cloud
Intermediate CA 1 under the **EZGH Cloud Root CA**, the same root that
[database connections](/databases/connecting) use. A TLS mount needs the name, not the address, so
that the certificate matches.

## Set up a client

A TLS mount needs `ktls-utils`, whose `tlshd` service does the TLS handshake for the kernel, and
`tlshd` trusting the EZGH Cloud Root CA. The optimized images below are ready. On other Ubuntu 26.04,
Debian 13 and Rocky Linux 9 and 10 images, set it up as in [Other images](#other-images); on Ubuntu
24.04, as in [Ubuntu 24.04](#ubuntu-2404).

### Optimized images

These [optimized images](/compute/optimized-images) are ready: they have `ktls-utils`, run `tlshd`,
and `tlshd` trusts the EZGH Cloud Root CA.

- `linux/ezgh-ubuntu:26.04`
- `linux/ezgh-debian:13`
- `linux/ezgh-rocky:10`
- `linux/ezgh-rocky:9`

TLS mounts don't work out of the box on Ubuntu 24.04, `linux/ezgh-ubuntu:24.04` included; mounts
without TLS do. [Ubuntu 24.04](#ubuntu-2404) has the steps that make TLS mounts work.

### Download the root

```sh
curl -fsSLO https://get.ezghcloud.com/ca/ezgh-cloud-root-ca.pem
echo "f15ac8b9ef679cbfe0d2ce3d438d3190b4981dda285301c316506333cb2cf7ee  ezgh-cloud-root-ca.pem" | sha256sum -c -
```

The second command checks the file's SHA-256 and prints `ezgh-cloud-root-ca.pem: OK`. The
certificate's SHA-256 fingerprint is
`87:75:C5:29:3E:6C:10:1F:38:43:0C:51:97:CD:60:CF:BA:FA:6B:AD:74:20:E5:9C:2C:44:C7:34:93:03:61:47`.

### Other images

On other Ubuntu 26.04, Debian 13 and Rocky Linux images, give the root to `tlshd` alone. This
replaces `tlshd`'s config; if you've changed yours, set `x509.truststore` under
`[authenticate.client]` instead.

### Ubuntu 26.04

```sh
sudo apt-get install -y nfs-common ktls-utils
sudo install -D -m 0644 ezgh-cloud-root-ca.pem /etc/tlshd/ezgh-cloud-root-ca.pem
sudo tee /etc/tlshd/config >/dev/null <<'EOF'
[debug]
loglevel=0
tls=0
nl=0

[authenticate]

[authenticate.client]
x509.truststore=/etc/tlshd/ezgh-cloud-root-ca.pem

[authenticate.server]
EOF
sudo systemctl enable tlshd
sudo systemctl restart tlshd
```
### Debian 13

```sh
sudo apt-get install -y nfs-common ktls-utils
sudo install -D -m 0644 ezgh-cloud-root-ca.pem /etc/tlshd/ezgh-cloud-root-ca.pem
sudo tee /etc/tlshd.conf >/dev/null <<'EOF'
[debug]
loglevel=0
tls=0
nl=0

[authenticate]

[authenticate.client]
x509.truststore=/etc/tlshd/ezgh-cloud-root-ca.pem

[authenticate.server]
EOF
sudo systemctl enable tlshd
sudo systemctl restart tlshd
```
### Rocky Linux

```sh
sudo dnf install -y nfs-utils ktls-utils
sudo install -D -m 0644 ezgh-cloud-root-ca.pem /etc/tlshd/ezgh-cloud-root-ca.pem
sudo tee /etc/tlshd.conf >/dev/null <<'EOF'
[debug]
loglevel=0
tls=0
nl=0

[authenticate]

[authenticate.client]
x509.truststore=/etc/tlshd/ezgh-cloud-root-ca.pem

[authenticate.server]
EOF
sudo systemctl enable tlshd
sudo systemctl restart tlshd
```

### Ubuntu 24.04

On Ubuntu 24.04, `linux/ezgh-ubuntu:24.04` and `linux/ubuntu:24.04` alike, TLS mounts work once
you've run these steps. Its `tlshd` trusts only the system trust store, so the root goes there. Every
program on the instance then trusts the EZGH Cloud Root CA.

```sh
sudo apt-get install -y nfs-common ktls-utils
sudo cp ezgh-cloud-root-ca.pem /usr/local/share/ca-certificates/ezgh-cloud-root-ca.crt
sudo update-ca-certificates
sudo systemctl enable --now tlshd
```

Then mount with `xprtsec=tls`.

In user data, run the same commands under `runcmd` before the mount.

## Instances without internet access

The `hostname` resolves in public DNS. An instance with no route to the internet can't resolve it,
and can't fetch the CA root: copy the root onto the instance another way, and add the mount target to
`/etc/hosts`:

```txt title="/etc/hosts"
10.0.1.25 dfc6fl64neocrciu5ogrl4kccq.fs.us-west-1.ezghcompute.com
```

A mount target's address and name never change.

## Require TLS

Set `requireTls` on a file system and it accepts only TLS mounts, through every mount target and
access point. Set it at create, or later with
[UpdateFileSystem](/files-api/UpdateFileSystem/):

```sh
curl -X PATCH -H "Authorization: Bearer $EZGH_API_KEY" -H "Content-Type: application/json" \
  -d '{"requireTls": true}' \
  "https://files-api.ezghcloud.com/v1/organizations/$ORG_ID/projects/$PROJECT_ID/file-systems/fsy_4k2m9x0a7qpe"
```

Turn it on once every client mounts with `xprtsec=tls`.

Source: https://docs.ezghcloud.com/files/tls/index.mdx
