-
Notifications
You must be signed in to change notification settings - Fork 454
Authentication for engine api #167
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
47aa73a
wip: authentication
holiman 493b678
squashme
holiman 3aa4c19
authentication: updates
holiman 5e674fc
change output form for generated secret + clarifications
holiman b32028f
add acronyms to wordlist
holiman 3162ac5
Update src/engine/authentication.md
djrtwo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Authentication | ||
|
||
The `engine` JSON-RPC interface, exposed by EL and consumed by CL, needs to be authenticated. The authentication scheme chosen for thus purpose is [JWT](https://jwt.io/). | ||
|
||
The type of attacks that this authentication scheme attempts to protect against are the following: | ||
|
||
- RPC port exposed towards the internet, allowing attackers to exchange messages with EL engine api. | ||
- RPC port exposed towards the browser, allowing malicious webpages to submit messages to the EL engine api. | ||
|
||
The authentication scheme is _not_ designed to | ||
|
||
- Prevent attackers with capability to read ('sniff') network traffic from reading the traffic, | ||
- Prevent attackers with capability to read ('sniff') network traffic from performing replay-attacks of earlier messages. | ||
|
||
Authentication is performed as follows: | ||
|
||
- For `HTTP` dialogue, each `jsonrpc` request is individually authenticated by supplying `JWT` token in the HTTP header. | ||
- For a WebSocket dialogue, only the initial handshake is authenticated, after which the message dialogue proceeds without further use of JWT. | ||
- Clarification: The websocket handshake starts with the client performing a websocket upgrade request. This is a regular http GET request, and the actual | ||
parameters for the WS-handshake are carried in the http headers. | ||
- For `inproc`, a.k.a raw ipc communication, no authentication is required, under the assumption that a process able to access `ipc` channels for the process, which usually means local file access, is already sufficiently permissioned that further authentication requirements do not add security. | ||
|
||
|
||
## JWT specifications | ||
|
||
- Client software MUST expose the authenticated Engine API at a port independent from existing JSON-RPC API. | ||
- The default port for the authenticated Engine API is `8551`. The Engine API is exposed under the `engine` namespace. | ||
- On the authenticated endpoint, the legacy API **MUST** also be available. | ||
djrtwo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- The EL **MUST** support at least the following `alg` `HMAC + SHA256` (`HS256`) | ||
- The EL **MUST** reject the `alg` `none`. | ||
|
||
|
||
The HMAC algorithm means that symmetric encryption is used, thus several CL's will be able to use the same key, and, from an authentication perspective be able to impersonate each other. From a deployment perspective, it means that an EL does not need to be provisioned with individual keys for each caller. | ||
|
||
## Key distribution | ||
|
||
The `EL` and `CL` clients **MUST** accept a cli/config 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 store it 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 at least `256` bits, the client should treat this as an error: either abort the startup, or show error and continue without exposing the authenticated port. | ||
|
||
## JWT Claims | ||
|
||
This specification utilizes the following list of JWT claims: | ||
|
||
- Required: `iat` (issued-at) claim. The EL **SHOULD** only accept `iat` timestamps which are within +-5 seconds from the current time. | ||
- Optional: `id` claim. The CL **MAY** use this to communicate a unique identifier for the individual CL node. | ||
- Optional: `clv` claim. The CL **MAY** use this to communicate the CL node type/version. | ||
|
||
Other claims **MAY** be included in the JWT payload. If the EL sees claims it does not recognize, these **MUST** be ignored. | ||
|
||
## Examples | ||
|
||
Todo, add some examples of JWT authentication here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,9 @@ validator | |
wei | ||
yaml | ||
yParity | ||
EL | ||
CL | ||
JWT | ||
WS | ||
ipc | ||
cli |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.