Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ jobs:
uv sync
run: |
uv pip install libs/gl-client-py/dist/gl_client*.whl --force-reinstall
python3 -c "import glclient;creds=glclient.Credentials();signer=glclient.Signer(b'\x00'*32,'bitcoin', creds);print(repr(creds));print(signer.version())"
python3 -c "import glclient,tempfile;store=tempfile.TemporaryDirectory();creds=glclient.Credentials();signer=glclient.Signer(b'\x00'*32,'bitcoin', creds,device_storage_path=store.name);print(repr(creds));print(signer.version())"

- name: Install built wheel (native)
if: matrix.target == 'x86_64'
run: |
uv sync
uv pip install libs/gl-client-py/dist/gl_client*.whl --force-reinstall
uv run python3 -c "import glclient;creds=glclient.Credentials();signer=glclient.Signer(b'\x00'*32,'bitcoin', creds);print(repr(creds));print(signer.version())"
uv run python3 -c "import glclient,tempfile;store=tempfile.TemporaryDirectory();creds=glclient.Credentials();signer=glclient.Signer(b'\x00'*32,'bitcoin', creds,device_storage_path=store.name);print(repr(creds));print(signer.version())"

- name: Upload wheels
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
run: |
uv sync
uv pip install libs/gl-client-py/dist/gl_client*.whl --force-reinstall
uv run python3 -c "import glclient;creds=glclient.Credentials();signer=glclient.Signer(b'\x00'*32,'bitcoin', creds);print(repr(creds));print(signer.version())"
uv run python3 -c "import glclient,tempfile;store=tempfile.TemporaryDirectory();creds=glclient.Credentials();signer=glclient.Signer(b'\x00'*32,'bitcoin', creds,device_storage_path=store.name);print(repr(creds));print(signer.version())"

- name: Upload wheels
uses: actions/upload-artifact@v4
Expand Down
8 changes: 5 additions & 3 deletions docs/src/reference/certs.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,15 @@ For the lower-level `gl-client` library, you can construct a
```rust
use gl_client::credentials::Nobody;
use gl_client::scheduler::Scheduler;
use gl_client::signer::Signer;
use gl_client::signer::{FileDeviceStorage, Signer};
use std::sync::Arc;

let cert = std::fs::read("client.crt")?;
let key = std::fs::read("client-key.pem")?;
let developer_creds = Nobody::with(cert, key);

let signer = Signer::new(seed, Network::Bitcoin, developer_creds.clone())?;
let storage = Arc::new(FileDeviceStorage::new("/path/to/app/device-state")?);
let signer = Signer::new(seed, Network::Bitcoin, developer_creds.clone(), storage)?;
let scheduler = Scheduler::new(Network::Bitcoin, developer_creds).await?;
let res = scheduler.register(&signer, None).await?;
```
Expand All @@ -143,7 +145,7 @@ For the lower-level `gl-client` library, you can construct a
key = open("client-key.pem", "rb").read()
creds = Credentials.nobody_with(cert, key)

signer = Signer(seed, network="bitcoin", creds=creds)
signer = Signer(seed, network="bitcoin", creds=creds, device_storage_path="/path/to/app/device-state")
scheduler = Scheduler(network="bitcoin", creds=creds)
res = scheduler.register(signer)
```
Expand Down
68 changes: 34 additions & 34 deletions docs/src/reference/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ section.
## Client ⇄ Signer Authentication

The signer cannot rely on the mTLS CA structure, since that is under
control of the Greenlight team. Instead, Greenlight employs an
attestation scheme in which the signer identity attests to itself and
other signers that a particular client is authorized to perform
control of the Greenlight team. Instead, Greenlight employs an
attestation scheme in which the signer identity attests to itself and
other signers that a particular client is authorized to perform
certain operations.

When registering a new client, the signer will submit a [`rune`][rune]
as an access token. The rune serves mainly as an authentication while the
client's identity in form of a mTLS key-pair provides authorization.
The run is bound to the client's identity; it is presented to the signer
on each request. This will allow multiple signers to recognize which
clients are authorized, even if the signer who carved the rune is not the
as an access token. The rune serves mainly as an authentication while the
client's identity in form of a mTLS key-pair provides authorization.
The run is bound to the client's identity; it is presented to the signer
on each request. This will allow multiple signers to recognize which
clients are authorized, even if the signer who carved the rune is not the
signer verifying the authorization.

Before signing a request the signer independently verifies that:
Expand All @@ -82,11 +82,11 @@ preventing read-access that doesn't involve the signer, while the
latter ensures funds are not moved without a client authorizing it.

The client-identity pubkey, its signature of the command payload, and
the rune are all passed to the node via grpc headers. The node
extracts them, alongside the call itself, and adds it to a request
the rune are all passed to the node via grpc headers. The node
extracts them, alongside the call itself, and adds it to a request
context which will itself be attached to requests that are sent to the
signer, so it can verify the validity and authenticity of the
operations. An attacker that gains access to the node is unable to
signer, so it can verify the validity and authenticity of the
operations. An attacker that gains access to the node is unable to
provide either these signatures and will therefore fail to convince
the signer of its injected commands.

Expand All @@ -104,7 +104,7 @@ operational limitations.

## Signer State Integrity

The signer does not store its own state. The node stores the
The node stores the full
[signer state](signer-state.md) (channel states, allowed on-chain
destinations, known invoices) and attaches it to every request. An
attacker with access to the node infrastructure can therefore read,
Expand All @@ -115,38 +115,38 @@ must not trust it blindly.
|-------|--------------|------------------|
| Node infrastructure | Storing and returning the state | The content, age or completeness of the state |
| Signer | Writing and signing state entries | |
| Application embedding the signer | Keeping the state anchor, choosing enforcement options | |
| Application embedding the signer | Persisting signer metadata, choosing enforcement options | |

- **Authenticity:** every state entry is signed with a key derived
from the node secret. In `hard` state signature mode the signer
refuses entries with missing or invalid signatures, so the node
cannot inject or alter state.
- **Freshness and completeness** (planned): a small _state anchor_
kept on the device records the latest version of every key the
signer has seen. On start, the signer refuses state that is older
than its anchor, is missing keys, or brings back deleted keys.
- **Enforcement options belong to the application.** The state
signature mode and anchor enforcement are set where the signer is
embedded; the node cannot change them, and there is no way for the
node to reset an anchor.

A signer without an anchor, for example right after pairing or
recovery, trusts the first state it receives. See
[Signer State](signer-state.md) for the details and the configuration
options.
- **Freshness and completeness:** the signer keeps a _watermark_ in
device storage with a version and value hash for each signer-owned
entry it has committed. It saves the watermark before releasing
signatures. A newly started signer refuses older or missing entries,
resurrected entries, and values that differ at the same version.
- **Configuration belongs to the application.** The application chooses
the signature mode and controls the local storage. The node cannot
reset the watermark.

A signer without a watermark, for example on first use, trusts the first
snapshot it accepts. See
[Signer State](signer-state.md#freshness-and-completeness-the-watermark)
for configuration, recovery and limits.

## Client ⇄ Signer Authorization

The [`rune`][rune]-based signer authentication verifies a client's
identity and their authorization to execute commands. To achieve more
granular control over command authorization for individual clients, a
rune can be created with specific restrictions. When verifying client
identity, the signer additionally ensures that specific conditions,
The [`rune`][rune]-based signer authentication verifies a client's
identity and their authorization to execute commands. To achieve more
granular control over command authorization for individual clients, a
rune can be created with specific restrictions. When verifying client
identity, the signer additionally ensures that specific conditions,
such as the requested command, align with the limitations of the given
rune.

This enables a user to share access to the signer across multiple
clients that are restricted to a subset of commands, for example
This enables a user to share access to the signer across multiple
clients that are restricted to a subset of commands, for example
read-only clients, or invoice-only clients, or clients that can only
create on-chain addresses and so on.

Expand Down
Loading
Loading