agent: Use PIPE for stdin, stdout, and stderr in dropper

The dropper is expected to detatch the child monkey agent process. If
stdin, stdout, and stderr are set to `None`, the child process inherits
them. Since the child process inherits the parent's file descriptors and
holds them open, issues like #1026 can occur.
This commit is contained in:
Mike Salvatore 2021-03-09 11:35:38 -05:00
parent 4ac7c01976
commit e7528e9544
1 changed files with 3 additions and 1 deletions

View File

@ -134,7 +134,9 @@ class MonkeyDrops(object):
'monkey_commandline': inner_monkey_cmdline}
monkey_process = subprocess.Popen(monkey_cmdline, shell=True,
stdin=None, stdout=None, stderr=None,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True, creationflags=DETACHED_PROCESS)
LOG.info("Executed monkey process (PID=%d) with command line: %s",