{"id":488,"date":"2016-10-04T13:23:10","date_gmt":"2016-10-04T13:23:10","guid":{"rendered":"http:\/\/vblog.hochsticher.de\/?p=488"},"modified":"2016-10-09T22:06:03","modified_gmt":"2016-10-09T20:06:03","slug":"is-your-ssh-disabled","status":"publish","type":"post","link":"https:\/\/vblog.hochsticher.de\/?p=488","title":{"rendered":"Is the SSH-Service on your ESXi disabled?"},"content":{"rendered":"<p>In times like these, where daily security leaks are\u00a0published, it&#8217;s time to check some basics.<\/p>\n<p>Run the following PowerCLI Script to see if\u00a0the SSH-Service is running and disable it!<\/p>\n<pre class=\"lang:ps decode:true\" title=\"disable-ssh-service\">#List Hosts into Array\r\n$arr = @()\r\n$arr = (Get-VMHost * | Foreach {($_ | Get-VMHostService | Where { $_.Key -eq \"TSM-SSH\"})} | select VMHost,Label,Policy,Running | Sort VMHost)\r\n\r\n#Filter running SSH or Enabled\r\n$sshOn = $arr | Where-Object { ($_.Running -eq \"True\") -or ($_.Policy -eq \"on\") }\r\n\r\n#If SSH on -&gt; Stop and Disable SSH\r\nif (!$sshOn) {\r\nWrite-Host -BackgroundColor DarkGreen \"No SSH enabled\"\r\n}\r\nelse {\r\n#List Hosts\r\nforeach ($VMhost in $sshOn) {Write-Host -BackgroundColor Red $VMhost.VMHost \"- has SSH enabled\"}\r\nWrite-Host -BackgroundColor Red \"Stopping SSH Service and disable\"\r\n#Stop SSH Service\r\nforeach ($VMhost in $sshOn) {Get-VMHost $VMhost.VMHost | Foreach {Stop-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq \"TSM-SSH\"})-Confirm:$false }}\r\n#Disable SSH Service\r\nforeach ($VMhost in $sshOn) {Get-VMHost $VMhost.VMHost | Foreach {Set-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq \"TSM-SSH\"}) -Policy Off -Confirm:$false }}\r\n}\r\n<\/pre>\n<p>Enjoy \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In times like these, where daily security leaks are\u00a0published, it&#8217;s time to check some basics. Run the following PowerCLI Script to see if\u00a0the SSH-Service is running and disable it! #List Hosts into Array $arr = @() $arr = (Get-VMHost * | Foreach {($_ | Get-VMHostService | Where { $_.Key -eq &#8220;TSM-SSH&#8221;})} | select VMHost,Label,Policy,Running | Sort VMHost) #Filter running SSH or Enabled $sshOn = $arr | Where-Object { ($_.Running -eq &#8220;True&#8221;) -or ($_.Policy -eq &#8220;on&#8221;) } #If SSH on -&gt;&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/vblog.hochsticher.de\/?p=488\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":495,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[4,10,7],"tags":[],"class_list":["post-488","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powercli","category-vcenter","category-vsphere"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=\/wp\/v2\/posts\/488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=488"}],"version-history":[{"count":10,"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=\/wp\/v2\/posts\/488\/revisions"}],"predecessor-version":[{"id":500,"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=\/wp\/v2\/posts\/488\/revisions\/500"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=\/wp\/v2\/media\/495"}],"wp:attachment":[{"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vblog.hochsticher.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}