Skip to content

Autodetect & Handle TLS for Lumera gRPC Connections#109

Merged
mateeullahmalik merged 1 commit intomasterfrom
supportSecureLumeraConnections
Jul 31, 2025
Merged

Autodetect & Handle TLS for Lumera gRPC Connections#109
mateeullahmalik merged 1 commit intomasterfrom
supportSecureLumeraConnections

Conversation

@mateeullahmalik
Copy link
Collaborator

@mateeullahmalik mateeullahmalik commented Jul 31, 2025

Autodetect & Handle TLS for Lumera gRPC Connections

Why

Operators enter Lumera endpoints in mixed formats (https://…, grpcs://…, host:443, plain host:9090).
The original dialer hard-coded h2c (insecure.NewCredentials()), so any URL that expected TLS failed. We want:

  • Zero-config: accept whatever string the user pastes in.

  • Back-compat: plaintext still works for local/test nets.

  • No extra flags: behaviour inferred from the address itself.


What’s inside

  • lumera/connection.go fully replaced

    • Parses address with normaliseAddr():

      • https:// or grpcs:// ⇒ TLS, default port 443

      • Any :443 ⇒ TLS

      • Everything else ⇒ insecure h2c

    • Selects credentials.NewClientTLSFromCert(nil, serverName) for TLS, otherwise insecure.NewCredentials().

    • Keeps public Connection interface unchanged.

  • No external deps added – still uses Go stdlib + google.golang.org/grpc.


j-rafique
j-rafique previously approved these changes Jul 31, 2025
@mateeullahmalik mateeullahmalik force-pushed the supportSecureLumeraConnections branch from 84d0d83 to d4631f9 Compare July 31, 2025 10:13
@mateeullahmalik mateeullahmalik requested a review from Copilot July 31, 2025 10:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces automatic TLS detection for Lumera gRPC connections based on the provided address format, replacing the previous hard-coded insecure connection approach. The implementation accepts various address formats (https://, grpcs://, host:443, plain host) and automatically selects appropriate transport credentials without requiring additional configuration flags.

Key changes:

  • Automatic TLS detection based on address scheme or port 443
  • Support for multiple address formats while maintaining backward compatibility
  • Removal of hard-coded insecure credentials in favor of dynamic selection
Comments suppressed due to low confidence (1)

pkg/lumera/connection.go:100

  • The variable name 'splitErr' is inconsistent with Go naming conventions. It should be 'err' since it's a standard error variable in this scope.
	if splitErr != nil {

@mateeullahmalik mateeullahmalik merged commit dfacc89 into master Jul 31, 2025
7 checks passed
@mateeullahmalik mateeullahmalik deleted the supportSecureLumeraConnections branch August 12, 2025 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants