New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make guest tools last so pre-reqs are in place #358

Merged
merged 1 commit into from Jan 18, 2019

Conversation

Projects
None yet
2 participants
@jmartin-r7
Copy link
Contributor

jmartin-r7 commented Jan 4, 2019

fixes #216

VMware tools requires the vcredist2008 installed and a reboot occur before installation on windows 2008r2. This moves guest tools to install last just before cleanup.

Thanks to @jschulist for the report and @usmcfiredog for the additional validation that this issue persists.

@usmcfiredog

This comment has been minimized.

Copy link

usmcfiredog commented Jan 5, 2019

This still didn't work for me. I didn't even see the Vmware tools folder in C:\windows\temp folder either. I will keep looking into this and try to report back some more useful information

@usmcfiredog

This comment has been minimized.

Copy link

usmcfiredog commented Jan 6, 2019

So I moved up the vm tools to the top of the section where you had it. It is not sensing that it was a Vmware install and doesn't go to the command to install. Bellow is the output for the vm tools bat.

==> vmware-iso: Provisioning with shell script: /Users/nicholaskasprinski/Documents/metasploitable3-vmt/metasploitable3/packer/templates/../../scripts/installs/vm-guest-tools.bat
vmware-iso:
vmware-iso: C:\Users\vagrant>if not exist "C:\Windows\Temp\7zInstaller-x64.msi" (powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z1604-x64.msi', 'C:\Windows\Temp\7zInstaller-x64.msi')" 0<NUL )
vmware-iso:
vmware-iso: C:\Users\vagrant>msiexec /qb /i C:\Windows\Temp\7zInstaller-x64.msi
vmware-iso:
vmware-iso: C:\Users\vagrant>if "" EQU "vmware-iso" goto :vmware
vmware-iso:
vmware-iso: C:\Users\vagrant>if "" EQU "virtualbox-iso" goto :virtualbox
vmware-iso:
vmware-iso: C:\Users\vagrant>if "" EQU "parallels-iso" goto :parallels
vmware-iso:
vmware-iso: C:\Users\vagrant>goto :done
vmware-iso:
vmware-iso: C:\Users\vagrant>msiexec /qb /x C:\Windows\Temp\7zInstaller-x64.msi

@usmcfiredog

This comment has been minimized.

Copy link

usmcfiredog commented Jan 6, 2019

ok so I find that the bat file loses all formatting and in such doesn't execute properly.

@jmartin-r7

This comment has been minimized.

Copy link
Contributor

jmartin-r7 commented Jan 7, 2019

@usmcfiredog thanks for the recheck, looks like there may be a bug in packer as the ENV is not getting set as defined. Looking closer.

@usmcfiredog

This comment has been minimized.

Copy link

usmcfiredog commented Jan 7, 2019

@jmartin-r7 The other thing I did notice is that when I removed all of the conditionals and just had it for VMware the install seemed to just hang. When checking task manager it shows the setup running but not cpu usage or anything

@jmartin-r7

This comment has been minimized.

Copy link
Contributor

jmartin-r7 commented Jan 9, 2019

Looks like the env vars are not set by packer for window-shell in this instance, looking into why.

@usmcfiredog

This comment has been minimized.

Copy link

usmcfiredog commented Jan 16, 2019

still "freezing" up on the install of the vm tools. The vm is still functioning just the setup process isn't using any cpu or anything.

@usmcfiredog

This comment has been minimized.

Copy link

usmcfiredog commented Jan 17, 2019

I think it might be failing to install a runtime dll. When I ran the setup from the command line manually it states that the Microsoft Runtime DLL installer failed to complete installation.

@jmartin-r7

This comment has been minimized.

Copy link
Contributor

jmartin-r7 commented Jan 17, 2019

Now branch should address the hang during install, this was due to fusion supplying 10.3.x versions of vmware tools which required vcredist2017 and depends on a KB that is intentionally not applied to metasploitable3. See https://kb.vmware.com/s/article/55798

@usmcfiredog

This comment has been minimized.

Copy link

usmcfiredog commented Jan 17, 2019

Works good

Update guest tools install for better vmware support
* make guest tools last so pre-reqs are in place

Packer 1.3.x and possibly more does not inject enviornment
variables as expected into `windows-shell` provisioners, moving
script that requires these into a `shell` provisioner.

* do not trust default uploaded windows.iso

Packer in some cases will upload windows.iso from the host
building the VM, since server 2008 needs a specific older
version of tools this can cause problems.

Example issue:
VMware Fusion 11 on macOS Mojave will supply 10.3.x in windows.iso
and will hit https://kb.vmware.com/s/article/55798 due the patch level
expectaions that are intentionally not met for Windows 2008r2.

@jmartin-r7 jmartin-r7 force-pushed the jmartin-r7:fix_vmware_tools branch from dcc2783 to a4ecd26 Jan 18, 2019

@jmartin-r7 jmartin-r7 merged commit a4ecd26 into rapid7:master Jan 18, 2019

jmartin-r7 added a commit that referenced this pull request Jan 18, 2019

@jmartin-r7 jmartin-r7 deleted the jmartin-r7:fix_vmware_tools branch Jan 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment