From ee652be312941fd67dfa90d5d2d2e5a37284e88d Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Sat, 15 Dec 2018 20:25:36 -0500 Subject: [PATCH] tests: fix rkt command environment (#5011) The environment variables needed for envoking `rkt` command line should include host PATH (to access `iptables`). Given that the command runs outside the VM, untrusted task environment variables should NOT be honored here. We do this already with `rkt`, but the change is quite subtle to miss when refactoring. --- drivers/rkt/driver.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/rkt/driver.go b/drivers/rkt/driver.go index 579324ec1..118ee026e 100644 --- a/drivers/rkt/driver.go +++ b/drivers/rkt/driver.go @@ -661,10 +661,13 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *cstru Args: runArgs, ResourceLimits: true, Resources: cfg.Resources, - Env: cfg.EnvList(), - TaskDir: cfg.TaskDir().Dir, - StdoutPath: cfg.StdoutPath, - StderrPath: cfg.StderrPath, + + // Use rktEnv, the environment needed for running rkt, not the task env + Env: rktEnv.List(), + + TaskDir: cfg.TaskDir().Dir, + StdoutPath: cfg.StdoutPath, + StderrPath: cfg.StderrPath, } ps, err := execImpl.Launch(execCmd) if err != nil {