Skyler Grey | d7e1acd | 2024-06-22 14:42:11 +0000 | [diff] [blame] | 1 | From 74a12f91542ee1323b69675b0480168a22ad5b17 Mon Sep 17 00:00:00 2001 |
| 2 | From: Skyler Grey <minion@clicks.codes> |
| 3 | Date: Sat, 29 Jun 2024 14:16:46 +0000 |
| 4 | Subject: [PATCH] fix(nginx): Continue if node Name is ComputedName |
| 5 | |
| 6 | In the headscale case, the node Name ends up the same as the |
| 7 | ComputedName. This causes tailscale-nginx-auth to fail extracting the |
| 8 | tailnet name and 403 all devices. |
| 9 | |
| 10 | This patch skips tailnet extraction in this case. |
| 11 | |
| 12 | Signed-off-by: Skyler Grey <minion@clicks.codes> |
| 13 | --- |
| 14 | cmd/nginx-auth/nginx-auth.go | 2 +- |
| 15 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 16 | |
| 17 | diff --git a/cmd/nginx-auth/nginx-auth.go b/cmd/nginx-auth/nginx-auth.go |
| 18 | index d2e9468e558ea..c6a8ff30fbb8a 100644 |
| 19 | --- a/cmd/nginx-auth/nginx-auth.go |
| 20 | +++ b/cmd/nginx-auth/nginx-auth.go |
| 21 | @@ -66,7 +66,7 @@ func main() { |
| 22 | // will be empty because the tailnet of the sharee is not exposed. |
| 23 | var tailnet string |
| 24 | |
| 25 | - if !info.Node.Hostinfo.ShareeNode() { |
| 26 | + if !info.Node.Hostinfo.ShareeNode() && info.Node.Name != info.Node.ComputedName { |
| 27 | var ok bool |
| 28 | _, tailnet, ok = strings.Cut(info.Node.Name, info.Node.ComputedName+".") |
| 29 | if !ok { |
| 30 | |