admin管理员组文章数量:1391787
I am attempting to create a build pipeline which restores a Ghost img (.gho
) onto a virtual disk to generate a VM using packer with the vmware-iso plugin. I can start with a custom provisioned windows-pe instance with Ghost64.exe to make the restore.
I need either an ssh or winrm connection so that I can scp
the ghost files into the VM among other more fine-grained provisioning. However I can't manage to get ssh to connect through packer or otherwise.
This is my current attempt:
Create custom Windows PE ISO file, via
DISM.exe
and Window ADK-> Drop OpenSSH 9.5 in
X:\Program Files\
-> Drop Ghost64.exe in
X:\Windows\Ghost\
Generate
my.iso
from the previous filesUse packer with vmware-iso plugin -> point to the freshly generated iso -> run boot commands to setup SSH
Run
sshd.exe
For packer to establish connection and start ghost restore.
No matter what I change, I receive the same error every time. Meanwhile packer is hanging on Waiting for SSH to become available...
.
It appears to break on the key exchange. I verified that the versions were the same, and their version strings match. That there is at least one shared key exchange algorithm.
I also attempted a login via ssh.exe manually and receive this response:
PS> ssh [email protected]
Connection reset by 192.168.19.128 port 22
Here is my packer build file:
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
packer {
required_plugins {
vmware = {
version = ">=1.1.0"
source = "github/hashicorp/vmware"
}
}
}
source "vmware-iso" "vm-example" {
vm_name = "my-vm"
guest_os_type = "windows9-64"
cpus = 2
memory = 8192
disk_size = 60000
disk_adapter_type = "nvme"
#cdrom_adapter_type = "scsi"
shutdown_command = "shutdown -P now"
usb = true
iso_checksum = "<sha to iso>"
iso_url = "C:\\Users\\<my user>\\projects\\gho_to_vm\\winpe_test.iso"
network = "nat"
boot_command = [
"<wait15s>Wpeutil DisableFirewall<enter>",
"Wpeutil InitializeNetwork<enter>",
"powershell.exe<enter>",
"cd 'X:\\Program Files\\OpenSSH'<enter>",
"md X:\\ProgramData\\ssh<enter>",
"Set-ExecutionPolicy Unrestricted <enter>",
"net user /add Me pass<enter>",
"net localgroup Users Me /add <enter>",
"net localgroup 'OpenSSH Users' Me /add <enter>",
"net localgroup Administrators Me /add <enter>",
"net user /add sshd pass <enter>",
"net localgroup Users sshd /add <enter>",
"net localgroup 'OpenSSH Users' sshd /add <enter>",
"net localgroup Administrators sshd /add <enter>",
".\\install-sshd.ps1<enter>", # This has some errors, but only on Service related tasks. Just running sshd.exe manually so doesn't matter.
".\\ssh-keygen -A<enter>",
".\\sshd.exe -d -f .\\sshd_config_default<enter>",
]
#cd_files = ["C:\\Users\\<my user>\\projects\\gho_to_vm\\GhostFiles"]
#cd_label = "ghostdata"
communicator = "ssh"
ssh_username = "Me"
ssh_password = "pass"
ssh_handshake_attempts = 10
vmx_data = {
"usb_xhci.present" = true
}
}
build {
sources = [
"source.vmware-iso.vm-example"
]
provisioner "powershell" {
inline = ["dir \\", "echo 'hello world'"]
}
}
What would be your ways to connect to the VM through packer? Is SSH on windows pe even possible? Should I use a different windows iso for building out my image?
本文标签: sshOpenSSH on VMWare WindowsPE instance through PackerStack Overflow
版权声明:本文标题:ssh - OpenSSH on VMWare Windows-PE instance through Packer - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744690422a2619961.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论