Skip to content

TLS encryption for client-agent communication - #269

Open
RiSKeD wants to merge 1 commit into
mainfrom
feat/tls-support
Open

TLS encryption for client-agent communication#269
RiSKeD wants to merge 1 commit into
mainfrom
feat/tls-support

Conversation

@RiSKeD

@RiSKeD RiSKeD commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Implement TLS support using Ed25519 self-signed certificates to encrypt communication between dutctl client and dutagent server. TLS is enabled by default with an --insecure flag available for HTTP support. This provides encryption only, not client authentication. Any client can connect to the agent.

@RiSKeD
RiSKeD force-pushed the feat/tls-support branch 2 times, most recently from a9a7542 to 2b64792 Compare January 8, 2026 13:20
@RiSKeD

RiSKeD commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

The agent will auto generate a self-signed key/certificate into the key and certificate path if no files exists in the path.
If cert/file are present these will be used instead.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements TLS encryption for client-agent communication using Ed25519 self-signed certificates. TLS is enabled by default with an --insecure flag available for backward compatibility with plain HTTP. The implementation provides encryption only, without client authentication.

Key changes:

  • New internal/tlsutil package for certificate generation and management with auto-generation support
  • TLS client configuration in dutctl with InsecureSkipVerify to accept self-signed certificates
  • TLS server configuration in dutagent with configurable certificate paths and automatic certificate generation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 13 comments.

File Description
internal/tlsutil/tlsutil.go New package providing Ed25519 certificate generation, loading, and auto-generation functionality
cmds/dutctl/dutctl.go Added TLS client support with --insecure flag and TLS/HTTPS transport configuration
cmds/dutagent/dutagent.go Added TLS server support with certificate auto-generation, configurable paths, and --insecure fallback

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmds/dutagent/dutagent.go Outdated
Comment thread cmds/dutagent/dutagent.go Outdated
Comment thread internal/tlsutil/tlsutil.go Outdated
Comment thread cmds/dutctl/dutctl.go Outdated
Comment thread internal/tlsutil/tlsutil.go
Comment thread cmds/dutctl/dutctl.go Outdated
Comment thread internal/tlsutil/tlsutil.go Outdated
Comment thread cmds/dutctl/dutctl.go Outdated
Comment thread internal/tlsutil/tlsutil.go Outdated
Comment thread internal/tlsutil/tlsutil.go Outdated
@RiSKeD RiSKeD changed the title feat: add TLS encryption for client-agent communication WIP: feat: add TLS encryption for client-agent communication Jan 8, 2026
@RiSKeD
RiSKeD force-pushed the feat/tls-support branch 3 times, most recently from 49df9ea to ed5eea3 Compare January 8, 2026 14:09
@RiSKeD
RiSKeD requested a review from Copilot January 8, 2026 14:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/tlsutil/tlsutil.go
Comment thread pkg/rpc/httpclient.go Outdated
Comment thread pkg/rpc/httpclient.go Outdated
Comment thread internal/tlsutil/tlsutil.go Outdated
Comment thread cmds/dutagent/dutagent.go Outdated
Comment thread internal/tlsutil/tlsutil.go Outdated
Comment thread cmds/dutctl/dutctl.go Outdated
@RiSKeD RiSKeD changed the title WIP: feat: add TLS encryption for client-agent communication feat: add TLS encryption for client-agent communication Jan 8, 2026
@RiSKeD
RiSKeD force-pushed the feat/tls-support branch 2 times, most recently from f6ff376 to 7f29510 Compare January 8, 2026 15:08
@jenstopp jenstopp changed the title feat: add TLS encryption for client-agent communication TLS encryption for client-agent communication Mar 16, 2026
@RiSKeD
RiSKeD force-pushed the feat/tls-support branch from ab6f229 to 8a14929 Compare July 27, 2026 09:08
Serve and dial every RPC hop over TLS instead of HTTP/2 cleartext: dutctl
to dutagent, dutctl to dutserver, dutserver to dutagent, and the agent's
registration call to the server.

dutagent and dutserver load their key pair from -tls-cert/-tls-key and
generate a self-signed Ed25519 pair if neither file exists, defaulting to
/var/lib/<app>/tls/{cert,key}.pem. That is under /var/lib rather than /etc
because the packaged unit runs unprivileged with ProtectSystem=strict.
The pair is resolved before module initialization, so a bad path fails
startup instead of driving the DUTs first, and -dry-run covers it.

Neither end is authenticated: the certificate is self-signed and every
client sets InsecureSkipVerify, so this protects against passive
eavesdropping only, not an active man-in-the-middle. Any client can still
connect to an agent. Supplying a CA-issued pair does not change that,
since no client in the project verifies what it is offered.

All three binaries take -insecure to keep the previous cleartext
behaviour. The transport is a deployment-wide setting rather than a
negotiated one: a mismatch fails below the RPC layer, where the version
interceptors cannot report it, so dutctl matches the two mismatch cases
and prints a hint naming the fix.

BREAKING CHANGE: RPC traffic is TLS by default, so a dutctl from before
this release cannot talk to an upgraded dutagent or dutserver, and an
upgraded dutctl cannot talk to an older one. Upgrade all participants
together, or start every one of them with -insecure to keep cleartext.

Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
@RiSKeD
RiSKeD force-pushed the feat/tls-support branch from 8a14929 to 5a65bdd Compare July 27, 2026 10:10
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.

2 participants