Masking http(s)_proxy password from output.
parent
dfb81ddb32
commit
ed550a0551
|
@ -21,7 +21,9 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
@ -47,6 +49,16 @@ func showVersionInfo(k8sVersion string, cr cruntime.Manager) {
|
||||||
out.Infof("opt {{.docker_option}}", out.V{"docker_option": v})
|
out.Infof("opt {{.docker_option}}", out.V{"docker_option": v})
|
||||||
}
|
}
|
||||||
for _, v := range config.DockerEnv {
|
for _, v := range config.DockerEnv {
|
||||||
|
parts := strings.Split(v, "=")
|
||||||
|
if len(parts) == 2 {
|
||||||
|
key := strings.ToUpper(parts[0])
|
||||||
|
if key == "HTTP_PROXY" || key == "HTTPS_PROXY" {
|
||||||
|
pattern := `//(\w+):\w+@`
|
||||||
|
regexpPattern := regexp.MustCompile(pattern)
|
||||||
|
value := regexpPattern.ReplaceAllString(parts[1], "//$1:*****@")
|
||||||
|
v = key + "=" + value
|
||||||
|
}
|
||||||
|
}
|
||||||
out.Infof("env {{.docker_env}}", out.V{"docker_env": v})
|
out.Infof("env {{.docker_env}}", out.V{"docker_env": v})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -723,9 +723,15 @@ func validateNetwork(h *host.Host, r command.Runner, imageRepository string) (st
|
||||||
out.Styled(style.Internet, "Found network options:")
|
out.Styled(style.Internet, "Found network options:")
|
||||||
optSeen = true
|
optSeen = true
|
||||||
}
|
}
|
||||||
|
k = strings.ToUpper(k) // let's get the key right away to mask password from output
|
||||||
|
// If http(s)_proxy contains password, let's not splatter on the screen
|
||||||
|
if k == "HTTP_PROXY" || k == "HTTPS_PROXY" {
|
||||||
|
pattern := `//(\w+):\w+@`
|
||||||
|
regexpPattern := regexp.MustCompile(pattern)
|
||||||
|
v = regexpPattern.ReplaceAllString(v, "//$1:*****@")
|
||||||
|
}
|
||||||
out.Infof("{{.key}}={{.value}}", out.V{"key": k, "value": v})
|
out.Infof("{{.key}}={{.value}}", out.V{"key": k, "value": v})
|
||||||
ipExcluded := proxy.IsIPExcluded(ip) // Skip warning if minikube ip is already in NO_PROXY
|
ipExcluded := proxy.IsIPExcluded(ip) // Skip warning if minikube ip is already in NO_PROXY
|
||||||
k = strings.ToUpper(k) // for http_proxy & https_proxy
|
|
||||||
if (k == "HTTP_PROXY" || k == "HTTPS_PROXY") && !ipExcluded && !warnedOnce {
|
if (k == "HTTP_PROXY" || k == "HTTPS_PROXY") && !ipExcluded && !warnedOnce {
|
||||||
out.WarningT("You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP ({{.ip_address}}).", out.V{"ip_address": ip})
|
out.WarningT("You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP ({{.ip_address}}).", out.V{"ip_address": ip})
|
||||||
out.Styled(style.Documentation, "Please see {{.documentation_url}} for more details", out.V{"documentation_url": "https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/"})
|
out.Styled(style.Documentation, "Please see {{.documentation_url}} for more details", out.V{"documentation_url": "https://minikube.sigs.k8s.io/docs/handbook/vpn_and_proxy/"})
|
||||||
|
|
Loading…
Reference in New Issue