[Qemu-devel] [PATCH v1 05/17] tests/vm: send proxy environment variables over ssh

Alex Bennée posted 17 patches 6 years, 4 months ago
Maintainers: Fam Zheng <fam@euphon.net>, Brad Smith <brad@comstyle.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Kamil Rytarowski <kamil@netbsd.org>
[Qemu-devel] [PATCH v1 05/17] tests/vm: send proxy environment variables over ssh
Posted by Alex Bennée 6 years, 4 months ago
From: Gerd Hoffmann <kraxel@redhat.com>

Packages are fetched via proxy that way, if configured on the host.
That might be required to pass firewalls, and it allows to route
package downloads through a caching proxy server.

Needs AcceptEnv setup in sshd_config on the guest side to work.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20190617043858.8290-2-kraxel@redhat.com>
---
 tests/vm/basevm.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 4847549592..5e30bac661 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -38,6 +38,13 @@ class BaseVM(object):
     GUEST_PASS = "qemupass"
     ROOT_PASS = "qemupass"
 
+    envvars = [
+        "https_proxy",
+        "http_proxy",
+        "ftp_proxy",
+        "no_proxy",
+    ]
+
     # The script to run in the guest that builds QEMU
     BUILD_SCRIPT = ""
     # The guest name, to be overridden by subclasses
@@ -106,6 +113,8 @@ class BaseVM(object):
                    "-o", "UserKnownHostsFile=" + os.devnull,
                    "-o", "ConnectTimeout=1",
                    "-p", self.ssh_port, "-i", self._ssh_key_file]
+        for var in self.envvars:
+            ssh_cmd += ['-o', "SendEnv=%s" % var ]
         if interactive:
             ssh_cmd += ['-t']
         assert not isinstance(cmd, str)
-- 
2.20.1


Re: [Qemu-devel] [PATCH v1 05/17] tests/vm: send proxy environment variables over ssh
Posted by Philippe Mathieu-Daudé 6 years, 4 months ago
On 6/19/19 9:40 PM, Alex Bennée wrote:
> From: Gerd Hoffmann <kraxel@redhat.com>
> 
> Packages are fetched via proxy that way, if configured on the host.
> That might be required to pass firewalls, and it allows to route
> package downloads through a caching proxy server.
> 
> Needs AcceptEnv setup in sshd_config on the guest side to work.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Tested-by: Thomas Huth <thuth@redhat.com>

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> Message-Id: <20190617043858.8290-2-kraxel@redhat.com>

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  tests/vm/basevm.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 4847549592..5e30bac661 100755
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -38,6 +38,13 @@ class BaseVM(object):
>      GUEST_PASS = "qemupass"
>      ROOT_PASS = "qemupass"
>  
> +    envvars = [
> +        "https_proxy",
> +        "http_proxy",
> +        "ftp_proxy",
> +        "no_proxy",
> +    ]
> +
>      # The script to run in the guest that builds QEMU
>      BUILD_SCRIPT = ""
>      # The guest name, to be overridden by subclasses
> @@ -106,6 +113,8 @@ class BaseVM(object):
>                     "-o", "UserKnownHostsFile=" + os.devnull,
>                     "-o", "ConnectTimeout=1",
>                     "-p", self.ssh_port, "-i", self._ssh_key_file]
> +        for var in self.envvars:
> +            ssh_cmd += ['-o', "SendEnv=%s" % var ]
>          if interactive:
>              ssh_cmd += ['-t']
>          assert not isinstance(cmd, str)
>