From 9b0f72fdbb2b512aa226fcaaafb5fb8c0bf70be2 Mon Sep 17 00:00:00 2001 From: Jake Cohen Date: Wed, 6 Dec 2023 13:25:36 -0800 Subject: [PATCH 1/8] adding proxy field to node executor --- contents/winrm-exec.py | 7 +++++++ plugin.yaml | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/contents/winrm-exec.py b/contents/winrm-exec.py index 75df1d9..af77570 100755 --- a/contents/winrm-exec.py +++ b/contents/winrm-exec.py @@ -164,6 +164,9 @@ def filter(self, record): else: cleanescapingflg = False +if "RD_CONFIG_WINRMPROXY" in os.environ: + winrmproxy = os.getenv("RD_CONFIG_WINRMPROXY") + exec_command = os.getenv("RD_EXEC_COMMAND") log.debug("Command will be executed: " + exec_command) @@ -229,6 +232,7 @@ def filter(self, record): log.debug("operationtimeout:" + str(operationtimeout)) log.debug("exit Behaviour:" + exitBehaviour) log.debug("cleanescapingflg: " + str(cleanescapingflg)) +log.debug("winrmproxy: " + str(winrmproxy)) log.debug("------------------------------------------") if not URLLIB_INSTALLED: @@ -268,6 +272,9 @@ def filter(self, record): if(readtimeout): arguments["read_timeout_sec"] = readtimeout +if(winrmproxy): + arguments["winrm_proxy"] = winrmproxy + if(operationtimeout): arguments["operation_timeout_sec"] = operationtimeout diff --git a/plugin.yaml b/plugin.yaml index 8303e27..2bbe196 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -101,6 +101,15 @@ providers: renderingOptions: groupName: Connection instance-scope-node-attribute: "winrm-readtimeout" + - name: winrmproxy + title: Proxy + description: "Specify a proxy address for communicating with Windows nodes. Example HTTP proxy strings are http://server:port and http://user:pass@server:port. An example SOCKS5 proxy string is socks5://user:pass@server:port." + type: String + required: false + scope: Instance + renderingOptions: + groupName: Connection + instance-scope-node-attribute: "winrm-proxy" - name: operationtimeout title: operation timeout description: "maximum allowed time in seconds for any single wsman HTTP operation (default 20). Note that operation timeouts while receiving output (the only wsman operation that should take any significant time, and where these timeouts are expected) will be silently retried indefinitely. It can be overwriting at node level using `winrm-operationtimeout`" From 0cd4e46a3c971b004404a5bf39807cca92f0ccba Mon Sep 17 00:00:00 2001 From: Jake Cohen Date: Wed, 6 Dec 2023 13:51:41 -0800 Subject: [PATCH 2/8] correct proxy argument --- contents/winrm-exec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contents/winrm-exec.py b/contents/winrm-exec.py index af77570..cae9fe3 100755 --- a/contents/winrm-exec.py +++ b/contents/winrm-exec.py @@ -273,7 +273,7 @@ def filter(self, record): arguments["read_timeout_sec"] = readtimeout if(winrmproxy): - arguments["winrm_proxy"] = winrmproxy + arguments["proxy"] = winrmproxy if(operationtimeout): arguments["operation_timeout_sec"] = operationtimeout From 11ddab0339960a3fa822699c95e5df2152a2269a Mon Sep 17 00:00:00 2001 From: Jake Cohen Date: Wed, 6 Dec 2023 14:38:46 -0800 Subject: [PATCH 3/8] add to file copier --- contents/winrm-filecopier.py | 5 +++++ plugin.yaml | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/contents/winrm-filecopier.py b/contents/winrm-filecopier.py index 9fd4139..33fb93c 100644 --- a/contents/winrm-filecopier.py +++ b/contents/winrm-filecopier.py @@ -278,6 +278,9 @@ def winrm_upload(self, if "RD_CONFIG_CERTPATH" in os.environ: certpath = os.getenv("RD_CONFIG_CERTPATH") +if "RD_CONFIG_WINRMPROXY" in os.environ: + winrmproxy = os.getenv("RD_CONFIG_WINRMPROXY") + if "RD_OPTION_USERNAME" in os.environ and os.getenv("RD_OPTION_USERNAME"): #take user from job username = os.getenv("RD_OPTION_USERNAME").strip('\'') @@ -327,6 +330,8 @@ def winrm_upload(self, arguments["credssp_disable_tlsv1_2"] = diabletls12 +if(winrmproxy): + arguments["proxy"] = winrmproxy if not URLLIB_INSTALLED: log.error("request and urllib3 not installed, try: pip install requests && pip install urllib3") diff --git a/plugin.yaml b/plugin.yaml index 2bbe196..3c5fb35 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -323,6 +323,15 @@ providers: required: false renderingOptions: groupName: Kerberos + - name: winrmproxy + title: Proxy + description: "Specify a proxy address for communicating with Windows nodes. Example HTTP proxy strings are http://server:port and http://user:pass@server:port. An example SOCKS5 proxy string is socks5://user:pass@server:port." + type: String + required: false + scope: Instance + renderingOptions: + groupName: Connection + instance-scope-node-attribute: "winrm-proxy" - name: WinRMCheck title: WinRM Check Step description: Check the connection with a remote node using winrm-python From 69da9dab4d9b6ebc09df166f5e39d88c362b5172 Mon Sep 17 00:00:00 2001 From: Jake Cohen Date: Wed, 10 Jan 2024 09:20:17 -0800 Subject: [PATCH 4/8] remove duplicate proxy property --- plugin.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/plugin.yaml b/plugin.yaml index 7c7c781..b379022 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -371,13 +371,6 @@ providers: required: false renderingOptions: groupName: Kerberos - - name: winrmproxy - title: Proxy - description: "Specify a proxy address for communicating with Windows nodes. Example HTTP proxy strings are http://server:port and http://user:pass@server:port. An example SOCKS5 proxy string is socks5://user:pass@server:port." - type: String - renderingOptions: - groupName: Connection - instance-scope-node-attribute: "winrm-proxy" - name: enabledhttpdebug title: Enable HTTP logging in debug mode description: "Print extra http logging in debug mode" From 6d0d6c24a98c9e37fc637e256615cac39c2c9a10 Mon Sep 17 00:00:00 2001 From: Jake Cohen Date: Wed, 10 Jan 2024 12:11:21 -0800 Subject: [PATCH 5/8] fix proxy property --- contents/winrm-exec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contents/winrm-exec.py b/contents/winrm-exec.py index af5ce97..1d45053 100755 --- a/contents/winrm-exec.py +++ b/contents/winrm-exec.py @@ -186,6 +186,7 @@ def httpclient_log(*args): if "RD_CONFIG_WINRMPROXY" in os.environ: winrmproxy = os.getenv("RD_CONFIG_WINRMPROXY") + log.debug("winrmproxy: " + str(winrmproxy)) if "RD_CONFIG_ENABLEDHTTPDEBUG" in os.environ: if os.getenv("RD_CONFIG_ENABLEDHTTPDEBUG") == "true": @@ -264,7 +265,6 @@ def httpclient_log(*args): log.debug("operationtimeout:" + str(operationtimeout)) log.debug("exit Behaviour:" + exitBehaviour) log.debug("cleanescapingflg: " + str(cleanescapingflg)) -log.debug("winrmproxy: " + str(winrmproxy)) log.debug("enabledHttpDebug: " + str(enabledHttpDebug)) log.debug("retryConnection: " + str(retryconnection)) log.debug("retryConnectionDelay: " + str(retryconnectiondelay)) From e4fe21cabf9055dbfb251efc94f9a513aa2c9ae9 Mon Sep 17 00:00:00 2001 From: Jake Cohen Date: Thu, 11 Jan 2024 09:37:48 -0800 Subject: [PATCH 6/8] add property back to file copier --- plugin.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin.yaml b/plugin.yaml index b379022..d2f5334 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -371,6 +371,15 @@ providers: required: false renderingOptions: groupName: Kerberos + - name: winrmproxy + title: Proxy + description: "Specify a proxy address for communicating with Windows nodes. Example HTTP proxy strings are http://server:port and http://user:pass@server:port. An example SOCKS5 proxy string is socks5://user:pass@server:port." + type: String + required: false + scope: Instance + renderingOptions: + groupName: Connection + instance-scope-node-attribute: "winrm-proxy" - name: enabledhttpdebug title: Enable HTTP logging in debug mode description: "Print extra http logging in debug mode" From 8505b39c1763044830800d5e8f55bd262c90be6b Mon Sep 17 00:00:00 2001 From: Jake Cohen Date: Thu, 11 Jan 2024 12:27:40 -0800 Subject: [PATCH 7/8] define winrmproxy var --- contents/winrm-exec.py | 1 + 1 file changed, 1 insertion(+) diff --git a/contents/winrm-exec.py b/contents/winrm-exec.py index 1d45053..a70de9f 100755 --- a/contents/winrm-exec.py +++ b/contents/winrm-exec.py @@ -138,6 +138,7 @@ def httpclient_log(*args): retryconnection = 1 retryconnectiondelay = 0 username = None +winrmproxy = None if "RD_CONFIG_AUTHTYPE" in os.environ: authentication = os.getenv("RD_CONFIG_AUTHTYPE") From 7d4832809c6e9a012f22ab546b9c524905898368 Mon Sep 17 00:00:00 2001 From: Jake Cohen Date: Thu, 11 Jan 2024 12:28:30 -0800 Subject: [PATCH 8/8] define winrm proxy var for filecopier --- contents/winrm-filecopier.py | 1 + 1 file changed, 1 insertion(+) diff --git a/contents/winrm-filecopier.py b/contents/winrm-filecopier.py index 68d143b..784fe73 100644 --- a/contents/winrm-filecopier.py +++ b/contents/winrm-filecopier.py @@ -267,6 +267,7 @@ def winrm_upload(self, retryconnectiondelay = 0 certpath = None username = None +winrmproxy = None if os.environ.get('RD_CONFIG_OVERRIDE') == 'true': override = True