Add a private CA and mutual TLS for the agent stream
A node's identity was whatever the agent said it was. With mutual TLS the control plane compares the client certificate's common name against the claimed node id and refuses the connection when they disagree, so identity becomes something a node proves rather than something it picks. A public authority cannot supply these certificates: Let's Encrypt and its peers stopped issuing the clientAuth usage, and Go verifies client chains against it. Hence internal/tlsconf/ca.go, a small authority whose key lives on one machine and whose root is trusted everywhere, and `llmgw ctl cert` over it so issuing is reproducible instead of remembered openssl. The server certificate's hosts matter more than they look: hostname verification reads subject alternative names and ignores the common name entirely, so a certificate without the address agents dial — bare IP included — is rejected no matter what its subject says. There is a test for exactly that, because it is the failure everyone hits once. requireIdentity stays wired to false until the configuration lands, so this commit changes no running behaviour. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e8d90cf375
commit
1e3cafdc86
9 files changed
+958
-7
No files matched your search
@@ -93,7 +93,7 @@ func newServerCmd() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
ctl, svc, err := startControlPlane(ctx, cfg, cat, rt, log)
|
||||
ctl, svc, err := startControlPlane(ctx, cfg, cat, rt, false, log)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -196,7 +196,7 @@ func newServerCmd() *cobra.Command {
|
||||
// it holds the open streams, so it is the only thing that can deliver a command
|
||||
// to a node.
|
||||
func startControlPlane(ctx context.Context, cfg config.Server, cat *catalog.Catalog,
|
||||
sink control.EndpointSink, log *slog.Logger,
|
||||
sink control.EndpointSink, requireIdentity bool, log *slog.Logger,
|
||||
) (*control.Controller, *agentsvc.Service, error) {
|
||||
ccfg := control.DefaultConfig()
|
||||
ccfg.Reconciler = reconciler.Config{
|
||||
@@ -217,7 +217,7 @@ func startControlPlane(ctx context.Context, cfg config.Server, cat *catalog.Cata
|
||||
// the service once it exists.
|
||||
fwd := &dispatcherRef{}
|
||||
ctl := control.New(ccfg, cat, fwd, sink, log)
|
||||
svc := agentsvc.New(ctl.Inventory(), ctl.Reconciler(), log)
|
||||
svc := agentsvc.New(ctl.Inventory(), ctl.Reconciler(), requireIdentity, log)
|
||||
fwd.set(svc)
|
||||
|
||||
ctl.Start(ctx)
|
||||
|
||||
Reference in new issue
Block a user