From 2e04abf4bb1f75d81726f04dc8ab5fc39ed4d183 Mon Sep 17 00:00:00 2001 From: Adrien Raffin-Caboisse Date: Fri, 18 Mar 2022 09:40:12 +0100 Subject: [PATCH 1/2] feat(oidc): add debug log --- oidc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/oidc.go b/oidc.go index 29ce351f..e9f9d302 100644 --- a/oidc.go +++ b/oidc.go @@ -129,6 +129,10 @@ func (h *Headscale) OIDCCallback(ctx *gin.Context) { oauth2Token, err := h.oauth2Config.Exchange(context.Background(), code) if err != nil { + log.Error(). + Err(err). + Caller(). + Msg("Could not exchange code for token") ctx.String(http.StatusBadRequest, "Could not exchange code for token") return From 1eafe960b85eac57e1ad4331b15499a97b2f3adb Mon Sep 17 00:00:00 2001 From: Aofei Sheng Date: Sat, 19 Mar 2022 01:18:20 +0800 Subject: [PATCH 2/2] fix: possible panic in `Headscale.scheduledDERPMapUpdateWorker` There is a possible nil pointer dereference panic in the `Headscale.scheduledDERPMapUpdateWorker`. Such as when the embedded DERP server is disabled. --- derp.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/derp.go b/derp.go index 7a9b2367..7abce683 100644 --- a/derp.go +++ b/derp.go @@ -148,7 +148,9 @@ func (h *Headscale) scheduledDERPMapUpdateWorker(cancelChan <-chan struct{}) { case <-ticker.C: log.Info().Msg("Fetching DERPMap updates") h.DERPMap = GetDERPMap(h.cfg.DERP) - h.DERPMap.Regions[h.DERPServer.region.RegionID] = &h.DERPServer.region + if h.cfg.DERP.ServerEnabled { + h.DERPMap.Regions[h.DERPServer.region.RegionID] = &h.DERPServer.region + } namespaces, err := h.ListNamespaces() if err != nil {