Link to home
Start Free TrialLog in
Avatar of Indyrb
IndyrbFlag for United States of America

asked on

VMWARE hardening and powerCLI

I need to configu the host or the VMs on the host as follows:

Anyone have a powerCLI or script to complete this, as we have hundreds of VMS to do individually

Thanks for your help in advance


Verify DiskShrink Is Disabled
Verify DiskWiper Is Disabled
Verify MAC Address Changes Is Set to Reject
The ESXi Host Firewall Must Be Configured to Restrict Access to Services Running on the Host
Disable VM to VM Communication through VMCI
Verify That Floppy Devices Are Not Present
Verify That CD-ROMs Are Not Present
Verify That Parallel Ports Are Not Present
Verify That Serial Ports Are Not Present
Verify That a USB Controller Is Not Present
turn off copy between guest os and remote console
vmware tools auto upgrade
Verify That Paste Is Disabled between Guest OS and Remote Console
Verify Option to Override VMware Tools Settings Is Disabled
Prevent Others Users from Spying on Administrator Remote Consoles
Verify That the Number of Log Files to Keep Is Equal to 10
Verify That Log Rotate Size for Virtual Machines Is Less than or Equal to 100KB
Prevent Unauthorized Connection or Removal of Devices
Prevent Unauthorized Modification of Devices
Do Not Send Host Performance Information to Guests
Control Access to VMs through VMsafe CPU/Mem API
Verify Promiscuous Mode Is Set to Reject
The System Must Be Configured with a Default Gateway for IPv4
The IPv6 Protocol Handler Must Not Be Installed
The DHCP Client Must Be Disabled
Ensure That NTP Is Running
NTP Time Synchronization Must Be Configured
Configure Remote Logging for ESXi Hosts
Disable DCUI to Prevent Local Administrative Control
Disable Esxi Shell Unless Needed for Diagnostics or Troubleshooting
Disable SSH
Verify That Lockdown Mode Is Enabled
Verify That isolation.tools.getCreds.disable Is Set to True
Verify That isolation.tools.ghi.launchmenu.change Is Set to True
Verify That isolation.tools.memSchedFakeSampleStats.disable Is Set to True
Verify That isolation.tools.unity.push.update.disable Is Set to True
Verify Size of GuestInfo File Is Less than or Equal to 1MB
Using at Least Two DNS Servers
Prevent Unintended Use of VMsafe Network APIs
Set a Timeout for the Esxi Shell to Automatically Disabled Idle Sessions after a Predetermined Period
Active Directory "ESX Admin" Group Membership Must Be Verified
ASKER CERTIFIED SOLUTION
Avatar of nbeutler
nbeutler
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Indyrb

ASKER

does anyone have a powrshell\power cli for any of the items without adding the onyx web plugin?

even if each is in its own one liner
Avatar of Indyrb

ASKER

I created a csv as follows
Key,Value
isolation.tools.copy.disable,true
isolation.tools.dnd.disable,true
isolation.tools.paste.disable,true
isolation.tools.diskShrink.disable,true
isolation.tools.diskWiper.disable,true
vmci0.unrestricted,false
logging,false
isolation.tools.ghi.autologon.disable,true
isolation.bios.bbs.disable,true
isolation.tools.getCreds.disable,true
isolation.tools.ghi.launchmenu.change,true
isolation.tools.memSchedFakeSampleStats.disable,true
isolation.tools.ghi.protocolhandler.info.disable,true
isolation.ghi.host.shellAction.disable,true
isolation.tools.dispTopoRequest.disable,true
isolation.tools.trashFolderState.disable,true
isolation.tools.ghi.trayicon.disable,true
isolation.tools.unity.disable,true
isolation.tools.unityInterlockOperation.disable,true
isolation.tools.unity.taskbar.disable,true
isolation.tools.unityActive.disable,true
isolation.tools.unity.windowContents.disable,true
isolation.tools.unity.push.update.disable,true
isolation.tools.vmxDnDVersionGet.disable,true
isolation.tools.guestDnDVersionSet.disable,true
isolation.tools.vixMessage.disable,true
floppyX.present,false
parallelX.present,false
serialX.present,false
tools.setInfo.sizeLimit,1048576
RemoteDisplay.vnc.enabled,false
isolation.device.connectable.disable,true
RemoteDisplay.maxConnections,1
isolation.device.edit.disable,true
tools.guestlib.enableHostInfo,FALSE
vmsafe.enable,false
isolation.tools.copy.disable,true
isolation.tools.hgfsServerSet.disable,true
isolation.tools.connectable.disable,true
isolation.tools.setGUIOptions.Enable,false
log.keepOld,10
log.rotateSize,100000

Open in new window


Then a powershell script as follows that calls the csv file

####################################
# VMware VirtualCenter server name #
####################################
$vCenter = @(
"server1",
"server2",
"server3",
"server4"
);

##################
# Add VI-toolkit #
##################
Add-PSsnapin VMware.VimAutomation.Core
Initialize-VIToolkitEnvironment.ps1
Connect-VIServer -Server $vCenter


$import = Import-Csv "C:\Scripts\VMachine_config.csv"

$vms = Get-View -ViewType VirtualMachine | where {-not $_.config.template}

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

    foreach($item in $import){

        $extra = New-Object VMware.Vim.optionvalue
        $extra.Key=$item.Key
        $extra.Value=$item.Value
        $vmConfigSpec.extraconfig += $extra
    }

    foreach($vm in $vms){

        $vm.ReconfigVM($vmConfigSpec)
    }

Disconnect-VIServer –Confirm:$false

Open in new window


I still need powershell script for the ESX side though..

Ideas?
Avatar of Indyrb

ASKER

for removing snapshots I used
####################################
# VMware VirtualCenter server name #
####################################
$vCenter = @(
"server1",
"server2"
);

##################
# Add VI-toolkit #
##################
Add-PSsnapin VMware.VimAutomation.Core
Initialize-VIToolkitEnvironment.ps1
Connect-VIServer -Server $vCenter

$snap=get-snapshot -vm * ; remove-snapshot -snap $snap

Disconnect-VIServer –Confirm:$false

Open in new window


for removing CD-ROMs I used
####################################
# VMware VirtualCenter server name #
####################################
$vCenter = @(
"server1",
"server2"
);
##################
# Add VI-toolkit #
##################
Add-PSsnapin VMware.VimAutomation.Core
Initialize-VIToolkitEnvironment.ps1
Connect-VIServer -Server $vCenter

get-cddrive -VM *|where {$_ISOPATH -ne $null}|set-cddrive -nomedia


Disconnect-VIServer –Confirm:$false

Open in new window

Avatar of Indyrb

ASKER

This is what I have left to configure with Powershell or CLI on all hosts

Assistance would be greatly appreciated

Active Directory "ESX Admin" group membership must be verified
Configure Remote logging for ESXi Hosts
Disable DCUI to prevent local administrative control
Disable ESXi Shell unless needed for diagnostics or troubleshooting
Disable SSH
Ensure NTP is running with proper NTP settings
NTP Time Synchronization must be configuered
Prevent Unattended use of VMsafe Network APIS
Set a Timeout for ESXi shell to automatically Disable idle sessions after a predetermined time
The DHCP client must be disabled
The ESXi host firewall must be configured to restrict access to services running on the host
The IPv6 Protocol handler must not be installed
The system must be configured with a default gateway for IPv4
Use at least two DNS servers or set to the proper values
Verify MAC address changes is set to reject
Verify lockdown mode is enabled