Skip to main content

Unlock encrypted ZFS datasets on TrueNAS via the API

Project description

TrueNAS Unlock

PyPI Python Tests License

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 ───────────────────────────────────────────────────────────────────╮
│ lock      Lock all configured datasets.                                      │
│ 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

truenas_unlock-1.2.1.tar.gz (56.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

truenas_unlock-1.2.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file truenas_unlock-1.2.1.tar.gz.

File metadata

  • Download URL: truenas_unlock-1.2.1.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

Hashes for truenas_unlock-1.2.1.tar.gz
Algorithm Hash digest
SHA256 26db2e56a3e8a00065fc6e9e93705cb973bd04389e6197eea590ce147a2376fd
MD5 df66309c860d9b46c53d90981af091e5
BLAKE2b-256 e2bb524634b3abc6738f2024f5166e45c052bbe7c111b5a3c4fd4996c3025555

See more details on using hashes here.

Provenance

The following attestation bundles were made for truenas_unlock-1.2.1.tar.gz:

Publisher: release.yml on basnijholt/truenas-unlock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file truenas_unlock-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: truenas_unlock-1.2.1-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

Hashes for truenas_unlock-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e936b99e0c554ddbfe7aa0667e6509f54d2b6c4747e37cbc3caadd23fc3ba56b
MD5 6c6f1b492c239899dfe2ad2d1f00f680
BLAKE2b-256 57126708426d8941962b75f9fd4b332612fd255c96c2387124dd5bbc6c81f3a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for truenas_unlock-1.2.1-py3-none-any.whl:

Publisher: release.yml on basnijholt/truenas-unlock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page