草庐IT

gitlab服务: kex_exchange_identification: Connection closed by remote host

格格巫 MMQ!! 2023-04-10 原文

搜索了一圈,其实是基本原理没理解到位。

git clone git@xxx.com:group/project.git实际使用的是SSH协议。多个认证文件存在时,通常需要在config文件中进行类似如下的配置——

需要强调的是:Port端口值是SSH服务的端口,只有在SSH服务的默认端口变更是才需要进行显示配置

Host github.com
# Specifies the real host name to log into. Numeric IP addresses are also permitted.
HostName github.com
# Defines the username for the SSH connection.
User gebitang
# Specifies a file from which the user’s DSA, ECDSA or DSA authentication identity is read.
IdentityFile ~/.ssh/id_rsa
Host prj.geb.cn
HostName prj.geb.cn
# Specifies the port number to connect on the remote host. only if the port for ssh connection is not 22.
Port 8201
# The default is ~/.ssh/identity for protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa and ~/.ssh/id_rsa for protocol version 2.
IdentityFile ~/.ssh/geb_id_rsa
自己搭建的环境使用的路由器自带的DMZ功能(路由器下的内网中的某台机器作为路由器绑定的静态ip的服务提供商。简单理解为——此静态ip提供的所有服务实际上都来自某台指定的内网机器)

搭建的gitlab服务使用的web服务端口是9527,而不是默认的80端口。使用http地址进行git操作时,提供用户名、密码可以正常进行操作。添加了ed25519格式的SSH key后,一直提示kex_exchange_identification: Connection closed by remote host的错误。执行ssh -vT git@stf.geb-corp.com测试时,提示如下详细信息。配置生效了,

from Mac

~ ssh -vT git@stf.geb-corp.com
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/gebitang/.ssh/config
debug1: /Users/gebitang/.ssh/config line 15: Applying options for stf.geb-corp.com
debug1: /Users/gebitang/.ssh/config line 28: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to stf.geb-corp.com port 9527.
debug1: Connection established.
debug1: identity file /Users/gebitang/.ssh/id_ed25519 type 3
debug1: identity file /Users/gebitang/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: kex_exchange_identification: banner line 0: HTTP/1.1 400 Bad Request
debug1: kex_exchange_identification: banner line 1: Server: nginx
debug1: kex_exchange_identification: banner line 2: Date: Tue, 27 Apr 2021 07:36:29 GMT
debug1: kex_exchange_identification: banner line 3: Content-Type: text/html
debug1: kex_exchange_identification: banner line 4: Content-Length: 150
debug1: kex_exchange_identification: banner line 5: Connection: close
debug1: kex_exchange_identification: banner line 6:
debug1: kex_exchange_identification: banner line 7:
debug1: kex_exchange_identification: banner line 8: 400 Bad Request
debug1: kex_exchange_identification: banner line 9:
debug1: kex_exchange_identification: banner line 10:

400 Bad Request


debug1: kex_exchange_identification: banner line 11:
nginx

debug1: kex_exchange_identification: banner line 12:
debug1: kex_exchange_identification: banner line 13:
kex_exchange_identification: Connection closed by remote host

from Windows

joechin@Gebitang MINGW64 /e/0daywork
$ ssh -vT git@stf.geb-corp.com
OpenSSH_7.7p1, OpenSSL 1.0.2o 27 Mar 2018
debug1: Reading configuration data /c/Users/joechin/.ssh/config
debug1: /c/Users/joechin/.ssh/config line 8: Applying options for stf.geb-corp.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to stf.geb-corp.com [10.112.78.174] port 9527.
debug1: Connection established.
debug1: identity file /c/Users/joechin/.ssh/id_ed25519 type 3
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/joechin/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.7
debug1: ssh_exchange_identification: HTTP/1.1 400 Bad Request
debug1: ssh_exchange_identification: Server: nginx
debug1: ssh_exchange_identification: Date: Tue, 27 Apr 2021 08:11:51 GMT
debug1: ssh_exchange_identification: Content-Type: text/html
debug1: ssh_exchange_identification: Content-Length: 150
debug1: ssh_exchange_identification: Connection: close
debug1: ssh_exchange_identification:
debug1: ssh_exchange_identification:
debug1: ssh_exchange_identification: 400 Bad Request
debug1: ssh_exchange_identification:
debug1: ssh_exchange_identification:

400 Bad Request


debug1: ssh_exchange_identification:
nginx

debug1: ssh_exchange_identification:
debug1: ssh_exchange_identification:
ssh_exchange_identification: Connection closed by remote host
可以在nginx的log下看到10.115.8.73 - - [27/Apr/2021:16:00:41 +0800] “- -” 400 150 “” "-"这样的信息。

实际上就只是端口配置错误了而已~~

有关gitlab服务: kex_exchange_identification: Connection closed by remote host的更多相关文章

  1. ruby - 使用 ruby​​ 和 savon 的 SOAP 服务 - 2

    我正在尝试使用ruby​​和Savon来使用网络服务。测试服务为http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2require'rubygems'require'savon'client=Savon::Client.new"http://www.webservicex.net/stockquote.asmx?WSDL"client.get_quotedo|soap|soap.body={:symbol=>"AAPL"}end返回SOAP异常。检查soap信封,在我看来soap请求没有正确的命名空间。任何人都可以建议我

  2. ruby - 具有身份验证的私有(private) Ruby Gem 服务器 - 2

    我想安装一个带有一些身份验证的私有(private)Rubygem服务器。我希望能够使用公共(public)Ubuntu服务器托管内部gem。我读到了http://docs.rubygems.org/read/chapter/18.但是那个没有身份验证-如我所见。然后我读到了https://github.com/cwninja/geminabox.但是当我使用基本身份验证(他们在他们的Wiki中有)时,它会提示从我的服务器获取源。所以。如何制作带有身份验证的私有(private)Rubygem服务器?这是不可能的吗?谢谢。编辑:Geminabox问题。我尝试“捆绑”以安装新的gem..

  3. ruby-on-rails - 启动 Rails 服务器时 ImageMagick 的警告 - 2

    最近,当我启动我的Rails服务器时,我收到了一长串警告。虽然它不影响我的应用程序,但我想知道如何解决这些警告。我的估计是imagemagick以某种方式被调用了两次?当我在警告前后检查我的git日志时。我想知道如何解决这个问题。-bcrypt-ruby(3.1.2)-better_errors(1.0.1)+bcrypt(3.1.7)+bcrypt-ruby(3.1.5)-bcrypt(>=3.1.3)+better_errors(1.1.0)bcrypt和imagemagick有关系吗?/Users/rbchris/.rbenv/versions/2.0.0-p247/lib/ru

  4. ruby-on-rails - s3_direct_upload 在生产服务器中不工作 - 2

    在Rails4.0.2中,我使用s3_direct_upload和aws-sdkgems直接为s3存储桶上传文件。在开发环境中它工作正常,但在生产环境中它会抛出如下错误,ActionView::Template::Error(noimplicitconversionofnilintoString)在View中,create_cv_url,:id=>"s3_uploader",:key=>"cv_uploads/{unique_id}/${filename}",:key_starts_with=>"cv_uploads/",:callback_param=>"cv[direct_uplo

  5. ruby - 用 Ruby 编写一个简单的网络服务器 - 2

    我想在Ruby中创建一个用于开发目的的极其简单的Web服务器(不,不想使用现成的解决方案)。代码如下:#!/usr/bin/rubyrequire'socket'server=TCPServer.new('127.0.0.1',8080)whileconnection=server.acceptheaders=[]length=0whileline=connection.getsheaders想法是从命令行运行这个脚本,提供另一个脚本,它将在其标准输入上获取请求,并在其标准输出上返回完整的响应。到目前为止一切顺利,但事实证明这真的很脆弱,因为它在第二个请求上中断并出现错误:/usr/b

  6. ruby-on-rails - 在 Rails 中调试生产服务器 - 2

    您如何在Rails中的实时服务器上进行有效调试,无论是在测试版/生产服务器上?我试过直接在服务器上修改文件,然后重启应用,但是修改好像没有生效,或者需要很长时间(缓存?)我也试过在本地做“脚本/服务器生产”,但是那很慢另一种选择是编码和部署,但效率很低。有人对他们如何有效地做到这一点有任何见解吗? 最佳答案 我会回答你的问题,即使我不同意这种热修补服务器代码的方式:)首先,你真的确定你已经重启了服务器吗?您可以通过跟踪日志文件来检查它。您更改的代码显示的View可能会被缓存。缓存页面位于tmp/cache文件夹下。您可以尝试手动删除

  7. ruby - 我的 Ruby IRC 机器人没有连接到 IRC 服务器。我究竟做错了什么? - 2

    require"socket"server="irc.rizon.net"port="6667"nick="RubyIRCBot"channel="#0x40"s=TCPSocket.open(server,port)s.print("USERTesting",0)s.print("NICK#{nick}",0)s.print("JOIN#{channel}",0)这个IRC机器人没有连接到IRC服务器,我做错了什么? 最佳答案 失败并显示此消息::irc.shakeababy.net461*USER:Notenoughparame

  8. ruby - Rails 开发服务器、PDFKit 和多线程 - 2

    我有一个使用PDFKit呈现网页的pdf版本的Rails应用程序。我使用Thin作为开发服务器。问题是当我处于开发模式时。当我使用“bundleexecrailss”启动我的服务器并尝试呈现任何PDF时,整个过程会陷入僵局,因为当您呈现PDF时,会向服务器请求一些额外的资源,如图像和css,看起来只有一个线程.如何配置Rails开发服务器以运行多个工作线程?非常感谢。 最佳答案 我找到的最简单的解决方案是unicorn.geminstallunicorn创建一个unicorn.conf:worker_processes3然后使用它:

  9. ruby - Dropbox 类似 git 的服务——没有 rsync 和 inotify - 2

    关于如何使用git设置类似Dropbox的服务,您有什么建议吗?您认为git是解决此问题的合适工具吗?我在考虑使用git+rush解决方案,你觉得怎么样? 最佳答案 检查这个开源项目:https://github.com/hbons/SparkleShare来自项目的自述文件:Howdoesitwork?SparkleSharecreatesaspecialfolderonyourcomputer.Youcanaddremotelyhostedfolders(or"projects")tothisfolder.Theseprojec

  10. ruby - 将 Gitlab 从 9.3.7 更新到 9.3.8 安装 re2 时出错 - 2

    我们在Ubuntu14.04和Gitlab9.3.7上运行,运行良好。我们正在尝试更新到Gitlabv9.3.8的最新安全补丁,但它给我们这个错误:Gem::Ext::BuildError:ERROR:Failedtobuildgemnativeextension.currentdirectory:/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/re2-1.0.0/ext/re2/usr/local/bin/ruby-r./siteconf20170720-19622-15i0edf.rbextconf.rbcheckingformain(

随机推荐