来自 gitlab-ci docker 的 SSH 在“SSH2_MSG_KEX_ECDH_REPLY”上失败

2024-01-15

我正在尝试从 GitLab CI 中运行的 Docker 部署容器通过 SSH 连接到远程网络服务器。我第一次尝试时确实成功连接了一次。现在它不断失败:调试输出的最后两行(完整输出如下)是:

debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
Connection closed by ********** port 22

部署任务首先从 GitLab CI“秘密变量”复制 SSH 私钥(公钥当然位于~/.ssh/authorized_keys在遥控器上)。完整的部署任务定义在gitlab-ci.yml as:

.deploy: &import_deploy
    stage: deploy
    image: **********
    tags: [ek-docker]
    before_script:
        # install openssh & rsync
        - apk update && apk --no-cache add rsync openssh
        # copy private key from GitLab secret variable to container
        - mkdir -p ~/.ssh
        - chmod 700 ~/.ssh
        - eval $(ssh-agent -s)
        - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
        - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
    script:
        - ssh -vvv **********@********** 'bash -s' < ./conf/$MY_ENV_NAME/start.sh

    deploy staging:
    <<: *import_deploy
    variables:
        MY_ENV_NAME: "staging"
    only:
        - staging
    environment:
        name: staging

从 SSH 记录的输出是:

OpenSSH_7.7p1, LibreSSL 2.7.4
debug1: Reading configuration data /root/.ssh/config
debug1: /root/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname ********** is address
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to ********** [**********] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.6 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to **********:22 as '**********'
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected] /cdn-cgi/l/email-protection,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected] /cdn-cgi/l/email-protection,aes128-ctr,aes192-ctr,aes256-ctr,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection
debug2: ciphers stoc: [email protected] /cdn-cgi/l/email-protection,aes128-ctr,aes192-ctr,aes256-ctr,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection
debug2: MACs ctos: [email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected] /cdn-cgi/l/email-protection,zlib
debug2: compression stoc: none,[email protected] /cdn-cgi/l/email-protection,zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: [email protected] /cdn-cgi/l/email-protection,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected] /cdn-cgi/l/email-protection,aes128-ctr,aes192-ctr,aes256-ctr,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection
debug2: ciphers stoc: chacha20-poly13[email protected] /cdn-cgi/l/email-protection,aes128-ctr,aes192-ctr,aes256-ctr,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection
debug2: MACs ctos: [email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,[email protected] /cdn-cgi/l/email-protection,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected] /cdn-cgi/l/email-protection
debug2: compression stoc: none,[email protected] /cdn-cgi/l/email-protection
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: [email protected] /cdn-cgi/l/email-protection
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] /cdn-cgi/l/email-protection MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly13[email protected] /cdn-cgi/l/email-protection MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
Connection closed by ********** port 22
ERROR: Job failed: exit code 1

I am way超出了我的深度,谷歌搜索提出了两个可能的原因。第一个是基于网络的东西,改变... MTU?作为潜在的修复。这听起来很可怕,所以我专注于第二个,即密钥交换算法的不匹配。这似乎是有道理的:两者之间似乎没有共同的价值观《KEX算法》 and “主机密钥算法”在上面的输出中。当它第一次连接时,输出是

“警告:将‘*********’ (ECDSA) 永久添加到已知列表中 主人”。

我尝试通过指定算法ssh -o KexAlgorithms=ecdh-sha2-nistp521(以及其他一些看起来可能的候选者)但这只是引发了一个错误,即该算法不受支持。

现在很清楚,我不知道我在做什么。任何人都可以从上面的 SSH 输出中提出问题的原因是什么?


我遇到了同样的问题,我已将此选项添加到 ssh 然后问题解决了:

ssh -o KexAlgorithms=ecdh-sha2-nistp521 192.168.1.100
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

来自 gitlab-ci docker 的 SSH 在“SSH2_MSG_KEX_ECDH_REPLY”上失败 的相关文章

随机推荐

  • git rebase 合并冲突

    我分叉了一个 github 存储库并在我的 github 存储库上工作 我已经提出了拉取请求并且已经完成 之后上游又有了一些提交 所以现在我想重新设置基准 我想这就是我必须做的 但我遇到了这些合并冲突 First rewinding hea
  • PostgreSQL 用户列表

    我想获取 psql 中某个数据库的用户列表 例如 template0 用户是谁 或者对于 template1 数据库 那里的用户是谁 已经尝试过 du no database is Listed not Users Select from
  • 不同环境的实体框架数据迁移

    有一些特定于开发 测试 生产环境的基础数据 我们现在在所有环境中使用实体框架迁移 但不知道如何以指定仅在开发 测试 生产上执行的迁移的方式为特定环境指定迁移 这可以在 Fluent Migrator 中使用标签属性来完成 但是实体框架呢 当
  • 如何在 Angular 2 应用程序中添加 reCAPTCHA?

    如何将 reCAPTCHA 集成到 Angular 2 应用程序中 假设您有 reCAPTCHA 给出的站点密钥和客户端密钥 将以下代码放入组件中 ViewChild captchaRef2 captchaRef2 ElementRef p
  • 操作栏中的最后一个选项卡被裁剪,消失在屏幕上

    我正在制作一个使用标签进行导航的 Android 应用程序 我在操作栏中最后一个选项卡的渲染时遇到问题 它会离开屏幕并被裁剪 据我所知 只要选项卡数量太大而无法适应屏幕宽度 就会发生这种情况 我正在使用ActionBar NAVIGATIO
  • 通过可观察限制重播缓冲区

    我有一个包含实时数据的流 以及一个基本上分隔属于一起的实时数据部分的流 现在 当有人订阅实时数据流时 我想向他们重播实时数据 但是 我不想记住所有实时数据 只想记住自上次其他流发出值以来的部分数据 有一个问题 https rx codepl
  • Play Framework 自定义资源:如何复制到目标?

    我有一个 csv 文件 必须在应用程序启动时读取该文件 我如何才能将此文件复制到目标 以 运行 或 启动 它 我正在尝试使用全局级访问此文件Global class getResourceAsStream file csv 但结果始终为空
  • 仅当使用 Web 邮件客户端时,Mailto 链接才会在新选项卡中打开

    我有一个网页 可创建联系人及其电子邮件地址列表 对于 mailto 链接 您有两个选项 1 在当前窗口中打开它或 2 在新选项卡 窗口中打开它 我看到双方都存在潜在的缺点 对于网络邮件客户端 例如 gmail 选项 1 并不理想 因为它会劫
  • 您可以在其中放置图表的 Microsoft Office 剪贴板格式有哪些?

    我正在尝试在内存中创建一个可以提供拖放操作的 DOCX 我首先尝试了 嵌入源 然而 虽然它看起来很完美 OLE 包装器中的 DOCX 但 Word 并不使用它进行拖放 尽管它 确实使用它进行剪切和粘贴 有没有办法强制Word Excel P
  • 使用 Iperf 进行 haproxy 的 udp 流量

    我正在使用 Docker 容器开展我的个人项目 关于 Haproxy 的 性能评估 我正在使用 Python 进行编程 并使用 iperf 来生成流量 我创建了几个 Docker 容器作为客户端和服务器 客户端应该通过充当负载均衡器的 Ha
  • QML 将纹理应用于网格

    我正在尝试将图像纹理应用到 QML Qt 5 6 2 中的网格 我从示例 Shadow Map QML 开始 我想对 GroundPlane 进行纹理处理 材质和效果 qml 类应用于该 GroundPlane 网格 但我看不到如何应用图像
  • 在 LINQ to SQL 中查找或创建对象的通用方法?

    很多时候在我的LINQ 到 SQL http en wikipedia org wiki Language Integrated Query LINQ to SQL 28formerly called DLINQ 29代码中 我需要 查找或
  • 获取类实例变量并使用反射打印它们的值

    我有 2 个带有 getter 和 setter 的 POJO 类 现在我试图获取该类的所有类实例变量 我知道我们可以使用反射怎么办呢 这是我的 POJO 类 它将扩展我的反射类 class Details private int age
  • 使用公司范围的超级/父 POM 覆盖超级 POM

    我们希望有一个全公司超级POM它将继承自通常的超级 POM 我们公司的所有项目都会从中继承隐式继承 这可能吗 截至目前我们必须显式继承来自我们公司范围内的超级 POM 这不是很方便 而且容易出错 有人可以建议吗 据我所知 这方面没有最佳实践
  • 使用 AJAX 时检查会话超时

    我有一个 ColdFusion 页面 用户可以打开模式并查看有关一行数据的更多信息 但是 如果用户在页面上停留的时间超过默认的 20 分钟会话超时 则会抛出错误 因为它正在查找会话变量但找不到它们 我了解如何使用服务器端代码来捕获此问题 但
  • 如何获得具有交替距离的xticks?

    我有一个条形图 其中 x 轴有国家 地区的 2 个字母标签 我必须选择一个非常小的字体 这样 x 刻度就不会相互重叠 有什么方法可以指定 x 刻度和 x 轴之间的距离 以便我可以选择更大的字体而不会重叠标签 现在 所需的示例 axis ti
  • 使用 geopandas 缓冲错误点

    晚上好 我正在开发一种产品来检测订阅区域内的本地事件 罢工 黄色多边形应该是围绕中心红点 40KM 左 和 50KM 右 的圆圈 绿点是我的罢工 应该在我的过程中检测到 看来我当前使用的 buffer 没有产生预期的 40 50 Km 缓冲
  • 为什么我的保证金不能与位置一起使用:固定?

    JSFiddle 演示 https jsfiddle net 0cmvg92m 我有一个用于标题的 div 和一个用于内容换行的 div 由于某种原因 我无法在标题底部留出边距来强制内容换行向下推 它只是完全忽略它 我不知道为什么 有谁知道
  • PHP IIS7 MSSQL 调用未定义的函数 sqlsrv_connect

    我有 MSSQL Server 2008 MS WINDOWS SERVER 2008 RC2 和 PHP 5 4 php info 有行 PHP PDO SQLSRV 54 NTS extension php pdo sqlsrv 54
  • 来自 gitlab-ci docker 的 SSH 在“SSH2_MSG_KEX_ECDH_REPLY”上失败

    我正在尝试从 GitLab CI 中运行的 Docker 部署容器通过 SSH 连接到远程网络服务器 我第一次尝试时确实成功连接了一次 现在它不断失败 调试输出的最后两行 完整输出如下 是 debug1 expecting SSH2 MSG