From 8405813c121a07605be8a89c9d376f710698119f Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Fri, 7 Jul 2023 09:14:49 -0700 Subject: [PATCH] Fix rootless node password (#7887) Signed-off-by: Derek Nola --- pkg/server/router.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/server/router.go b/pkg/server/router.go index d9209cf029..2232158b00 100644 --- a/pkg/server/router.go +++ b/pkg/server/router.go @@ -8,6 +8,7 @@ import ( "net" "net/http" "os" + "path" "path/filepath" "strconv" "strings" @@ -489,7 +490,7 @@ func verifyLocalPassword(ctx context.Context, config *Config, mu *sync.Mutex, de // use same password file location that the agent creates nodePasswordRoot := "/" if config.ControlConfig.Rootless { - nodePasswordRoot = filepath.Join(config.ControlConfig.DataDir, "agent") + nodePasswordRoot = filepath.Join(path.Dir(config.ControlConfig.DataDir), "agent") } nodeConfigPath := filepath.Join(nodePasswordRoot, "etc", "rancher", "node") nodePasswordFile := filepath.Join(nodeConfigPath, "password")