mirror of
https://github.com/juanfont/headscale.git
synced 2025-08-26 00:17:48 +00:00
Make sure nodes can reauthenticate
This commit fixes an issue where nodes were not able to reauthenticate.
This commit is contained in:
10
machine.go
10
machine.go
@@ -270,6 +270,15 @@ func (h *Headscale) ExpireMachine(machine *Machine) {
|
||||
h.db.Save(machine)
|
||||
}
|
||||
|
||||
// RefreshMachine takes a Machine struct and sets the expire field to now.
|
||||
func (h *Headscale) RefreshMachine(machine *Machine, expiry time.Time) {
|
||||
now := time.Now()
|
||||
|
||||
machine.LastSuccessfulUpdate = &now
|
||||
machine.Expiry = &expiry
|
||||
h.db.Save(machine)
|
||||
}
|
||||
|
||||
// DeleteMachine softs deletes a Machine from the database.
|
||||
func (h *Headscale) DeleteMachine(machine *Machine) error {
|
||||
err := h.RemoveSharedMachineFromAllNamespaces(machine)
|
||||
@@ -644,6 +653,7 @@ func (h *Headscale) RegisterMachine(
|
||||
machine.NamespaceID = namespace.ID
|
||||
machine.Registered = true
|
||||
machine.RegisterMethod = RegisterMethodCLI
|
||||
machine.Expiry = &requestedTime
|
||||
h.db.Save(&machine)
|
||||
|
||||
log.Trace().
|
||||
|
Reference in New Issue
Block a user