From cc5e05fdebbc6a45749c811d9ec2fbee6554cdb9 Mon Sep 17 00:00:00 2001 From: Shireesh Anjal <355479+anjalshireesh@users.noreply.github.com> Date: Fri, 3 Nov 2023 22:39:33 +0530 Subject: [PATCH] Do not anonymize hostnames by default (#18387) Anonymize them only if the parameter `anonymize` is set to `strict --- cmd/admin-handlers.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index 997b154ab..db7c03e7b 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -64,6 +64,8 @@ import ( const ( maxEConfigJSONSize = 262272 kubernetesVersionEndpoint = "https://kubernetes.default.svc/version" + anonymizeParam = "anonymize" + anonymizeStrict = "strict" ) // Only valid query params for mgmt admin APIs. @@ -2027,8 +2029,14 @@ func getKubernetesInfo(dctx context.Context) madmin.KubernetesInfo { func fetchHealthInfo(healthCtx context.Context, objectAPI ObjectLayer, query *url.Values, healthInfoCh chan madmin.HealthInfo, healthInfo madmin.HealthInfo) { hostAnonymizer := createHostAnonymizer() - // anonAddr - Anonymizes hosts in given input string. + + anonParam := query.Get(anonymizeParam) + // anonAddr - Anonymizes hosts in given input string + // (only if the anonymize param is set to srict). anonAddr := func(addr string) string { + if anonParam != anonymizeStrict { + return addr + } newAddr, found := hostAnonymizer[addr] if found { return newAddr @@ -2203,6 +2211,10 @@ func fetchHealthInfo(healthCtx context.Context, objectAPI ObjectLayer, query *ur } anonymizeCmdLine := func(cmdLine string) string { + if anonParam != anonymizeStrict { + return cmdLine + } + if !globalIsDistErasure { // FS mode - single server - hard code to `server1` anonCmdLine := strings.ReplaceAll(cmdLine, globalLocalNodeName, "server1")