Configure Window Nodes - SomethingGeneric/sparkle.local GitHub Wiki

For this part of the configuration I am going to make deployer-sparkle accounts on all the CentOS machines, and deployer-sparkle local users on all the windows machines.

  1. make a sparkle-deployer domain admin
  2. make sparkle-deployer accounts on linux machines

Windows Machines (DC1, DC2 and Mgmt01)

Mgmt01

mgmt01 has GUI for us to use, when you configure DC1 and DC2, they are run on windows server core so we will have to use the CLI to configure the nodes

  • Within Server manager, make a domain admin account sparkle-deployer
    • AD Users and Computers
    • Add to Domain Admin group

Start Windows Update Service

  • Open the Services application as an administrator
  • Go to Windows Update
  • Change from disabled to Automatic

Install OpenSSH

There are two separate ways to install OpenSSH as some folks have had issues with one way and not the other. Please see the two separate methods below

Method One:

  • check to see if the server is installed with:

    • Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
  • If NotPresent install it with:

    • Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
  • Start the server with:

    • Start-Service sshd
    • Set-Service -Name sshd -StartupType 'Automatic'

Method Two:

Unblock-File .\Downloads\OpenSSH-Win64.zip
Expand-Archive .\Downloads\OpenSSH-Win64.zip -DestinationPath .

# don't forget the period at the end of the command above!!!

Copy-Item -Recurse .\OpenSSH-Win64\ 'C:\'
&icacls C:\OpenSSH-Win64\libcrypto.dll /grant Everyone:RX
  • Follow these commands in administrative powershell
C:\OpenSSH-Win64\install-sshd.ps1
&sc.exe config sshd start=auto
&sc.exe config ssh-agent start=auto
&sc.exe start sshd

Do these steps for both method one and two

  • Make sure firewall is open on port 22
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH SSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -Program "C:\OpenSSH-win64\sshd.exe"

If this doesn't work, open port 22 for all connections with:

  • New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH SSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -Profile 'Public'
  • Make Powershell the default for SSH
Set-ItemProperty "HKLM:\Software\Microsoft\Powershell\1\ShellIds" -Name ConsolePrompting -Value $true 
New-ItemProperty -Path HKLM:\SOFTWARE\OpenSSH -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
  • Reboot with shutdown /t 0 /r

DC1 and DC2

Start Windows Update Service

  • Type in the command sc start wuauserv
  • If that doesn't work use the following commands:
UsoClient StartScan
UsoClient StartDownload
UsoClient Start Install
UsoClient RestartDevice

Install OpenSSH

  • Make sure you are in powershell

    • you can do this by simply typing powershell into cmd
  • check to see if the server is installed with:

    • Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
  • If NotPresent install it with:

    • Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
  • Start the server with:

    • Start-Service sshd
    • Set-Service -Name sshd -StartupType 'Automatic'
  • Make sure firewall is open on port 22

New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH SSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -Profile 'Public'
  • Make Powershell the default for SSH
Set-ItemProperty "HKLM:\Software\Microsoft\Powershell\1\ShellIds" -Name ConsolePrompting -Value $true 
New-ItemProperty -Path HKLM:\SOFTWARE\OpenSSH -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
  • Reboot with shutdown /t 0 /r

Alternative Method

If the method above does not work you can try downloading the zip file like was done above, using powershell.

  • Download OpenSSH-Win64 zip by using the Invoke-WebRequest command on powershell
Invoke-WebRequest -Uri "https://github.com/PowerShell/Win32-OpenSSH/releases/download/v9.5.0.0p1-Beta/OpenSSH-Win64.zip" -OutFile "C:\Users\Sparkle-deployer\OpenSSH-Win64.zip"
Unblock-File .\Downloads\OpenSSH-Win64.zip
Expand-Archive .\Downloads\OpenSSH-Win64.zip -DestinationPath .

# don't forget the period at the end of the command above!!!
  • make sure you go to C:\Program Files when doing the following commands!
Copy-Item -Recurse .\OpenSSH-Win64\ 'C:\'
&icacls C:\OpenSSH-Win64\libcrypto.dll /grant Everyone:RX
C:\OpenSSH-Win64\install-sshd.ps1
&sc.exe config sshd start=auto
&sc.exe config ssh-agent start=auto
&sc.exe start sshd