From 50dcb8bb753210dd5bee08e9079f64fa2cfe3e5a Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Thu, 18 Nov 2021 08:50:53 +0000 Subject: [PATCH] Use valid handler for registered authkey machines --- api.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/api.go b/api.go index 45b59d3c..a92b5e6b 100644 --- a/api.go +++ b/api.go @@ -130,8 +130,15 @@ func (h *Headscale) RegistrationHandler(ctx *gin.Context) { return } - if machine.Registered && machine.Expiry.UTC().After(now) { - h.handleMachineValidRegistration(ctx, machineKey, req, *machine) + // We dont care about expiry time if the method is AuthKey, as we dont set that. + if machine.Registered && machine.RegisterMethod == RegisterMethodAuthKey { + h.handleMachineValidRegistration(ctx, machineKey, *machine) + + return + } + + if machine.Registered && !machine.isExpired() { + h.handleMachineValidRegistration(ctx, machineKey, *machine) return }