mirror of
https://github.com/rancher/rke.git
synced 2025-04-27 11:21:08 +00:00
Unset proxy env vars when ssh bastion is configured with option ignore_proxy_env_vars
This commit is contained in:
parent
a21294e915
commit
8b9385040f
@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
@ -778,6 +779,12 @@ func (c *Cluster) SetupDialers(ctx context.Context, dailersOptions hosts.Dialers
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if c.BastionHost.IgnoreProxyEnvVars {
|
||||
logrus.Debug("Unset http proxy environment variables")
|
||||
for _, v := range util.ProxyEnvVars {
|
||||
os.Unsetenv(v)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ const (
|
||||
WorkerThreads = 50
|
||||
)
|
||||
|
||||
var proxyEnvVars = [3]string{"HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY"}
|
||||
var ProxyEnvVars = [3]string{"HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY"}
|
||||
|
||||
func StrToSemVer(version string) (*semver.Version, error) {
|
||||
v, err := semver.NewVersion(strings.TrimPrefix(version, "v"))
|
||||
@ -146,7 +146,7 @@ func GetEnvVar(key string) (string, string, bool) {
|
||||
|
||||
func PrintProxyEnvVars() {
|
||||
// Print proxy related environment variables
|
||||
for _, proxyEnvVar := range proxyEnvVars {
|
||||
for _, proxyEnvVar := range ProxyEnvVars {
|
||||
var err error
|
||||
// Lookup environment variable
|
||||
if key, value, ok := GetEnvVar(proxyEnvVar); ok {
|
||||
|
Loading…
Reference in New Issue
Block a user