diff -rupN apache-VCL-2.5.1.orig/managementnode/bin/cygwin-sshd-config.sh apache-VCL-2.5.1/managementnode/bin/cygwin-sshd-config.sh --- apache-VCL-2.5.1.orig/managementnode/bin/cygwin-sshd-config.sh 2019-07-19 10:12:22.000000000 -0400 +++ apache-VCL-2.5.1/managementnode/bin/cygwin-sshd-config.sh 2020-05-12 14:53:58.415000000 -0400 @@ -131,9 +131,17 @@ if [ $? -ne 0 ]; then die "failed to con mount print_hr +sshdservice=$(sc queryex type= service state= all | grep sshd | grep SERVICE_NAME | awk '{print $2}' | sed 's/ //g') + +if [[ $sshdservice == "" ]]; then + sshdservice=sshd +fi + +echo "sshd service name is $sshdservice" + # Stop and kill all sshd processes echo Stopping sshd service if it is running -net stop sshd 2>/dev/null +net stop $sshdservice 2>/dev/null print_hr echo Killing any sshd.exe processes @@ -146,7 +154,7 @@ print_hr # Delete the sshd service if it already exists echo Deleting sshd service if it already exists -$SYSTEMROOT/system32/sc.exe delete sshd +$SYSTEMROOT/system32/sc.exe delete $sshdservice print_hr # Make sure sshd service registry key is gone @@ -154,6 +162,7 @@ print_hr # This prevents the service from being reinstalled echo Deleting sshd service registry key reg.exe DELETE 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\sshd' /f +reg.exe DELETE "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\${sshdservice}" /f print_hr # Delete sshd user, a new account will be created @@ -377,8 +386,8 @@ echo rebaseall exit status: %ERRORLEVEL% IF ERRORLEVEL 1 exit /b %ERRORLEVEL% echo. -echo Starting Cygwin SSHD service -net start sshd +echo Starting Cygwin SSHD service (${sshdservice}) +net start ${sshdservice} IF ERRORLEVEL 1 exit /b %ERRORLEVEL% echo /var/log/sshd.log ending: diff -rupN apache-VCL-2.5.1.orig/managementnode/bin/gen-node-key.sh apache-VCL-2.5.1/managementnode/bin/gen-node-key.sh --- apache-VCL-2.5.1.orig/managementnode/bin/gen-node-key.sh 2019-07-19 10:12:22.000000000 -0400 +++ apache-VCL-2.5.1/managementnode/bin/gen-node-key.sh 2020-05-12 14:54:11.710000000 -0400 @@ -151,6 +151,16 @@ case $OS in die "Unsupported OS found, OS call reported $OS";; esac +# if OS is CYGWIN, try to determine sshd service name +if [[ $OS =~ (CYGWIN) ]]; then + sshdservice=`ssh $SSH_OPTIONS -i $KEY_PATH root@$NODE "sc queryex type= service state= all | grep sshd | grep SERVICE_NAME | awk '{print \\$2}' | sed 's/ //g'"` + if [[ $sshdservice != "" && $sshdservice != "sshd" ]]; then + echo "Detected CYGWIN with alternate sshd service name: $sshdservice" + SSHSTOP="net stop $sshdservice" + SSHSTART="net start $sshdservice" + fi +fi + echo Setting PasswordAuthentication to no in sshd_config on $NODE ssh $SSH_OPTIONS -i $KEY_PATH root@$NODE 'sed -i -r -e "s/^[ #]*(PasswordAuthentication).*/\1 no/"' $SSHDCONFIG ssh $SSH_OPTIONS -i $KEY_PATH root@$NODE 'grep "^[ #]*PasswordAuthentication"' $SSHDCONFIG diff -rupN apache-VCL-2.5.1.orig/managementnode/lib/VCL/Module/OS/Windows/Version_6/8.pm apache-VCL-2.5.1/managementnode/lib/VCL/Module/OS/Windows/Version_6/8.pm --- apache-VCL-2.5.1.orig/managementnode/lib/VCL/Module/OS/Windows/Version_6/8.pm 2019-07-19 10:12:22.000000000 -0400 +++ apache-VCL-2.5.1/managementnode/lib/VCL/Module/OS/Windows/Version_6/8.pm 2020-05-12 14:55:11.929000000 -0400 @@ -134,7 +134,7 @@ sub pre_capture { } # Set the sshd service startup mode to disabled so that it does not start up until properly configured - if (!$self->set_service_startup_mode('sshd', 'disabled')) { + if (!$self->set_service_startup_mode('sshd', 'disabled') && !$self->set_service_startup_mode('cygsshd', 'disabled')) { notify($ERRORS{'WARNING'}, 0, "sshd service could not be disabled before shutting down computer"); return; } diff -rupN apache-VCL-2.5.1.orig/managementnode/lib/VCL/Module/OS/Windows.pm apache-VCL-2.5.1/managementnode/lib/VCL/Module/OS/Windows.pm --- apache-VCL-2.5.1.orig/managementnode/lib/VCL/Module/OS/Windows.pm 2019-07-19 10:12:22.000000000 -0400 +++ apache-VCL-2.5.1/managementnode/lib/VCL/Module/OS/Windows.pm 2020-05-12 14:54:40.062000000 -0400 @@ -673,7 +673,7 @@ sub pre_capture { =cut - if (!$self->set_service_startup_mode('sshd', 'manual')) { + if (!$self->set_service_startup_mode('sshd', 'manual') && !$self->set_service_startup_mode('cygsshd', 'manual')) { notify($ERRORS{'WARNING'}, 0, "unable to set sshd service startup mode to manual"); return 0; } @@ -786,7 +786,7 @@ sub post_load { =cut - if (!$self->set_service_startup_mode('sshd', 'auto')) { + if (!$self->set_service_startup_mode('sshd', 'auto') && !$self->set_service_startup_mode('cygsshd', 'auto')) { notify($ERRORS{'WARNING'}, 0, "unable to set sshd service startup mode to auto"); return 0; } @@ -2349,15 +2349,21 @@ sub set_password { # Get the list of services my @services = $self->get_services_using_login_id($username); if ($username eq 'root' && !@services) { - @services = ('sshd'); + @services = ('sshd', 'cygsshd'); } + my $success = 0; for my $service (@services) { notify($ERRORS{'DEBUG'}, 0, "$service service is configured to run as $username, updating service credentials"); - if (!$self->set_service_credentials($service, $username, $password)) { - notify($ERRORS{'WARNING'}, 0, "failed to set $service service credentials to $username ($password)"); + if ($self->set_service_credentials($service, $username, $password)) { + $success = 1; + last; } } + if(!$success) { + my $servicelist = join(', ', @services); + notify($ERRORS{'WARNING'}, 0, "failed to set credentials to $username ($password) for any of $servicelist"); + } # Get the scheduled tasks - check if any are configured to run as the user my $scheduled_task_info = $self->get_scheduled_task_info(); @@ -3939,7 +3945,7 @@ sub reboot { } # Set sshd service startup mode to manual - if (!$self->set_service_startup_mode('sshd', 'manual')) { + if (!$self->set_service_startup_mode('sshd', 'manual') && !$self->set_service_startup_mode('cygsshd', 'manual')) { notify($ERRORS{'WARNING'}, 0, "reboot not attempted, unable to set sshd service startup mode to manual"); return 0; } diff -rupN apache-VCL-2.5.1.orig/managementnode/tools/Windows/Scripts/update_cygwin.cmd apache-VCL-2.5.1/managementnode/tools/Windows/Scripts/update_cygwin.cmd --- apache-VCL-2.5.1.orig/managementnode/tools/Windows/Scripts/update_cygwin.cmd 2019-07-19 10:12:22.000000000 -0400 +++ apache-VCL-2.5.1/managementnode/tools/Windows/Scripts/update_cygwin.cmd 2020-05-12 14:55:44.270000000 -0400 @@ -172,14 +172,16 @@ echo. echo ---------------------------------------------------------------------- +sc queryex type= service state= all | findstr "cygsshd" > nul && SET sshdservice=cygsshd || SET sshdservice=sshd + echo %TIME%: Setting sshd service startup mode to auto... -"%SystemRoot%\System32\sc.exe" config sshd start= auto 2>&1 +"%SystemRoot%\System32\sc.exe" config %sshdservice% start= auto 2>&1 echo ERRORLEVEL: %ERRORLEVEL% set /A STATUS+=%ERRORLEVEL% echo. echo %TIME%: Starting the sshd service... -"%SystemRoot%\System32\net.exe" start sshd 2>&1 +"%SystemRoot%\System32\net.exe" start %sshdservice% 2>&1 echo ERRORLEVEL: %ERRORLEVEL% set /A STATUS+=%ERRORLEVEL% echo.