Skip to content

Commit 9bb85f8

Browse files
committed
feat: implement secure node join flow
Fixes: #840 This PR changes the Talos machine join flow drastically: - newly joined machine first put into a limbo state where Omni creates a temporary Wireguard connection to it. - the controller picks up and tries to write a unique machine token to the newly joined machine, in the mean time it also resolves UUID conflicts automatically and writes UUID override to the META partition. - the machine re-joins Omni, now with the unique token. - the unique token is saved in the `siderolink.Link` resource and any subsequent join checks that `siderolink.Link` has matching unique token. Siderolink manager was refactored, as it was a huge monolithic poorly testable chunk, it was split to: - LinkStatus controller, which creates/removes wireguard peers. - PendingMachineStatus controller, which ensures all joined machines have unique node tokens. - Provision handler, which implements gRPC server and has all logic related to the machine acceptance now. - PeersPool, which is used by LinkStatus controllers and deduplicate peers creation, reuse them when possible. Additionally updated siderolink loghandler to not accept logger connection for the machines which do not have corresponding log buffers. Nodes which do not support secure flow are still able to join by default. Secure join flow can be forced by setting `--disable-legacy-join-tokens` flag. Signed-off-by: Artem Chernyshev <[email protected]>
1 parent 0cda77b commit 9bb85f8

33 files changed

+2963
-391
lines changed

client/api/omni/specs/siderolink.pb.go

Lines changed: 193 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/api/omni/specs/siderolink.proto

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ message SiderolinkSpec {
2828
// RemoteAddr is the machine address how it's visible from Omni
2929
// it is determined by reading X-Forwarded-For header coming from the gRPC API.
3030
string remote_addr = 8;
31+
// NodeUniqueToken is the per node join token which is saved in the Node META partition after
32+
// the machine is accepted in Omni.
33+
// Only for Talos >= 1.6.
34+
string node_unique_token = 9;
35+
}
36+
37+
// LinkStatusSpec is created when the link peer event was submitted.
38+
message LinkStatusSpec {
39+
string node_subnet = 1;
40+
string node_public_key = 2;
41+
string virtual_addrport = 3;
42+
// LinkId is the ID of the resource which created the link status.
43+
string link_id = 4;
3144
}
3245

3346
// SiderolinkConnectionSpec describes each node connection information.
@@ -55,3 +68,8 @@ message ConnectionParamsSpec {
5568
// LogsPort is the logs port.
5669
int32 logs_port = 10;
5770
}
71+
72+
// PendingMachineStatusSpec describes the spec of the pending machine status resource.
73+
message PendingMachineStatusSpec {
74+
string token = 1;
75+
}

0 commit comments

Comments
 (0)