From cc898d5661cebe4078ecc944eab246f3018463c4 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 6 Aug 2026 12:15:44 -0400 Subject: [PATCH] Diseregard proxy for various confluent interactions In some environments, http proxy is set for internet, but does not work internally. Accommodate by suspending the proxy in confluent contexts. --- .../common/initramfs/opt/confluent/bin/apiclient | 4 ++++ confluent_osdeploy/common/profile/scripts/functions | 13 +++++++------ confluent_osdeploy/common/profile/scripts/setupssh | 2 ++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient b/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient index 9c14201b..1ae22689 100644 --- a/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient +++ b/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient @@ -24,6 +24,10 @@ except ImportError: json = None hmac = None +# Ignore proxy-based environment variables +for proxy_var in ['http_proxy', 'https_proxy', 'HTTP_PROXY', 'HTTPS_PROXY', 'ALL_PROXY', 'all_proxy', 'NO_PROXY', 'no_proxy']: + os.environ.pop(proxy_var, None) + class InvalidApiKey(Exception): pass diff --git a/confluent_osdeploy/common/profile/scripts/functions b/confluent_osdeploy/common/profile/scripts/functions index d5209eeb..4b17d3ad 100644 --- a/confluent_osdeploy/common/profile/scripts/functions +++ b/confluent_osdeploy/common/profile/scripts/functions @@ -4,7 +4,7 @@ function test_mgr() { if [[ "$whost" == *:* ]] && [[ "$whost" != *[* ]] ; then whost="[$whost]" fi - if curl -gs https://${whost}/confluent-api/ > /dev/null; then + if curl -gs -x "" https://${whost}/confluent-api/ > /dev/null; then return 0 fi return 1 @@ -64,9 +64,9 @@ function set_confluent_vars() { } fetch_remote() { - curlargs="" + curlargs=(-x "") if [ -f /etc/confluent/ca.pem ]; then - curlargs=" --cacert /etc/confluent/ca.pem" + curlargs=(-x "" --cacert /etc/confluent/ca.pem) fi set_confluent_vars mkdir -p $(dirname $1) @@ -74,7 +74,7 @@ fetch_remote() { if [[ "$whost" == *:* ]] && [[ "$whost" != *[* ]] ; then whost="[$whost]" fi - curl -gf -sS $curlargs https://$whost/confluent-public/os/$confluent_profile/scripts/$1 > $1 + curl -gf -sS "${curlargs[@]}" https://$whost/confluent-public/os/$confluent_profile/scripts/$1 > $1 if [ $? != 0 ]; then echo $1 failed to download; return 1; fi } @@ -175,8 +175,9 @@ run_remote() { run_remote_python() { echo set_confluent_vars + curlargs=(-x "") if [ -f /etc/confluent/ca.pem ]; then - curlargs=" --cacert /etc/confluent/ca.pem" + curlargs=(-x "" --cacert /etc/confluent/ca.pem) fi echo '---------------------------------------------------------------------------' echo Running python script "'$*'" from https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/ @@ -189,7 +190,7 @@ run_remote_python() { if [[ "$whost" == *:* ]] && [[ "$whost" != *[* ]] ; then whost="[$whost]" fi - curl -gf -sS $curlargs https://$whost/confluent-public/os/$confluent_profile/scripts/$1 > $1 + curl -gf -sS "${curlargs[@]}" https://$whost/confluent-public/os/$confluent_profile/scripts/$1 > $1 if [ $? != 0 ]; then echo "'$*'" failed to download; return 1; fi confluentpython $* retcode=$? diff --git a/confluent_osdeploy/common/profile/scripts/setupssh b/confluent_osdeploy/common/profile/scripts/setupssh index 59f06375..5efd1b21 100644 --- a/confluent_osdeploy/common/profile/scripts/setupssh +++ b/confluent_osdeploy/common/profile/scripts/setupssh @@ -2,6 +2,8 @@ [ -f /etc/confluent/functions ] && . /etc/confluent/functions [ -f /opt/confluent/bin/apiclient ] && confapiclient=/opt/confluent/bin/apiclient [ -f /etc/confluent/apiclient ] && confapiclient=/etc/confluent/apiclient +unset http_proxy +unset https_proxy for pubkey in /etc/ssh/ssh_host*key.pub; do if [ "$pubkey" = /etc/ssh/ssh_host_key.pub ]; then continue