From e85562268d49323e878d0ac77c3fc1f0b5ce4725 Mon Sep 17 00:00:00 2001 From: Laurent Marchaud Date: Fri, 19 Aug 2022 15:48:35 +0200 Subject: [PATCH] Switch to using nodeKey instead of machineKey for expired machines registration Signed-off-by: Laurent Marchaud --- api.go | 2 +- machine.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api.go b/api.go index 1bf3edb3..ac5f2a3f 100644 --- a/api.go +++ b/api.go @@ -348,7 +348,7 @@ func (h *Headscale) RegistrationHandler( machine.Expiry = &time.Time{} h.registrationCache.Set( - machineKeyStr, + NodePublicKeyStripPrefix(registerRequest.NodeKey), *machine, registerCacheExpiration, ) diff --git a/machine.go b/machine.go index 0f291de7..1a48a3e1 100644 --- a/machine.go +++ b/machine.go @@ -803,7 +803,7 @@ func (h *Headscale) RegisterMachineFromAuthCallback( ) if err == nil { - h.registrationCache.Delete(machineKeyStr) + h.registrationCache.Delete(nodeKeyStr) } return machine, err