Make sure nodes can reauthenticate
This commit fixes an issue where nodes were not able to reauthenticate.
This commit is contained in:
parent
200c10e48c
commit
e600ead3e9
3 changed files with 83 additions and 30 deletions
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().
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue