# TrueNAS: RustFS for OpenBao backups (one-time setup) Do this after the [first OpenBao setup](openbao.md#first-setup). It installs RustFS, an S3-compatible storage server, on TrueNAS and sets up HTTPS. Then it creates the bucket and upload-only user for [OpenBao's automatic backups](openbao.md#automatic-backups). OpenBao's Helm chart has a backup job that can only upload to S3. > This setup was done on TrueNAS 25.10 with app catalog version `1.1.47` (RustFS `1.0.7`). These were tested on a temporary bucket: upload-only access, object lock (even the admin can't delete a locked version), uploads from OpenBao's backup image, and restoring RustFS data from a ZFS snapshot. **Not tested yet:** automatic cleanup of old backups, and certificate renewal. Menu names can differ between TrueNAS versions. ## Placeholders | Placeholder | Meaning | |---|---| | `` | Your domain, with DNS managed by Cloudflare | | `` | TrueNAS's fixed local IP | | `` | The TrueNAS pool that stores the backups | | `` | An email address you own | | `` | Your timezone | ## Rules - **Don't expose RustFS to the internet.** Don't forward its ports in pfSense, and don't create an A, AAAA or CNAME record for `rustfs.` in Cloudflare. - **Never give the cluster admin access to TrueNAS or RustFS.** Don't use the RustFS admin login for backups. - **Don't share the RustFS dataset over NFS or SMB**, and don't add it to other apps. Anyone who can write to its files can bypass RustFS's access rules and object lock. - Save passwords and tokens in Bitwarden. Never put them in Git, tickets, chats or commands. - **Don't use the MinIO app.** TrueNAS has removed it from its catalog, and the open-source version no longer gets updates. ## 1. Check TrueNAS 1. Use a stable TrueNAS release, not a beta or release candidate. The current app catalog needs 24.10 or newer. If you need to upgrade, [back up the config with its secret seed](https://www.truenas.com/docs/scale/25.10/scaletutorials/systemsettings/updatescale/) and follow the [official upgrade path](https://www.truenas.com/docs/truenasupgrades/). **Don't upgrade the ZFS pools at the same time.** Older TrueNAS versions may not be able to open them afterwards. 2. Check that the pools are healthy and the existing NFS and SMB shares work. 3. Go to **Apps > Configuration > Settings**. Under **Preferred Trains**, select **community** and keep **stable** selected. Save. 4. Go to **Apps > Discover Apps**, refresh the catalog and search for **RustFS**. Don't install it yet. **Checkpoint:** RustFS is listed, and its **app version** is `1.0.7` or newer. This is different from the catalog version, such as `1.1.47`. Check the [RustFS security advisories](https://github.com/rustfs/rustfs/security/advisories) before installing or updating it. ## 2. Create the dataset Don't use the dataset for the [`truenas-nfs` share](truenas-nfs.md), or create this one inside it. The k3s nodes have root access to that share, so a compromised node could change or delete the backups directly. 1. Go to **Datasets**, select the top level of ``, and click **Add Dataset**: | Setting | Value | |---|---| | Name | `rustfs` | | Dataset Preset | **Apps** | | Quota | None for now. Set one once you know how much space the backups and ZFS snapshots need. New backups fail if it's too low. | The path is `/mnt//rustfs`. 2. Select `rustfs` and click **Edit** under **Permissions**. RustFS runs as TrueNAS's built-in `apps` user and group, both with ID `568`. Check that `apps` has **Modify** access. If it doesn't, add this NFSv4 ACL entry: | Setting | Value | |---|---| | Who | **User** | | User | `apps` | | Type | **Allow** | | Permissions | **Modify** | | Flags | Keep the default inheritance setting, so new files and folders get the same access | Don't add access for `everyone@`, use `777`, or change permissions on the top level of the pool. If the dataset is new and empty, you don't need to apply the ACL recursively. If TrueNAS shows **Read / Write / Execute** instead, stop. The dataset uses a different permission type. **Checkpoint:** `apps` has **Modify** access. No NFS or SMB share includes `/mnt//rustfs`, not even a share for a parent folder such as `/mnt/`. This dataset **doesn't protect the backups if the whole pool fails**. ## 3. Add the pfSense DNS entry Go to **Services > DNS Resolver > General Settings**. Under **Host Overrides**, click **Add**: | Setting | Value | |---|---| | Host | `rustfs` | | Domain | `` | | IP Address | ``, **not** Traefik's IP | | Description | `RustFS on TrueNAS` | Save, then click **Apply Changes**. Check it from your workstation: ```bash getent ahostsv4 rustfs. ``` **Checkpoint:** it only shows ``. ## 4. Create the Cloudflare token Let's Encrypt uses a temporary DNS TXT record to check that you own the domain. TrueNAS adds it through Cloudflare, so RustFS doesn't need to be available from the internet. The hostname will appear in public certificate logs. Use a separate token from pfSense and cert-manager. That way, you can replace or revoke it without breaking their certificates. 1. In Cloudflare, go to **My Profile > API Tokens > Create Token**. Use the **Edit zone DNS** template or create a custom token: | Setting | Value | |---|---| | Token name | `truenas-acme` | | Permission 1 | `Zone` → `DNS` → `Edit` | | Permission 2 | `Zone` → `Zone` → `Read` | | Zone Resources | `Include` → `Specific zone` → `` | | Client IP Address Filtering | Empty. A filter can stop renewals if your public IP changes. | | TTL | Empty. The certificate can't renew once the token expires. | If you can't limit the token to ``, stop. Don't choose **All zones** to get around this. 2. Check the summary, then create the token. Save it in Bitwarden, because Cloudflare **only shows it once**. Don't run Cloudflare's test command with the real token in it, because it could be saved in your shell history. ## 5. Create the certificate in TrueNAS 1. Go to **Credentials > Certificates**. Under **ACME DNS-Authenticators**, click **Add**: | Setting | Value | |---|---| | Name | `cloudflare` | | Authenticator | `cloudflare` | | Cloudflare Email | Empty | | API Key | Empty. This is for the global API key. | | API Token | The `truenas-acme` token | 2. Under **Certificate Signing Requests**, click **Add**: | Setting | Value | |---|---| | Name | `rustfs`. This is only a label in TrueNAS. | | Type | **Certificate Signing Request** | | Profile | **HTTPS RSA Certificate** | | Key Type / Key Length | **RSA** / `2048` | | Digest Algorithm | **SHA256** | | Common Name | `rustfs.` | | Subject Alternative Name (SAN) | `rustfs.` | | Email | `` | | Country, state, city and organisation | Fill in the required fields. Let's Encrypt doesn't include them in the certificate. | | Basic Constraints | **Critical Extension** only. Don't select **CA**, because this certificate doesn't need to sign others. | | Extended Key Usage | `SERVER_AUTH` only, with **Critical Extension** selected. `CLIENT_AUTH` isn't needed. | | Key Usage | **Critical Extension**, **Digital Signature**, **Key Encipherment** and **Key Agreement**. Key Agreement isn't needed, but it's part of the tested setup. | Enter only the hostname in **Common Name** and **SAN**, without `https://` or a port. Both must be **exactly the same**. Check the summary, then save. 3. Click the wrench icon next to the `rustfs` request to create an ACME certificate: | Setting | Value | |---|---| | Identifier | `rustfs-le` | | ACME Server Directory URI | Let's Encrypt **production**, not staging | | Terms of Service | Accept | | Renew Certificate Days | Default | | Authenticator for `rustfs.` | `cloudflare` | It can take a few minutes. If it fails, check the error before trying again, because Let's Encrypt has rate limits. **Checkpoint:** `rustfs-le` is listed under **Certificates**, with Let's Encrypt as the issuer. ## 6. Install RustFS Go to **Apps > Discover Apps**, select **RustFS** and click **Install**. Enter these settings: | Section | Setting | Value | |---|---|---| | General | Application Name | `rustfs` | | General | Version | `1.1.47`, or a newer version you've checked. This is the catalog version. | | RustFS | Timezone | `` | | RustFS | Deployment Mode | **SNSD (Single Node Single Disk)**. RustFS uses one data location, so only the ZFS pool can protect against disk failures. | | RustFS | Account Name | `rustfs-admin` | | RustFS | Secret Key | A unique password with 40 random letters and numbers, saved in Bitwarden. Leaving out symbols such as `$` avoids possible config problems. | | RustFS | Additional Environment Variables | None | | User and Group | User ID / Group ID | `568` / `568` | | Network | API Port | **Publish port on the host for external access**, port `30292` | | Network | WebUI Port | **Publish port on the host for external access**, port `30293` | | Network | Host IPs (both ports) | None. RustFS listens on all TrueNAS addresses. | | Network | Networks | None | | Network | Host Network | Off | | Network | Certificate | `rustfs-le`. Don't choose **No Certificate** or the default TrueNAS certificate. | | Storage | Data Disks | Keep one data disk and change its type from **ixVolume** to **Host Path** | | Storage | Enable ACL | Off. The permissions were set in [step 2](#2-create-the-dataset). | | Storage | Host Path | `/mnt//rustfs` | | Storage | Additional Storage | None | | Labels | Labels | None | | Resources | CPUs / Memory | `2` / `4096` MB. These are limits, not reserved resources. | Before you click **Install**, check that the type is **Host Path** and the certificate is `rustfs-le`. **If you've already installed RustFS with an ixVolume, don't just change the path.** Its data, settings and users may not move with it. pfSense usually can't block devices on the same subnet from reaching TrueNAS. "External access" here means access from outside the app's container. It doesn't expose the ports to the internet unless you also forward them. **Checkpoint:** the app is **Running**. If it isn't, check its logs for permission or certificate errors. Don't use `777` to fix permission errors. ## 7. Check RustFS 1. Check both ports from your workstation: ```bash curl -sS -o /dev/null -w 'S3: HTTP %{http_code}, TLS check %{ssl_verify_result}\n' https://rustfs.:30292/ curl -sS -o /dev/null -w 'Console: HTTP %{http_code}, TLS check %{ssl_verify_result}\n' https://rustfs.:30293/rustfs/console/ ``` **Checkpoint:** S3 shows `HTTP 403`, which is expected without a login. The console shows `HTTP 200`. Both show `TLS check 0`, and there are no `curl` errors. 2. Check the certificate: ```bash openssl s_client -connect rustfs.:30292 -servername rustfs. /dev/null \ | openssl x509 -noout -subject -issuer -enddate -ext subjectAltName ``` **Checkpoint:** the issuer is Let's Encrypt, and the SAN is `rustfs.`. Note the expiry date. 3. Open `https://rustfs.:30293/rustfs/console/` and log in as `rustfs-admin` with the Secret Key. **Checkpoint:** the login works, and there's no certificate warning. Bookmark this link. After the certificate renews, run step 2 again. If it still shows the old expiry date, RustFS hasn't loaded the new certificate. Restart the app, then check again. ## 8. Create the backup bucket and user Object lock can only be turned on when a bucket is created. OpenBao's backup job uploads with an upload-only key, so it can't read, list, delete or unlock backups. 1. On your workstation, set up the AWS CLI in Docker. Paste the RustFS admin login when prompted. Nothing appears as you paste. ```bash mkdir -p ~/rustfs && cd ~/rustfs EP=https://rustfs.:30292 s3() { docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_REGION=us-east-1 -e AWS_ENDPOINT_URL="$EP" -v "$PWD:/aws:Z" docker.io/amazon/aws-cli:latest "$@"; } read -rsp 'RustFS admin account name: ' A_ID; echo read -rsp 'RustFS admin secret key: ' A_KEY; echo admin() ( export AWS_ACCESS_KEY_ID="$A_ID" AWS_SECRET_ACCESS_KEY="$A_KEY"; s3 "$@" ) ``` The functions and keys only exist in this terminal. In a new terminal, run this step again. RustFS expects the region `us-east-1`. 2. Create the bucket with a default lock of 30 days: ```bash admin s3api create-bucket --bucket openbao-backups --object-lock-enabled-for-bucket admin s3api put-object-lock-configuration --bucket openbao-backups --object-lock-configuration '{"ObjectLockEnabled":"Enabled","Rule":{"DefaultRetention":{"Mode":"GOVERNANCE","Days":30}}}' admin s3api get-bucket-versioning --bucket openbao-backups admin s3api get-object-lock-configuration --bucket openbao-backups ``` **Checkpoint:** versioning shows `Enabled`, and the lock shows `GOVERNANCE` with `30` days. `GOVERNANCE` means the backup user can't remove the lock. Unlike `COMPLIANCE`, an admin can still remove it to fix a mistake. 3. In the RustFS console, go to **Identity > Policies** and create `openbao-backups-upload`: ```json {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:PutObject"],"Resource":["arn:aws:s3:::openbao-backups/*"]}]} ``` 4. Go to **Identity > Users** and create the backup user: | Setting | Value | |---|---| | Name / access key | `openbao-snapshot` | | Secret key | 40 random letters and numbers, saved in Bitwarden | | Groups | **None.** A group would add its own policies. | | Policies | **Only** `openbao-backups-upload`. Don't use built-in policies such as `writeonly` or `readwrite`, because they cover every bucket. | 5. Check the user's access: ```bash read -rsp 'openbao-snapshot secret key: ' P_KEY; echo prod() ( export AWS_ACCESS_KEY_ID=openbao-snapshot AWS_SECRET_ACCESS_KEY="$P_KEY"; s3 "$@" ) echo check > check.txt; prod s3api put-object --bucket openbao-backups --key setup-check.txt --body check.txt prod s3api list-objects-v2 --bucket openbao-backups prod s3api delete-object --bucket openbao-backups --key setup-check.txt ``` **Checkpoint:** the upload works, and listing and deleting both fail with `AccessDenied`. The test file stays locked for 30 days. 6. Protect the RustFS data with ZFS snapshots. Go to **Data Protection > Periodic Snapshot Tasks** and check that a task covers `/rustfs`, either directly or through a recursive task on its parent. Keep snapshots for at least 30 days. They protect backups if someone misuses the RustFS admin login. They don't protect against losing the pool. 7. Delete old backups automatically. The lock from step 2 only stops deletion for 30 days; it doesn't delete anything. Old snapshots also contain old secrets, so don't keep them forever. The RustFS console has no lifecycle screen, so set the rule with the AWS CLI: ```bash cat > lifecycle.json <<'EOF' {"Rules":[ {"ID":"expire-after-31-days","Status":"Enabled","Filter":{"Prefix":""}, "Expiration":{"Days":31}, "NoncurrentVersionExpiration":{"NoncurrentDays":1}}, {"ID":"remove-delete-markers","Status":"Enabled","Filter":{"Prefix":""}, "Expiration":{"ExpiredObjectDeleteMarker":true}} ]} EOF admin s3api put-bucket-lifecycle-configuration --bucket openbao-backups --lifecycle-configuration file://lifecycle.json admin s3api get-bucket-lifecycle-configuration --bucket openbao-backups ``` **Checkpoint:** both rules show `"Status": "Enabled"`. The bucket is versioned, so the rule needs three parts. After 31 days, when the lock has ended, a backup gets a delete marker. One day later, its data is deleted. Then the leftover delete marker is removed. Each backup is kept for about 32 days. Lifecycle rules respect the lock, so a backup can't be deleted early even if the rule is wrong. About 32 days after the first backup, check that cleanup works. The oldest date shown should be at most about 32 days ago: ```bash admin s3api list-object-versions --bucket openbao-backups --query 'Versions[].LastModified' --output text | tr '\t' '\n' | sort | head -3 ``` ## Troubleshooting | Problem | What to do | |---|---| | TrueNAS links to `0.0.0.0` | This means RustFS listens on all addresses. It isn't an address you can open. Use the full console link from step 7, and leave **Host IPs** empty. | | An `http://` link doesn't open | RustFS uses HTTPS on both ports. Use `https://`. | | `https://rustfs.:30293/` shows `403` | Add the console path: `/rustfs/console/` | | The browser shows a certificate warning | Use the hostname, not the IP. Then check that the app uses `rustfs-le` and that the SAN is correct. | | The hostname doesn't work | Check the pfSense host override. If you've just added it, close and reopen the browser. You don't need to reinstall RustFS. | | The certificate request fails | Check that **Common Name** and **SAN** are the same full hostname. Then check the Cloudflare token's permissions and domain. | | `s3cmd` fails with `invalid credential region: "US"` | Add `--region=us-east-1`. The backup job already sets it. | | Podman fails with `mkdir /run/user/: permission denied` | Podman may have saved an old user ID. Use Docker instead, or fix Podman separately. | ## References - [TrueNAS: RustFS app](https://apps.truenas.com/catalog/rustfs_community/) - [TrueNAS: app setup](https://apps.truenas.com/getting-started/initial-setup) - [RustFS: TLS](https://docs.rustfs.com/en/integration/tls-configured) - [OpenBao: snapshot agent for Kubernetes](https://github.com/openbao/openbao-snapshot-agent/tree/main/kubernetes)