nimbus-eth2 icon indicating copy to clipboard operation
nimbus-eth2 copied to clipboard

re-read jwt secret on every connection attempt

Open arnetheduck opened this issue 3 years ago • 6 comments

The JWT secret file is created by the EL when it starts - because of ordering differences between EL and CL startups, we should read the JWT secret file when making the connection attempt - this also addresses the case where the JWT secret changes (for example because the EL restarts and writes a new secret, for whatever reason).

If the JWT secret cannot be read, it is equivalent to an authentication failure and should be treated as such for the purpose of error handling / recovery.

arnetheduck avatar Aug 25 '22 08:08 arnetheduck

22.8.0

arnetheduck avatar Aug 25 '22 08:08 arnetheduck

This has the potential to create new failure modes, too -- for "whatever reason", the local JWT secret file Nimbus had used becomes unreadable, but it's not in fact changed. This undermines much of the intent initial checks on startup in favor of supporting a more dynamic configuration which is intrinsically not as statically-verifiable and might cause random failures at random points through a run.

tersec avatar Sep 21 '22 11:09 tersec

Perhaps a re-read should be attempted upon a connection failure (as defined by the awaitWithRetries logic which gives up only after multiple failed requests).

Or we can handle a response that specifically indicates that the JWT value is rejected.

zah avatar Sep 21 '22 12:09 zah

this happens when you have jwt stored on /tmp then restart the machine with geth (because geth will create a new one) - we can attempt a read and use the "latest-known-good" if the read fails - we should also not really be making verifications on startup: the order in which el and cl start is random and it's the responsibility of the EL to create a secret

arnetheduck avatar Sep 21 '22 12:09 arnetheduck

it's the responsibility of the EL to create a secret

That's not unambiguous: https://github.com/ethereum/execution-apis/pull/289

tersec avatar Sep 22 '22 05:09 tersec

This interpretive ambiguity renders the idea of relying on auto-generated JWT secrets by either CL or EL clients problematic. This is why in my own communication on the topic, I've suggested avoiding this.

tersec avatar Sep 22 '22 05:09 tersec