Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine: default location for reading/writing jwt secrets #297

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
18 changes: 16 additions & 2 deletions src/engine/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,24 @@ The HMAC algorithm implies that several consensus layer clients will be able to

The execution layer and consensus layer clients **SHOULD** accept a configuration parameter: `jwt-secret`, which designates a file containing the hex-encoded 256 bit secret key to be used for verifying/generating JWT tokens.

If such a parameter is not given, the client **SHOULD** generate such a token, valid for the duration of the execution, and **SHOULD** store the hex-encoded secret as a `jwt.hex` file on the filesystem. This file can then be used to provision the counterpart client.

If such a parameter _is_ given, but the file cannot be read, or does not contain a hex-encoded key of `256` bits, the client **SHOULD** treat this as an error: either abort the startup, or show error and continue without exposing the authenticated port.

If such a parameter _is not_ given, the client **MUST** attempt to read the secret from the default paths defined below, in the order they are listed. If a secret is found, but the file cannot be read, does not contain a hex-encoded key of `256` bit, or is rejected by the other client, the client **MUST** continue searching until all default paths are exhausted. Consensus layer clients **MAY** search other locations, such as execution layer client data directories.

If no existing JWT is located, the client **SHOULD** generate such a token, valid for the duration of the execution, and store the hex-encoded secret on the filesystem. The exact path is dependant on the host OS, see the default paths below. If the client is unable to write the secret to an OS-specific path, it **MUST** fallback to writing to its own data directory.

### Default JWT secret locations

For Linux:
* `$XDG_CACHE_DIR/ethereum/engine/jwt.hex`
Copy link

@rubo rubo Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be either of these instead:

  • $XDG_CACHE_HOME/... and $HOME/.cache/...
  • $XDG_DATA_HOME/... and $HOME/.local/share/...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure CACHE is correct here because it can be regenerated as needed, and should NOT be included in any backup processes.

Suggested change
* `$XDG_CACHE_DIR/ethereum/engine/jwt.hex`
* `$XDG_CACHE_HOME/ethereum/engine/jwt.hex`

* `$HOME/.cache/ethereum/engine/jwt.hex`

For Mac:
* `$HOME/Library/Caches/Ethereum/Engine/jwt.hex`

For Windows:
* `%LocalAppData%/Ethereum/Engine/jwt.hex`

## JWT Claims

This specification utilizes the following list of JWT claims:
Expand Down