LockNessie provides a client and server pair for authentication to Nessie with OpenID.
Project description
Lock Nessie
Easily integrate OpenID authentication and authorization into your Apache Nessie and Iceberg projects.
Lock Nessie is a drop-in tool that handles OpenID RBAC for you, so you don't have to roll your own. It works for both interactive users (scripts, Jupyter notebooks) and service accounts (ETL, headless/daemon jobs), making it simple to get and refresh tokens for your Nessie metadata server.
Features
- Drop-in OpenID Auth for Nessie/Iceberg: No need to implement RBAC yourself.
- CLI and Python Module: Use from the command line or directly in your code.
- Supports User and Daemon Auth: Interactive browser login or headless service account flows.
- Easy Configuration: One-time setup, then use everywhere.
Installation
You can install Lock Nessie using either pip or uv:
# With pip
pip install locknessie[microsoft]
# Or with uv (faster alternative to pip)
uv pip install locknessie[microsoft]
# For other providers in the future
# pip install locknessie[keycloak]
# uv pip install locknessie[keycloak]
Quickstart
1. Configure Lock Nessie
Run the following to set up your config file (by default at ~/.locknessie/config.json):
locknessie config init
You'll be prompted for your OpenID provider and credentials (e.g., Microsoft client ID, secret & tenant for daemon auth).
You can update settings later if needed:
locknessie config set <key> <value>
or by editing the file directly.
2. Get a Token (CLI)
Get a valid OpenID bearer token for your Nessie server:
locknessie token show
- The first time, you'll be prompted to log in via browser (for user auth).
- For daemon/service accounts, set up your secret and tenant during config.
This is all the setup you need. The refresh token is stored locally, and the cycle can now run as long as the provider's refresh token is valid. When the refresh token expires you will be prompted to log in via browser again.
[!Note] If you are running locknessie in a container, the url for the browser login will be printed into the container logs. Make sure the auth_callback_port is exposed or locknessie will not be able to complete the auth flow and log you in.
3. Use in Python Scripts
from locknessie.main import LockNessie
# Get a valid token (auto-refreshes as needed)
token = LockNessie().get_token()
# Use with your Nessie/Iceberg client
from pyiceberg.catalog import load_catalog
catalog = load_catalog(
"nessie",
uri="https://your-nessie-instance.com/iceberg/main/",
token=token
)
4. Headless/Daemon Auth
To use Lock Nessie in headless or daemon mode (for service accounts, ETL jobs, CI/CD, etc.), you must provide an OpenID secret from your authentication provider (such as Microsoft or Keycloak). This secret is required for non-interactive authentication and can be set in any of the following ways:
- CLI: During
locknessie config initor withlocknessie config set openid_secret <your-secret> - Config file: Add
"openid_secret": "<your-secret>"to your config JSON - Environment variable: Set
LOCKNESSIE_OPENID_SECRET=<your-secret>
You will also need to provide any other required settings for your provider (e.g., LOCKNESSIE_OPENID_TENANT for Microsoft).
Once configured, you can use the CLI or Python module as shown above, and Lock Nessie will use the daemon/service account flow to obtain tokens without requiring browser interaction.
Configuration & Environment Variables
You can set any Lock Nessie configuration value in three ways:
- CLI Argument: Pass as a command-line argument (e.g.,
--auth-callback-port 4321). - Environment Variable: Set with the
LOCKNESSIE_prefix (e.g.,LOCKNESSIE_AUTH_CALLBACK_PORT=4321). - Config File: Edit the config file directly (default:
~/.locknessie/config.json) or use the CLI tool (e.g.,locknessie config set auth_callback_port 4321).
Order of evaluation (highest priority first):
- CLI argument (e.g.,
locknessie token show --auth-callback-port 4321) - Environment variable (e.g.,
LOCKNESSIE_AUTH_CALLBACK_PORT=4321 locknessie token show) - Config file (manually edit or use
locknessie config set)
All config values can be set using any of these methods, and Lock Nessie will use the highest-priority value found.
Required for all providers:
LOCKNESSIE_OPENID_ISSUER: The OpenID provider (microsoft,keycloak)LOCKNESSIE_OPENID_CLIENT_ID: The client/application ID
Microsoft-specific:
LOCKNESSIE_OPENID_TENANT: Tenant ID (required for daemon/service auth)LOCKNESSIE_OPENID_SECRET: Application secret (required for daemon/service auth)
Keycloak (future):
LOCKNESSIE_OPENID_REALM: Keycloak realmLOCKNESSIE_OPENID_URL: Keycloak server URL
Other settings:
LOCKNESSIE_CONFIG_PATH: Path to config file (default:~/.locknessie/config.json)LOCKNESSIE_AUTH_CALLBACK_PORT: Port for browser-based auth (default: 1234)LOCKNESSIE_IMPERSONATION_PORT: Port for Vault impersonation service (default: 8200)LOCKNESSIE_AUTH_CALLBACK_HOST: Host for callback server (default:0.0.0.0)
CLI Reference
locknessie config init— Initialize config filelocknessie config set <key> <value>— Set a config valuelocknessie token show— Print a valid OpenID token
Use Cases
- Jupyter notebooks: Authenticate and use Nessie/Iceberg with one line.
- ETL/Service jobs: Headless daemon/service account auth with environment variables.
Provider Support
- Microsoft Entra/Azure AD: Supported (user and daemon/service flows)
- Keycloak: Coming soon
Contributing
PRs and issues welcome!
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 locknessie-1.0.0.tar.gz.
File metadata
- Download URL: locknessie-1.0.0.tar.gz
- Upload date:
- Size: 54.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c12b304a4fd1504d771f2c790621c2a2cc1aabc1aa1b519ef32e16d853de3b6
|
|
| MD5 |
9fbbd957d1e9ca2cea51138d89500f96
|
|
| BLAKE2b-256 |
846a07095fbd096bdd7efaea8ca711076262c529b21b975bdf66d7c0926fe85b
|
Provenance
The following attestation bundles were made for locknessie-1.0.0.tar.gz:
Publisher:
publish.yml on pirate-baby/lock-nessie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
locknessie-1.0.0.tar.gz -
Subject digest:
7c12b304a4fd1504d771f2c790621c2a2cc1aabc1aa1b519ef32e16d853de3b6 - Sigstore transparency entry: 227262285
- Sigstore integration time:
-
Permalink:
pirate-baby/lock-nessie@541bd2834e914ea1019d99114c7a47b832829c12 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/pirate-baby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@541bd2834e914ea1019d99114c7a47b832829c12 -
Trigger Event:
release
-
Statement type:
File details
Details for the file locknessie-1.0.0-py3-none-any.whl.
File metadata
- Download URL: locknessie-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1106a805b596ebd1cd6267e87c13a6e1418c4359c6ca1e4f91298fe36e07ec3d
|
|
| MD5 |
05389989d3fb5f4e7da8d4c36a4e78c5
|
|
| BLAKE2b-256 |
3c228a214e185be8f7409bc27b74d11d6ccf35c850341cab352537792b100709
|
Provenance
The following attestation bundles were made for locknessie-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on pirate-baby/lock-nessie
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
locknessie-1.0.0-py3-none-any.whl -
Subject digest:
1106a805b596ebd1cd6267e87c13a6e1418c4359c6ca1e4f91298fe36e07ec3d - Sigstore transparency entry: 227262293
- Sigstore integration time:
-
Permalink:
pirate-baby/lock-nessie@541bd2834e914ea1019d99114c7a47b832829c12 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/pirate-baby
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@541bd2834e914ea1019d99114c7a47b832829c12 -
Trigger Event:
release
-
Statement type: