microsoft/mdatp-xplat

mde_installer broken by run_quietly function

collinjc opened this issue · 2 comments

This issue may look suspiciously like the one here, and that's because it is. I'm re-opening this because it is still broken. Below is my last comment on issue #25:

I don't believe it is, actually [fixed]. While I do see that my pull request was apparently merged in, it appears to have been obliterated, leaving the same broken functionality since the introduction of run_quietly. I have created a brand new machine running Fedora 35, checked out the current branch, and ran

sudo ./mde_installer -i

and the script hangs indefinitely at

[>] installing yum-utils

As mentioned before, this is because run_quietly is suppressing the output of the command (in this case yum install yum-utils). Without ASSUMEYES being asserted yum and dnf (most package managers, I assume) require the user to respond with 'y' to proceed. I can only assume that you are either always running

sudo ./mde_installer.sh -i -y

or you are running this on a machine that already has all of the required dependencies installed, and therefore does not need to invoke the package manager. Remember that neither of these cases are representative of the potential install-base. I'd certainly be happy to create another pull request to fix this functionality yet again, hopefully this time in a timely manner and without immediately removing the fix. In the meantime, this is a problem that is trivial to reproduce. Simply perform a fresh installation of your distro of choice, and execute mde_installer.sh without the -y option.

Originally posted by @collinjc in #25 (comment)

Hi @collinjc, I am working on closing the opened issue for mde_installer script. Is this issue still open, can I go ahead and work on this issue? Thanks

I just checked and found that it is still broken. I have opened another PR (#73) to fix it again. The problem that this fixes is that, on a fresh system on which mde_installer.sh has not yet been run, several packages need to be installed by the package manager (dependencies, and Microsoft packages such as mdatp itself). Unless the -y option is passed, mde_installer.sh hangs indefinitely, as the package manager is waiting for confirmation from the user.

This fix simply wraps the functionality the run_quietly function in a check for the -y option. This means that output is only suppressed when -y is passed. If -y is not passed to mde_installer.sh, anything passed to the run_quietly function will simply be evaluated, rather than having its output suppressed. This allows the user to respond to any prompts.

While there are multiple ways to solve this problem, I feel that this is the simplest solution that doesn't result in software blindly being installed on the user's machine without their explicit consent.