I am in Ubuntu 20.04.2 LTS telling this because looks like this version has encryption issues. Today I created a key that's perfectly working on but gives kex_exchange_identification: Connection closed by remote host for private GitLab domain here is the .ssh config file
Host gitlab.com Hostname altssh.gitlab.com User git Port 443 PreferredAuthentications publickey IdentityFile ~/.ssh/id_ed25519 # Private GitLab instance Host gitlab.ebpearls.com Hostname gitlab.ebpearls.com User git Port 443 PreferredAuthentications publickey IdentityFile ~/.ssh/id_ed25519 here is the full log
ssh -Tvvv git@gitlab.<mycompanydomain>.com OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f 31 Mar 2020 debug1: Reading configuration data /home/nabin/.ssh/config debug1: /home/nabin/.ssh/config line 9: Applying options for gitlab.ebpearls.com debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files debug1: /etc/ssh/ssh_config line 21: Applying options for * debug2: resolving "gitlab.ebpearls.com" port 443 debug2: ssh_connect_direct debug1: Connecting to gitlab.ebpearls.com [mycompanyip] port 443. debug1: Connection established. debug1: identity file /home/nabin/.ssh/id_ed25519 type 3 debug1: identity file /home/nabin/.ssh/id_ed25519-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.3 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: Wed, 06 Oct 2021 06:50:54 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: <html> debug1: kex_exchange_identification: banner line 8: <head><title>400 Bad Request</title></head> debug1: kex_exchange_identification: banner line 9: <body> debug1: kex_exchange_identification: banner line 10: <center><h1>400 Bad Request</h1></center> debug1: kex_exchange_identification: banner line 11: <hr><center>nginx</center> debug1: kex_exchange_identification: banner line 12: </body> debug1: kex_exchange_identification: banner line 13: </html> kex_exchange_identification: Connection closed by remot 31 Answer
Thats because private gitlab repo doesn't allow ssh from 443 and ISP doesn't allow port 22 for ssh. For those private repo which allow 443 this solution will work. I should be looking for some Jump server sloution where I can use the middle jump server's port 443 then ssh to port 22 of targeted server from there.