m/n/core/rpc: implement node verification in authenticated connections
The current API of NewAuthenticatedCredentials is not easily extensible,
so switch over to such an API now.
This then adds a WantRemoteNode option which verifies that the remote
connection is established to a node with a given ID.
Change-Id: Ie9f6b33d8b032729181bae5591eba9856ea2f523
Reviewed-on: https://review.monogon.dev/c/monogon/+/1427
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/cli/metroctl/core/rpc.go b/metropolis/cli/metroctl/core/rpc.go
index 8d7565f..00f1f01 100644
--- a/metropolis/cli/metroctl/core/rpc.go
+++ b/metropolis/cli/metroctl/core/rpc.go
@@ -58,7 +58,7 @@
Certificate: [][]byte{ocert.Raw},
PrivateKey: opkey,
}
- creds := rpc.NewAuthenticatedCredentials(tlsc, nil)
+ creds := rpc.NewAuthenticatedCredentials(tlsc, rpc.WantInsecure())
dialOpts = append(dialOpts, grpc.WithTransportCredentials(creds))
}