mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-25 01:07:52 +00:00
Make sure comparison of nodekey is on the same format
This commit is contained in:
parent
e9d5214d1c
commit
ff8c961dbb
4
api.go
4
api.go
@ -127,7 +127,7 @@ func (h *Headscale) RegistrationHandler(ctx *gin.Context) {
|
|||||||
// - Trying to log out (sending a expiry in the past)
|
// - Trying to log out (sending a expiry in the past)
|
||||||
// - A valid, registered machine, looking for the node map
|
// - A valid, registered machine, looking for the node map
|
||||||
// - Expired machine wanting to reauthenticate
|
// - Expired machine wanting to reauthenticate
|
||||||
if machine.NodeKey == req.NodeKey.String() {
|
if machine.NodeKey == NodePublicKeyStripPrefix(req.NodeKey) {
|
||||||
// The client sends an Expiry in the past if the client is requesting to expire the key (aka logout)
|
// The client sends an Expiry in the past if the client is requesting to expire the key (aka logout)
|
||||||
// https://github.com/tailscale/tailscale/blob/main/tailcfg/tailcfg.go#L648
|
// https://github.com/tailscale/tailscale/blob/main/tailcfg/tailcfg.go#L648
|
||||||
if !req.Expiry.IsZero() && req.Expiry.UTC().Before(now) {
|
if !req.Expiry.IsZero() && req.Expiry.UTC().Before(now) {
|
||||||
@ -146,7 +146,7 @@ func (h *Headscale) RegistrationHandler(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The NodeKey we have matches OldNodeKey, which means this is a refresh after a key expiration
|
// The NodeKey we have matches OldNodeKey, which means this is a refresh after a key expiration
|
||||||
if machine.NodeKey == req.OldNodeKey.String() &&
|
if machine.NodeKey == NodePublicKeyStripPrefix(req.OldNodeKey) &&
|
||||||
!machine.isExpired() {
|
!machine.isExpired() {
|
||||||
h.handleMachineRefreshKey(ctx, machineKey, req, *machine)
|
h.handleMachineRefreshKey(ctx, machineKey, req, *machine)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user