gpt4 book ai didi

amazon-web-services - 等待 SSH : Packer experienced an authentication error when trying to connect via SSH 时出错

转载 作者:行者123 更新时间:2023-12-05 04:39:23 26 4
gpt4 key购买 nike

我正在尝试使用加壳器构建 AWS AMI。这是我的打包机配置文件:

source "amazon-ebs" "base-alpine" {

assume_role {
role_arn = "arn:aws:iam::${var.aws_account_id}:role/admin-ci"
session_name = "packer"
}

source_ami_filter {
filters = {
virtualization-type = "hvm"
name = "alpine-3.15.0*"
root-device-type = "ebs"
}
owners = ["538276064493"]
most_recent = true
}

subnet_filter {
filters = {
"tag:Function" : "public"
"tag:Project" : "brain"
}
most_free = true
}

security_group_filter {
filters = {
"tag:Function" : "public"
"tag:Project" : "brain"
}
}

ami_name = "base-alpine"
instance_type = "t4g.medium"
region = "${var.aws_region}"
ssh_username = "alpine"
associate_public_ip_address = true
force_deregister = true
force_delete_snapshot = true

tags = {
Project = "brain"
Name = "base-alpine"
}

}

build {
sources = ["source.amazon-ebs.base-alpine"]

provisioner "file" {
source = "hostname.sh"
destination = "/tmp/hostname.sh"
}

provisioner "shell" {
valid_exit_codes = [0, 1]
inline = [
"doas apk -U upgrade"
]

}

}

我之前使用完全相同的配置,但使用不同的基础 AMI,并且工作正常。

现在,在我更改基本 AMI 后,我收到此错误:

==> amazon-ebs.base-alpine: Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

有趣的是,我可以使用生成的 ssh 私钥 ssh 进入创建的 Packer 机器,没有任何问题。

知道为什么会这样吗?或者更好的调试建议?

最佳答案

我会把@Beevik 的评论放在这里

The openssh config that ships with the AWS alpine 3.15 cloud image does not appear to support RSA keys by default. I see the following error logged in /var/log/messages as the packer client tries to connect via ssh: "userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms". Downgrading to the alpine 3.14 cloud image worked for me.

关于amazon-web-services - 等待 SSH : Packer experienced an authentication error when trying to connect via SSH 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70454523/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com