diff --git a/machine.go b/machine.go index b2581ab0..e0b9130b 100644 --- a/machine.go +++ b/machine.go @@ -370,7 +370,21 @@ func (h *Headscale) ExpireMachine(machine *Machine) { // RenameMachine takes a Machine struct and sets the expire field to now. func (h *Headscale) RenameMachine(machine *Machine, newName string) { - machine.Nickname = newName + newNickname, err := NormalizeToFQDNRules( + newName, + h.cfg.OIDC.StripEmaildomain, + ) + if err != nil { + log.Error(). + Caller(). + Str("func", "RenameMachine"). + Str("machine", machine.Name). + Str("newName", newName). + Err(err) + + return + } + machine.Nickname = newNickname h.setLastStateChangeToNow(machine.Namespace.Name)