mirror of
https://github.com/juanfont/headscale.git
synced 2025-01-04 00:09:34 +01:00
Fixing nil issue
This commit is contained in:
parent
64185cc2bc
commit
e60ceefea9
11
api.go
11
api.go
@ -242,7 +242,7 @@ func (h *Headscale) getMapResponse(mKey wgkey.Key, req tailcfg.MapRequest, m Mac
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dnsConfig *tailcfg.DNSConfig
|
var dnsConfig *tailcfg.DNSConfig
|
||||||
if h.cfg.DNSConfig.Proxied { // if MagicDNS is enabled
|
if h.cfg.DNSConfig != nil && h.cfg.DNSConfig.Proxied { // if MagicDNS is enabled
|
||||||
// TODO(juanfont): We should not be regenerating this all the time
|
// TODO(juanfont): We should not be regenerating this all the time
|
||||||
// And we should only send the domains of the peers (this own namespace + those from the shared peers)
|
// And we should only send the domains of the peers (this own namespace + those from the shared peers)
|
||||||
namespaces, err := h.ListNamespaces()
|
namespaces, err := h.ListNamespaces()
|
||||||
@ -329,6 +329,11 @@ func (h *Headscale) handleAuthKey(c *gin.Context, db *gorm.DB, idKey wgkey.Key,
|
|||||||
resp := tailcfg.RegisterResponse{}
|
resp := tailcfg.RegisterResponse{}
|
||||||
pak, err := h.checkKeyValidity(req.Auth.AuthKey)
|
pak, err := h.checkKeyValidity(req.Auth.AuthKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error().
|
||||||
|
Str("func", "handleAuthKey").
|
||||||
|
Str("machine", m.Name).
|
||||||
|
Err(err).
|
||||||
|
Msg("Failed authentication via AuthKey")
|
||||||
resp.MachineAuthorized = false
|
resp.MachineAuthorized = false
|
||||||
respBody, err := encode(resp, &idKey, h.privateKey)
|
respBody, err := encode(resp, &idKey, h.privateKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -341,10 +346,6 @@ func (h *Headscale) handleAuthKey(c *gin.Context, db *gorm.DB, idKey wgkey.Key,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.Data(200, "application/json; charset=utf-8", respBody)
|
c.Data(200, "application/json; charset=utf-8", respBody)
|
||||||
log.Error().
|
|
||||||
Str("func", "handleAuthKey").
|
|
||||||
Str("machine", m.Name).
|
|
||||||
Msg("Failed authentication via AuthKey")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user