Unlock encrypted ZFS datasets on TrueNAS via the API
Project description
TrueNAS Unlock
Unlock encrypted ZFS datasets on TrueNAS via the API.
Install
# With uv (recommended)
uv tool install truenas-unlock
# With pip
pip install truenas-unlock
Setup
Create ~/.config/truenas-unlock/config.yaml:
host: 192.168.1.214:443
api_key: ~/.secrets/truenas-api-key # file path or literal
skip_cert_verify: true
# secrets: auto # auto (default) | files | inline
datasets:
tank/syncthing: ~/.secrets/syncthing-key # reads from file
tank/photos: my-literal-passphrase # used as-is (no such file)
The secrets mode controls how values are interpreted:
- auto (default): if file exists, read from it; otherwise use as literal
- files: always treat values as file paths
- inline: always treat values as literal secrets
Usage
# Run once
truenas-unlock
# Run as daemon (every 10 seconds)
truenas-unlock --daemon
# Custom interval
truenas-unlock --daemon --interval 30
# Dry run
truenas-unlock --dry-run
CLI
truenas-unlock --help
Usage: truenas-unlock [OPTIONS] COMMAND [ARGS]...
Unlock TrueNAS ZFS datasets
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --config -c PATH Config file path │
│ --dry-run -n Show what would be done │
│ --daemon -d Run continuously │
│ --interval -i INTEGER Seconds between runs [default: 10] │
│ --help -h Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ service Manage system service │
╰──────────────────────────────────────────────────────────────────────────────╯
Running as a Service
Requires uv to be installed. Auto-detects Linux (systemd) or macOS (launchd):
# Install and start
truenas-unlock service install
# Check status
truenas-unlock service status
# View logs (follows by default)
truenas-unlock service logs
# Uninstall
truenas-unlock service uninstall
Development
# Clone and install
git clone https://github.com/basnijholt/truenas-unlock
cd truenas-unlock
uv sync --dev
# Run tests
uv run pytest
# Run lints
uv run ruff check .
uv run mypy truenas_unlock.py
Credits
Inspired by ThorpeJosh/truenas-unlock.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file truenas_unlock-1.2.0.tar.gz.
File metadata
- Download URL: truenas_unlock-1.2.0.tar.gz
- Upload date:
- Size: 56.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ac4bb08c9ce7a5bcb45be8da85e93ebf2a1b66d65a8a27723319e4e41143a82
|
|
| MD5 |
b62de136ecccdbba12e06fca078ccb61
|
|
| BLAKE2b-256 |
fc7d4830c320f6dbe5431ad42ed6964f0a8e53440bd7dc42b0e4bc94a6e0a49b
|
Provenance
The following attestation bundles were made for truenas_unlock-1.2.0.tar.gz:
Publisher:
release.yml on basnijholt/truenas-unlock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
truenas_unlock-1.2.0.tar.gz -
Subject digest:
6ac4bb08c9ce7a5bcb45be8da85e93ebf2a1b66d65a8a27723319e4e41143a82 - Sigstore transparency entry: 762750020
- Sigstore integration time:
-
Permalink:
basnijholt/truenas-unlock@c53c333c05af1f7da6cc86a0061912c1f0fd076b -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/basnijholt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c53c333c05af1f7da6cc86a0061912c1f0fd076b -
Trigger Event:
release
-
Statement type:
File details
Details for the file truenas_unlock-1.2.0-py3-none-any.whl.
File metadata
- Download URL: truenas_unlock-1.2.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d326626c14b1f052aeeff31cda8f6329c86498baa8ee8f55215ca0dc583c73d
|
|
| MD5 |
00a0ced0571f06a4f118be2121f60566
|
|
| BLAKE2b-256 |
a48e222bedc9880fe499da42b606bf96e5f3009279c9a27eb6eef37013a0abd0
|
Provenance
The following attestation bundles were made for truenas_unlock-1.2.0-py3-none-any.whl:
Publisher:
release.yml on basnijholt/truenas-unlock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
truenas_unlock-1.2.0-py3-none-any.whl -
Subject digest:
6d326626c14b1f052aeeff31cda8f6329c86498baa8ee8f55215ca0dc583c73d - Sigstore transparency entry: 762750024
- Sigstore integration time:
-
Permalink:
basnijholt/truenas-unlock@c53c333c05af1f7da6cc86a0061912c1f0fd076b -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/basnijholt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c53c333c05af1f7da6cc86a0061912c1f0fd076b -
Trigger Event:
release
-
Statement type: