TLS encryption for client-agent communication - #269
Conversation
a9a7542 to
2b64792
Compare
|
The agent will auto generate a self-signed key/certificate into the key and certificate path if no files exists in the path. |
There was a problem hiding this comment.
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/tlsutilpackage for certificate generation and management with auto-generation support - TLS client configuration in
dutctlwith InsecureSkipVerify to accept self-signed certificates - TLS server configuration in
dutagentwith 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.
2b64792 to
bd30857
Compare
49df9ea to
ed5eea3
Compare
There was a problem hiding this comment.
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.
f6ff376 to
7f29510
Compare
7f29510 to
ab6f229
Compare
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>
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.