mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-02 03:33:05 +00:00
Make sure givenname is set for preauthkeys
This commit is contained in:
parent
9ebeb3d7e4
commit
802eb931d1
2 changed files with 15 additions and 0 deletions
13
api.go
13
api.go
|
@ -601,8 +601,21 @@ func (h *Headscale) handleAuthKey(
|
||||||
h.RefreshMachine(machine, registerRequest.Expiry)
|
h.RefreshMachine(machine, registerRequest.Expiry)
|
||||||
} else {
|
} else {
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
|
|
||||||
|
givenName, err := h.GenerateGivenName(registerRequest.Hostinfo.Hostname)
|
||||||
|
if err != nil {
|
||||||
|
log.Error().
|
||||||
|
Caller().
|
||||||
|
Str("func", "RegistrationHandler").
|
||||||
|
Str("hostinfo.name", registerRequest.Hostinfo.Hostname).
|
||||||
|
Err(err)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
machineToRegister := Machine{
|
machineToRegister := Machine{
|
||||||
Hostname: registerRequest.Hostinfo.Hostname,
|
Hostname: registerRequest.Hostinfo.Hostname,
|
||||||
|
GivenName: givenName,
|
||||||
NamespaceID: pak.Namespace.ID,
|
NamespaceID: pak.Namespace.ID,
|
||||||
MachineKey: machineKeyStr,
|
MachineKey: machineKeyStr,
|
||||||
RegisterMethod: RegisterMethodAuthKey,
|
RegisterMethod: RegisterMethodAuthKey,
|
||||||
|
|
|
@ -356,6 +356,8 @@ func (s *IntegrationDERPTestSuite) TestPingAllPeersByHostname() {
|
||||||
hostnames, err := getDNSNames(&s.headscale)
|
hostnames, err := getDNSNames(&s.headscale)
|
||||||
assert.Nil(s.T(), err)
|
assert.Nil(s.T(), err)
|
||||||
|
|
||||||
|
log.Printf("Hostnames: %#v\n", hostnames)
|
||||||
|
|
||||||
for hostname, tailscale := range s.tailscales {
|
for hostname, tailscale := range s.tailscales {
|
||||||
for _, peername := range hostnames {
|
for _, peername := range hostnames {
|
||||||
if strings.Contains(peername, hostname) {
|
if strings.Contains(peername, hostname) {
|
||||||
|
|
Loading…
Reference in a new issue