Skip to content

Commit a3c2d38

Browse files
committed
OpenSSH: install as part of VM setup, not WinRM
It appears that executing `Add-WindowsCapability` via WinRM is not viable, this commit moves the installation of OpenSSH.Server to the various IaaS pre-boot scrips which are not executed via WinRM. The installation of OpenSSSH.Server was added as follows: Azure: add a `custom_script` parameter to packer config AWS: added to `setup_winrm.txt` GCP: add to `setup-winrm.ps1` and use `sysprep-specialize-script-ps1` As of July 2025 windows stemcells have converted to using Microsoft's official OpenSSH installation method[1]. This commit remove the remnants of previous installation methods, and switches to the above non-WinRM method for installation. [1] https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
1 parent b795fa9 commit a3c2d38

File tree

19 files changed

+154
-241
lines changed

19 files changed

+154
-241
lines changed

ci/pipelines/stemcells-windows.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,6 @@ resources:
208208
password: ((docker.password))
209209

210210
# type: github-release
211-
- name: openssh-release
212-
type: github-release
213-
source:
214-
owner: PowerShell
215-
repository: Win32-OpenSSH
216-
access_token: ((github_public_repo_token))
217-
tag_filter: v([^v].*)
218211
- name: stemcell-builder-github-release
219212
type: github-release
220213
source:
@@ -797,8 +790,6 @@ jobs:
797790
tags: [*worker_tag]
798791
- get: bosh-windows-stemcell-builder-ci-image
799792
tags: [*worker_tag]
800-
- get: open-ssh
801-
resource: openssh-release
802793
- get: stemcell-builder
803794
passed: [build]
804795
tags: [*worker_tag]
@@ -910,8 +901,6 @@ jobs:
910901
tags: [*worker_tag]
911902
- get: bosh-windows-stemcell-builder-ci-image
912903
tags: [*worker_tag]
913-
- get: open-ssh
914-
resource: openssh-release
915904
- get: stemcell-builder
916905
passed: [build]
917906
tags: [*worker_tag]
@@ -1369,8 +1358,6 @@ jobs:
13691358
- get: main-version
13701359
passed: [build]
13711360
tags: [*worker_tag]
1372-
- get: sshd
1373-
resource: openssh-release
13741361
- get: bosh-agent-release
13751362
passed: [build]
13761363
- get: blobstore-dav-cli
@@ -1550,8 +1537,6 @@ jobs:
15501537
- get: main-version
15511538
passed: [wuts-aws]
15521539
tags: [*worker_tag]
1553-
- get: sshd
1554-
resource: openssh-release
15551540
- get: bosh-agent-release
15561541
passed: [wuts-aws]
15571542
- get: blobstore-dav-cli
@@ -1711,8 +1696,6 @@ jobs:
17111696
- get: main-version
17121697
passed: [build]
17131698
tags: [*worker_tag]
1714-
- get: sshd
1715-
resource: openssh-release
17161699
- get: bosh-agent-release
17171700
passed: [build]
17181701
- get: blobstore-dav-cli
@@ -1908,8 +1891,6 @@ jobs:
19081891
- get: main-version
19091892
passed: [build]
19101893
tags: [*worker_tag]
1911-
- get: sshd
1912-
resource: openssh-release
19131894
- get: bosh-agent-release
19141895
passed: [build]
19151896
- get: blobstore-dav-cli

ci/tasks/create-azure-stemcell/task.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ inputs:
66
- name: version
77
- name: stemcell-builder
88
- name: lgpo-binary
9-
- name: sshd
109
- name: bosh-agent-release
1110
- name: blobstore-dav-cli
1211
- name: blobstore-s3-cli

ci/tasks/create-gcp-stemcell/task.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ inputs:
77
- name: base-gcp-image
88
- name: version
99
- name: lgpo-binary
10-
- name: sshd
1110
- name: bosh-agent-release
1211
- name: blobstore-dav-cli
1312
- name: blobstore-s3-cli

ci/tasks/generate-deps-file/run.bash

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
openssh_win64_sha256="$(shasum -a 256 open-ssh/OpenSSH-Win64.zip | cut -d " " -f 1)"
5-
openssh_win64_version="$(cat open-ssh/version)"
6-
74
psmodules_sha256="$(shasum -a 256 psmodules-zip-output/bosh-psmodules.zip | cut -d " " -f 1)"
85
psmodules_version="$(cat version/version)"
96

@@ -15,10 +12,6 @@ lgpo_version="3"
1512

1613
cat <<EOF > deps-file/deps.json
1714
{
18-
"OpenSSH-Win64.zip": {
19-
"sha": "${openssh_win64_sha256}",
20-
"version": "${openssh_win64_version}"
21-
},
2215
"bosh-psmodules.zip": {
2316
"sha": "${psmodules_sha256}",
2417
"version": "${psmodules_version}"

ci/tasks/generate-deps-file/task.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ platform: linux
44
inputs:
55
- name: bosh-windows-stemcell-builder-ci
66
- name: stemcell-builder
7-
- name: open-ssh
87
- name: lgpo-binary
98
- name: version
109
- name: bosh-agent

ci/tasks/zip-files/run.bash

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ ROOT_DIR=$(pwd)
66
REPO_ROOT="${REPO_ROOT:-"$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"}"
77
ZIP_FILE_DESTINATION="${ZIP_FILE_DESTINATION:-"${ROOT_DIR}/zip-file/StemcellAutomation-$(date +"%s").zip"}"
88

9-
OPENSSH_ZIP="${OPENSSH_ZIP:-"${ROOT_DIR}/open-ssh/OpenSSH-Win64.zip"}"
109
BOSH_PSMODULES_ZIP="${BOSH_PSMODULES_ZIP:-"${ROOT_DIR}/psmodules-zip-output/bosh-psmodules.zip"}"
1110
AGENT_ZIP="${AGENT_ZIP:-"${ROOT_DIR}/bosh-agent/agent.zip"}"
1211
DEPS_JSON="${DEPS_JSON:-"${ROOT_DIR}/deps-file/deps.json"}"
@@ -20,7 +19,7 @@ mkdir -p "${stemcell_automation_dir}"
2019

2120
declare -a files_to_zip
2221
mapfile -t files_to_zip < <(find "${REPO_ROOT}/stembuild/stemcell-automation" -type f -not -name "*Test*" -name "*.ps*1")
23-
files_to_zip+=("${OPENSSH_ZIP}" "${BOSH_PSMODULES_ZIP}" "${AGENT_ZIP}" "${DEPS_JSON}")
22+
files_to_zip+=("${BOSH_PSMODULES_ZIP}" "${AGENT_ZIP}" "${DEPS_JSON}")
2423

2524
cp "${files_to_zip[@]}" "${stemcell_automation_dir}"
2625

ci/tasks/zip-files/task.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ platform: linux
44
inputs:
55
- name: bosh-windows-stemcell-builder-ci
66
- name: stemcell-builder
7-
- name: open-ssh
87
- name: deps-file
98
- name: bosh-agent
109
- name: psmodules-zip-output

lib/packer/config/azure.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def builders
4545
'winrm_use_ssl' => 'true',
4646
'winrm_insecure' => 'true',
4747
'winrm_timeout' => '1h',
48-
'winrm_username' => 'packer'
48+
'winrm_username' => 'packer',
49+
'custom_script' => 'powershell -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -Command "Add-WindowsCapability -Online -Name (Get-WindowsCapability -Online -Name OpenSSH.Server* | ForEach-Object Name)"'
4950
}
5051
]
5152
end

lib/packer/config/gcp.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def initialize(
3939
end
4040

4141
def builders
42+
stemcell_builder_dir = File.expand_path('../../../../', __FILE__)
4243
[
4344
{
4445
'type' => 'googlecompute',
@@ -62,7 +63,7 @@ def builders
6263
'winrm_timeout' => '1h',
6364
'state_timeout' => '10m',
6465
'metadata' => {
65-
'sysprep-specialize-script-url' => 'https://raw.githubusercontent.com/cloudfoundry/bosh-windows-stemcell-builder/master/scripts/gcp/setup-winrm.ps1',
66+
'sysprep-specialize-script-ps1' => File.read(File.join(stemcell_builder_dir, 'scripts', 'gcp', 'setup-winrm.ps1')),
6667
'name' => "#{@vm_prefix}-#{Time.now.to_i}",
6768
}.compact_blank!
6869
}

lib/packer/config/templates/provision_windows2019.json.erb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,6 @@
137137
"Protect-CFCell -IaaS <%= iaas %>"
138138
]
139139
},
140-
{
141-
"type": "file",
142-
"source": "../sshd/OpenSSH-Win64.zip",
143-
"destination": "C:\\provision\\OpenSSH-Win64.zip"
144-
},
145140
{
146141
"type": "powershell",
147142
"inline": [

0 commit comments

Comments
 (0)