sync-proxy icon indicating copy to clipboard operation
sync-proxy copied to clipboard

Implement small service for overriding JWT secrets per EL node

Open ilyaluk opened this issue 10 months ago • 0 comments

📝 Summary

This implements new tool that allows to issue JWT tokens based on multiple secrets

⛱ Motivation and Context

If we want to send CL requests to multiple ELs, and each of them has a different jwt secret, while keep using nginx for multiplexing, we need a way to dynamically generate JWT tokens for each EL. Engine API mandates that ELs should verify timestamp in JWT token to not be far off from current time[1], so we can't hardcode a JWT token in nginx config. To issue tokens dynamically we can use following options:

  • Use commercial nginx for jwt module[2] (or compile OS re-implementation[3])
  • Use Lua module and some libraries to work with JWT tokens[4]
  • Request tokens using with auth_request module and write an external service that would issue them.

I think the latter is the optimal option considering size of changes required.

This could be implemented in sync-proxy itself, but we don't want to use sync-proxy for multiplexing yet.

This PR also based off #17 to avoid go.mod conflicts

📚 References

[1] https://github.com/ethereum/execution-apis/blob/main/src/engine/authentication.md#jwt-claims [2] https://nginx.org/en/docs/http/ngx_http_auth_jwt_module.html [3] https://github.com/kjdev/nginx-auth-jwt [4] https://github.com/SkyLothar/lua-resty-jwt [5] https://nginx.org/en/docs/http/ngx_http_auth_request_module.html


✅ I have run these commands

  • [x] make lint
  • [x] make test-race
  • [x] go mod tidy
  • [x] I have seen and agree to CONTRIBUTING.md

ilyaluk avatar Mar 20 '25 15:03 ilyaluk