mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
control/controlclient,ipn/ipnlocal,tailcfg: rotate node-key signature on register
CAPVER 47 Signed-off-by: Tom DNetto <tom@tailscale.com>
This commit is contained in:
@@ -83,7 +83,8 @@ type CapabilityVersion int
|
||||
// - 44: 2022-09-22: MapResponse.ControlDialPlan
|
||||
// - 45: 2022-09-26: c2n /debug/{goroutines,prefs,metrics}
|
||||
// - 46: 2022-10-04: c2n /debug/component-logging
|
||||
const CurrentCapabilityVersion CapabilityVersion = 46
|
||||
// - 47: 2022-10-11: Register{Request,Response}.NodeKeySignature
|
||||
const CurrentCapabilityVersion CapabilityVersion = 47
|
||||
|
||||
type StableID string
|
||||
|
||||
@@ -827,6 +828,13 @@ type RegisterRequest struct {
|
||||
// when it stops being active.
|
||||
Ephemeral bool `json:",omitempty"`
|
||||
|
||||
// NodeKeySignature is the node's own node-key signature, re-signed
|
||||
// for its new node key using its network-lock key.
|
||||
//
|
||||
// This field is set when the client retries registration after learning
|
||||
// its NodeKeySignature (which is in need of rotation).
|
||||
NodeKeySignature tkatype.MarshaledSignature
|
||||
|
||||
// The following fields are not used for SignatureNone and are required for
|
||||
// SignatureV1:
|
||||
SignatureType SignatureType `json:",omitempty"`
|
||||
@@ -854,6 +862,7 @@ func (req *RegisterRequest) Clone() *RegisterRequest {
|
||||
}
|
||||
res.DeviceCert = append(res.DeviceCert[:0:0], res.DeviceCert...)
|
||||
res.Signature = append(res.Signature[:0:0], res.Signature...)
|
||||
res.NodeKeySignature = append(res.NodeKeySignature[:0:0], res.NodeKeySignature...)
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -865,6 +874,10 @@ type RegisterResponse struct {
|
||||
MachineAuthorized bool // TODO(crawshaw): move to using MachineStatus
|
||||
AuthURL string // if set, authorization pending
|
||||
|
||||
// If set, this is the current node-key signature that needs to be
|
||||
// re-signed for the node's new node-key.
|
||||
NodeKeySignature tkatype.MarshaledSignature
|
||||
|
||||
// Error indicates that authorization failed. If this is non-empty,
|
||||
// other status fields should be ignored.
|
||||
Error string
|
||||
|
@@ -254,6 +254,7 @@ func (src *RegisterResponse) Clone() *RegisterResponse {
|
||||
dst := new(RegisterResponse)
|
||||
*dst = *src
|
||||
dst.User = *src.User.Clone()
|
||||
dst.NodeKeySignature = append(src.NodeKeySignature[:0:0], src.NodeKeySignature...)
|
||||
return dst
|
||||
}
|
||||
|
||||
@@ -264,6 +265,7 @@ var _RegisterResponseCloneNeedsRegeneration = RegisterResponse(struct {
|
||||
NodeKeyExpired bool
|
||||
MachineAuthorized bool
|
||||
AuthURL string
|
||||
NodeKeySignature tkatype.MarshaledSignature
|
||||
Error string
|
||||
}{})
|
||||
|
||||
|
@@ -581,12 +581,13 @@ func (v *RegisterResponseView) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v RegisterResponseView) User() UserView { return v.ж.User.View() }
|
||||
func (v RegisterResponseView) Login() Login { return v.ж.Login }
|
||||
func (v RegisterResponseView) NodeKeyExpired() bool { return v.ж.NodeKeyExpired }
|
||||
func (v RegisterResponseView) MachineAuthorized() bool { return v.ж.MachineAuthorized }
|
||||
func (v RegisterResponseView) AuthURL() string { return v.ж.AuthURL }
|
||||
func (v RegisterResponseView) Error() string { return v.ж.Error }
|
||||
func (v RegisterResponseView) User() UserView { return v.ж.User.View() }
|
||||
func (v RegisterResponseView) Login() Login { return v.ж.Login }
|
||||
func (v RegisterResponseView) NodeKeyExpired() bool { return v.ж.NodeKeyExpired }
|
||||
func (v RegisterResponseView) MachineAuthorized() bool { return v.ж.MachineAuthorized }
|
||||
func (v RegisterResponseView) AuthURL() string { return v.ж.AuthURL }
|
||||
func (v RegisterResponseView) NodeKeySignature() mem.RO { return mem.B(v.ж.NodeKeySignature) }
|
||||
func (v RegisterResponseView) Error() string { return v.ж.Error }
|
||||
|
||||
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
|
||||
var _RegisterResponseViewNeedsRegeneration = RegisterResponse(struct {
|
||||
@@ -595,6 +596,7 @@ var _RegisterResponseViewNeedsRegeneration = RegisterResponse(struct {
|
||||
NodeKeyExpired bool
|
||||
MachineAuthorized bool
|
||||
AuthURL string
|
||||
NodeKeySignature tkatype.MarshaledSignature
|
||||
Error string
|
||||
}{})
|
||||
|
||||
|
Reference in New Issue
Block a user