events: mTLS authentication#10013
Conversation
This comment was marked as spam.
This comment was marked as spam.
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/disco/events/fd_event_client.h
Line: 18
Comment:
**Unused metric field `transport_success_cnt`**
`transport_success_cnt` is declared in `fd_event_client_metrics_t` but is no longer incremented anywhere in `fd_event_client.c` after the removal of `fd_event_client_handle_confirm_auth_resp`. It is also not exported via any `FD_MCNT_SET` in `fd_event_tile.c`. Consider either removing the field or wiring it up in `fd_event_client_grpc_conn_established`.
How can I resolve this? If you propose a fix, please make it concise. |
Performance Measurements ⏳
|
fea111f to
6f9fce5
Compare
|
@greptile-jt review |
Performance Measurements ⏳
|
This comment was marked as spam.
This comment was marked as spam.
6f9fce5 to
b4870db
Compare
|
@greptile-jt review |
Performance Measurements ⏳
|
Greptile SummaryThis PR replaces the bespoke challenge-response authentication for the events tile with standard TLS 1.3 mutual authentication using RFC 7250 Raw Public Keys, delegating signing of the TLS
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| src/disco/events/fd_event_auth.c | New OpenSSL provider implementing keymgmt and signature dispatch for ED25519 keys delegated to the keyguard. Cleanly wraps SSL_set1_credential with raw public key support. |
| src/disco/events/fd_event_client.c | Major refactor replacing custom challenge-response auth with TLS 1.3 mTLS. State machine reduced from 5 to 3 states. The previously flagged connected_timestamp initialization is now in place at line 427. |
| src/disco/events/fd_event_tile.c | TLS is now mandatory; new tls_cert_verify option toggles between loading system CA store and SSL_VERIFY_NONE. SSL context creation and teardown are wired through the existing privileged/unprivileged init paths. |
| src/disco/keyguard/fd_keyguard_authorize.c | Expands TLS CV size check to cover the new 162-byte client-side payload, and switches event role authorization to use TLS CV (instead of the removed custom event payload). |
| src/disco/keyguard/fd_sign_tile.c | Removes the event-specific sign type and updates the event sign-link MTU from 32 to 162 bytes to accommodate TLS CertificateVerify payloads. |
| src/app/firedancer/topology.c | Event tile setup wrapped in # if FD_HAS_OPENSSL. The warning about disabled telemetry without OpenSSL is now gated on telemetry_enabled (previous review thread resolved). Event sign link MTU updated to 162UL. |
| src/app/shared/fd_config.h | Adds int tls_cert_verify; field to event config. Note that this field is stored as a uchar : 1 bitfield in fd_topo_t, causing a minor type mismatch between the two representations. |
| src/disco/topo/fd_topo.h | Adds uchar tls_cert_verify : 1; bitfield. Type differs from the int representation in fd_config.h; this works since values are 0/1, but the inconsistency may be worth aligning. |
| contrib/event-test-server/src/main.rs | Rewritten Rust test server with tokio-rustls and a custom AnyRpkVerifier that accepts any well-formed Ed25519 SubjectPublicKeyInfo. Hardcoded server cert/key are clearly marked as test-only. |
Last reviewed commit: b4870db
Additional Comments (1)
The new Prompt To Fix With AIThis is a comment left during a code review.
Path: src/app/shared/fd_config.h
Line: 1
Comment:
**Type mismatch with `fd_topo_t`**
The new `tls_cert_verify` field is declared as `int` here but as a `uchar : 1` bitfield in `src/disco/topo/fd_topo.h`. This works in practice because the value is only ever 0 or 1, but the inconsistency makes it easy to introduce subtle bugs (e.g. assigning a non-zero non-one value to the `int` and silently truncating). Consider aligning the two representations (either both `int`, both `uchar`, or both bitfields) for consistency with the other boolean-ish config fields.
How can I resolve this? If you propose a fix, please make it concise. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 26 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/disco/events/fd_event_client.c:144
- fd_url_parse_endpoint() returns whether the endpoint is SSL via
_is_ssl, but the result is currently ignored. Since the client always configures an SSL connection later, accepting a non-https URL here would lead to attempting a TLS handshake against a plain HTTP endpoint (and hides misconfiguration). Consider rejecting non-SSL URLs explicitly right after parsing.
fd_url_t url[1];
_Bool _is_ssl = 0;
if( FD_UNLIKELY( fd_url_parse_endpoint( url,
_url,
strlen( _url ),
b4870db to
e961c91
Compare
e961c91 to
511338d
Compare
Remove custom challenge-response authentication scheme from event telemetry API. To be replaced with mutual TLS in a future commit. Rename 'authenticate' method to 'hello' to avoid confusion.
An upcoming change will enforce mutual TLS for event telemetry connections, thus just assume OpenSSL is available in build configuration.
Allow clients to authenticate via RFC 7250 Raw Public Keys
511338d to
b15790a
Compare
| client->event_stream = NULL; | ||
| client->metrics.transport_success_cnt++; | ||
| client->state = FD_EVENT_CLIENT_STATE_CONNECTED; | ||
| client->connected.connected_timestamp = fd_log_wallclock(); | ||
|
|
| FD_LOG_INFO(( "Requesting auth challenge from event server " FD_IP4_ADDR_FMT ":%u (%.*s)", | ||
| FD_IP4_ADDR_FMT_ARGS( client->server_ip4_addr ), client->server_tcp_port, | ||
| (int)client->server_fqdn_len, client->server_fqdn )); |
| fd_env_client_handle_hello_resp( fd_event_client_t * client, | ||
| void const * protobuf, | ||
| ulong protobuf_sz ) { | ||
| (void)protobuf; (void)protobuf_sz; | ||
| client->state = FD_EVENT_CLIENT_STATE_CONNECTED; |
| switch( request_ctx ) { | ||
| case FD_EVENT_CLIENT_REQ_CTX_AUTHENTICATE: | ||
| fd_event_client_handle_auth_challenge_resp( client, protobuf, protobuf_sz ); | ||
| break; | ||
| case FD_EVENT_CLIENT_REQ_CTX_CONFIRM_AUTH: | ||
| fd_event_client_handle_confirm_auth_resp( client, protobuf, protobuf_sz ); | ||
| case FD_EVENT_CLIENT_REQ_CTX_HELLO: | ||
| fd_env_client_handle_hello_resp( client, protobuf, protobuf_sz ); |
|
|
||
| fd_grpc_h2_stream_t * stream = fd_grpc_client_request_start1( | ||
| client->grpc_client, | ||
| "/events.v1.EventService/Authenticate", strlen("/events.v1.EventService/Authenticate"), | ||
| FD_EVENT_CLIENT_REQ_CTX_AUTHENTICATE, | ||
| "/events.v1.EventService/Hello", strlen("/events.v1.EventService/Hello"), | ||
| FD_EVENT_CLIENT_REQ_CTX_HELLO, |
| client->event_stream = NULL; | ||
| client->metrics.transport_success_cnt++; | ||
| client->state = FD_EVENT_CLIENT_STATE_CONNECTED; | ||
| client->connected.connected_timestamp = fd_log_wallclock(); | ||
|
|
| FD_LOG_INFO(( "Requesting auth challenge from event server " FD_IP4_ADDR_FMT ":%u (%.*s)", | ||
| FD_IP4_ADDR_FMT_ARGS( client->server_ip4_addr ), client->server_tcp_port, | ||
| (int)client->server_fqdn_len, client->server_fqdn )); |
| fd_env_client_handle_hello_resp( fd_event_client_t * client, | ||
| void const * protobuf, | ||
| ulong protobuf_sz ) { | ||
| (void)protobuf; (void)protobuf_sz; | ||
| client->state = FD_EVENT_CLIENT_STATE_CONNECTED; |
| switch( request_ctx ) { | ||
| case FD_EVENT_CLIENT_REQ_CTX_AUTHENTICATE: | ||
| fd_event_client_handle_auth_challenge_resp( client, protobuf, protobuf_sz ); | ||
| break; | ||
| case FD_EVENT_CLIENT_REQ_CTX_CONFIRM_AUTH: | ||
| fd_event_client_handle_confirm_auth_resp( client, protobuf, protobuf_sz ); | ||
| case FD_EVENT_CLIENT_REQ_CTX_HELLO: | ||
| fd_env_client_handle_hello_resp( client, protobuf, protobuf_sz ); |
| # By default, the TLS certificate of the event server is | ||
| # verified against the CA certs in /etc/ssl/certs. To disable | ||
| # certificate verification, set this option to 'false'. |
Performance Measurements ⏳
|
| fd_topob_tile_out( topo, "sign", 0UL, "sign_event", 0UL ); | ||
| } | ||
| # else /* no OpenSSL */ | ||
| if( telemetry_enabled ) FD_LOG_WARNING(( "ignoring [telemetry] = true: this build of Firedancer is missing OpenSSL" )); |
There was a problem hiding this comment.
This should be an error, user has explicit intent for telemetry, tell them to turn it off.
Replace custom challenge-response auth with TLS 1.3 client authentication
Close #9968