could not establish connection to "<host name>" - amazon-web-services

I am not able to connect with aws ec2 instance in vs code through remote ssh from my home wifi.
But when I try connect with mobile net then it connects with ec2 instance.
Below is what I am getting while connecting from my wifi.
[10:53:20.718] Log Level: 2
[10:53:20.722] remote-ssh#0.92.0
[10:53:20.722] win32 x64
[10:53:20.728] SSH Resolver called for "ssh-remote+test-crilic", attempt 1
[10:53:20.728] "remote.SSH.useLocalServer": false
[10:53:20.728] "remote.SSH.showLoginTerminal": false
[10:53:20.729] "remote.SSH.remotePlatform": {"crilc_vikralya":"linux","crilc_bob":"linux","test_ec2":"linux","test-crilic":"linux"}
[10:53:20.729] "remote.SSH.path": undefined
[10:53:20.729] "remote.SSH.configFile": undefined
[10:53:20.729] "remote.SSH.useFlock": true
[10:53:20.729] "remote.SSH.lockfilesInTmp": false
[10:53:20.729] "remote.SSH.localServerDownload": auto
[10:53:20.729] "remote.SSH.remoteServerListenOnSocket": false
[10:53:20.730] "remote.SSH.showLoginTerminal": false
[10:53:20.730] "remote.SSH.defaultExtensions": []
[10:53:20.730] "remote.SSH.loglevel": 2
[10:53:20.730] "remote.SSH.enableDynamicForwarding": true
[10:53:20.730] "remote.SSH.enableRemoteCommand": false
[10:53:20.730] "remote.SSH.serverPickPortsFromRange": {}
[10:53:20.730] "remote.SSH.serverInstallPath": {}
[10:53:20.734] SSH Resolver called for host: test-crilic
[10:53:20.734] Setting up SSH remote "test-crilic"
[10:53:20.741] Using commit id "6261075646f055b99068d3688932416f2346dd3b" and quality "stable" for server
[10:53:20.745] Install and start server if needed
[10:53:20.749] Checking ssh with "ssh -V"
[10:53:20.793] > OpenSSH_for_Windows_8.6p1, Libr
[10:53:20.794] > eSSL 3.4.3
[10:53:20.799] Running script with connection command: ssh -T -D 53829 "test-crilic" bash
[10:53:20.802] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[10:53:42.844] > ssh: connect to host port 22: Connection timed out
> The process tried to write to a nonexistent pipe.
> ]0;C:\WINDOWS\System32\cmd.exe
[10:53:42.845] Got some output, clearing connection timeout
[10:53:44.137] "install" terminal command done
[10:53:44.138] Install terminal quit with output: ]0;C:\WINDOWS\System32\cmd.exe
[10:53:44.138] Received install output: ]0;C:\WINDOWS\System32\cmd.exe
[10:53:44.140] Failed to parse remote port from server output
[10:53:44.142] Resolver error: Error:
at g.Create (c:\Users\Lenovo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:583821)
at t.handleInstallOutput (c:\Users\Lenovo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:582473)
at t.tryInstall (c:\Users\Lenovo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:679811)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async c:\Users\Lenovo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:642614
at async t.withShowDetailsEvent (c:\Users\Lenovo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:645932)
at async t.resolve (c:\Users\Lenovo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:643664)
at async c:\Users\Lenovo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:722342
[10:53:44.153] ------

Related

Conan fails to upload to Artifactory instance over HTTPS

Currently I have Artifactory set up through a system.yaml file
configVersion: 1
shared:
security:
exposeApplicationHeaders: true
node:
id: "*.example.com"
ip: artifacts.example.com
metrics:
enabled: true
artifactory:
#port: 8081
tomcat:
httpsConnector:
enabled: true
port: 8443
certificateFile: "$JFROG_HOME/artifactory/var/etc/artifactory/security/trusted/server2.crt"
certificateKeyFile: "$JFROG_HOME/artifactory/var/etc/artifactory/security/trusted/server.key"
frontend:
featureToggler:
commonProjects: true
And I'm able to access the webview on port 8082 through https just fine
I created a repo for conan artifacts and generated an api key. Then using the "set me up" prompt I ran the following commands on my dev machine
conan remote add myremote https://artifacts.example.com:8081/artifactory/api/conan/myremote
conan user -p <apikey> -r myremote will
I then get the following error from Conan
ERROR: HTTPSConnectionPool(host='artifacts.example.com', port=8081): Max retries exceeded with url: /artifactory/api/conan/myremote/v1/ping (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1131)')))
Unable to connect to myremote=https://artifacts.example.com:8081/artifactory/api/conan/myremote
1. Make sure the remote is reachable or,
2. Disable it by using conan remote disable,
Then try again.
I tried to repeat the same steps but using http instead of http and all worked fine. What am I doing wrong that won't let https access work?

cant connect ec-2 with VS Code

So I have been trying to connect with the remote server using vscode but getting this error. I can connect with the remote server using powershell as administrator. I also made sure to add the correct path to my config file. I have also deleted the config and known host files before creating new connection. What am I missing? Thanks in advance!
[21:16:19.622] Log Level: 2
[21:16:19.626] remote-ssh#0.70.0
[21:16:19.626] win32 x64
[21:16:19.627] SSH Resolver called for "ssh-remote+ec2-3-110-180-100.ap-south-1.compute.amazonaws.com", attempt 1
[21:16:19.628] "remote.SSH.useLocalServer": false
[21:16:19.628] "remote.SSH.showLoginTerminal": true
[21:16:19.629] "remote.SSH.remotePlatform": {}
[21:16:19.629] "remote.SSH.path": undefined
[21:16:19.629] "remote.SSH.configFile": C:\Users\ASUS\.ssh\config
[21:16:19.629] "remote.SSH.useFlock": true
[21:16:19.630] "remote.SSH.lockfilesInTmp": false
[21:16:19.630] "remote.SSH.localServerDownload": auto
[21:16:19.630] "remote.SSH.remoteServerListenOnSocket": true
[21:16:19.630] "remote.SSH.showLoginTerminal": true
[21:16:19.631] "remote.SSH.defaultExtensions": []
[21:16:19.634] "remote.SSH.loglevel": 2
[21:16:19.635] "remote.SSH.serverPickPortsFromRange": {}
[21:16:19.635] "remote.SSH.enableDynamicForwarding": true
[21:16:19.635] "remote.SSH.serverInstallPath": {}
[21:16:19.637] SSH Resolver called for host: ec2-3-110-180-100.ap-south-1.compute.amazonaws.com
[21:16:19.637] Setting up SSH remote "ec2-3-110-180-100.ap-south-1.compute.amazonaws.com"
[21:16:19.664] Using commit id "899d46d82c4c95423fb7e10e68eba52050e30ba3" and quality "stable" for server
[21:16:19.669] Install and start server if needed
[21:16:21.362] Checking ssh with "ssh -V"
[21:16:21.403] > OpenSSH_for_Windows_8.1
[21:16:21.403] > p1, LibreSSL 3.0.2
[21:16:21.408] Using SSH config file "C:\Users\ASUS\.ssh\config"
[21:16:21.408] Running script with connection command: ssh -T -D 7767 -F "C:\Users\ASUS\.ssh\config" "ec2-3-110-180-100.ap-south-1.compute.amazonaws.com" bash
[21:16:21.412] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[21:16:21.779] > ]0;C:\WINDOWS\System32\cmd.exe
[21:16:21.779] Got some output, clearing connection timeout
[21:16:21.798] >
> [21:16:22.159] > The authenticity of host 'ec2-3-110-180-100.ap-south-1.compute.amazonaws.
> com (3.110.180.100)' can't be established.
> ECDSA key fingerprint is SHA256:XkSx5IvSMQVKMuqzN5gAWTlM8xGAXvqQh40DubYUk
sk.
> Are you sure you want to continue connecting (yes/no/[fingerprint])?
[21:16:24.233] > y
[21:16:24.427] > e
[21:16:24.813] > s
[21:16:27.069] >
[21:16:27.090] > Warning: Permanently added 'ec2-3-110-180-100.ap-south-1.compute.amazonaw
> s.com,3.110.180.100' (ECDSA) to the list of known hosts.
[21:16:27.422] > Load key "D:\\unive\\unive-bitnami.pem": Permission denied
[21:16:27.442] > bitnami#ec2-3-110-180-100.ap-south-1.compute.amazonaws.com: Permission de
> nied (publickey).
> The process tried to write to a nonexistent pipe.
>
[21:16:28.730] "install" terminal command done
[21:16:28.731] Install terminal quit with output: nied (publickey).
[21:16:28.732] Received install output: nied (publickey).
[21:16:28.733] Failed to parse remote port from server output
[21:16:28.735] Resolver error: Error:
at Function.Create (c:\Users\ASUS\.vscode\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:430425)
at Object.t.handleInstallOutput (c:\Users\ASUS\.vscode\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:429068)
at Object.t.tryInstall (c:\Users\ASUS\.vscode\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:524212)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async c:\Users\ASUS\.vscode\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:487216
at async Object.t.withShowDetailsEvent (c:\Users\ASUS\.vscode\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:490561)
at async Object.t.resolve (c:\Users\ASUS\.vscode\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:488295)
at async c:\Users\ASUS\.vscode\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:564197
[21:16:28.743] ------

AWS EC2 Instance keeps disconnecting

Currently, I'm using a Visual Studio Code SSH Plugin to edit my files directly on the EC2 without having to edit it locally and transfer the files. But I've noticed that the EC2 instance has stopped responding after 30 minutes or so and I have to keep rebooting the server in order for it to respond again. The problem is not with the plugin (in terms of connecting to the server) when VSC notifies me saying that the connection as dropped, the same thing occurred to all of my other SSH tools. Is there something I have to do in order for its connection to stay alive?
VSC Plugin: https://code.visualstudio.com/docs/remote/ssh
Error:
[16:07:19.876] stderr> ssh: connect to host ec2Host port 22: Operation timed out
[16:07:19.877] > local-server> ssh child died, shutting down
[16:07:19.879] Local server exit: 0
[16:07:19.880] Received install output: OpenSSH_8.1p1, LibreSSL 2.7.3
ssh: connect to host ec2Host port 22: Operation timed out

code-server WebSocket close with status code 1006

I am trying to install code-server 3.6.2 on a cloud platform. I have tried both AWS and digitalocean machines but in both systems, I can open code server but it gives an error "WebSocket close with status code 1006".
I have followed the procedure from https://www.digitalocean.com/community/tutorials/how-to-set-up-the-code-server-cloud-ide-platform-on-ubuntu-20-04
code-server uses websocket to connect.Do you use HTTPS?
If so, you should Use wss to forward ws.like this:
// forward websocket (wss -> ws)
httpsServer.on('upgrade', function (req, socket, head) {
proxy.ws(req, socket, head, {
target: 'ws://...',
ws: true
})
})
Usually this and other errors happen when you use code server locally
To solve it you can use the --link parameter that gives you a url with temporary https, or you can also use ngrok
//Option 1
code-server --host 127.0.0.1 --bind-addr 0.0.0.0:9000 --auth password --link
//Option 2
code-server --host 127.0.0.1 --bind-addr 0.0.0.0:9000 --auth password
ngrok http 9000

Docker Private Registry: ping attempt failed

I'm trying to set up my private Docker Registry and I'm following the official documentation.
I have installed Docker and I'm able to run my registry on my server. But I want my registry to be more widely available.
My docker-server with the private registry is installed on an AWS-instance.
I have created my own certificate and key by using keytool:
docker run -d -p 5000:5000 --restart=always --name registry \
-v `pwd`/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
registry:2
I'm able to ping this instance by:
ping ec2-xx-xx-xx-xx.xx-west/east-1.compute.amazonaws.com
But pushing is not possible:
The push refers to a repository [ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/ubuntu] (len: 1)
unable to ping registry endpoint https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v0/
v2 ping attempt failed with error: Get https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v2/: dial tcp 10.x.x.x:5000: i/o timeout
v1 ping attempt failed with error: Get https://ec2-xx-xx-xx-xx.amazonaws.com:5000/v1/_ping: dial tcp 10.0.x.x:5000: i/o timeout
EDIT1:
After changing my aws-security group. Set port 5000 to TCP, the error changed:
unable to ping registry endpoint https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v0/
v2 ping attempt failed with error: Get https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v2/: dial tcp 10.0.x.x:5000: connection refused
v1 ping attempt failed with error: Get https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v1/_ping: dial tcp 10.0.x.x:5000: connection refused
How do I have to make my registry accessible for other aws-instances?
My docker logs are showing the following. They can't find my certificate.
level=fatal msg="open /certs/domain.crt: no such file or directory"
Do I have to put this certificate in my container itself? (and generate it with keytool by myself or using an existing)
EDIT2:
I've generated my own certificates using this documentation.
After generating the certificates I did restart my docker daemon. I did not perform the copy of domain.crt to ca.crt because the path didn't exist. Maybe I have to create it by myself?
new error:
unable to ping registry endpoint https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v0/
v2 ping attempt failed with error: Get https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v2/: dial tcp 10.0.x.x:5000: no route to host
v1 ping attempt failed with error: Get https://ec2-xx-xx-xx-xx.compute.amazonaws.com:5000/v1/_ping: dial tcp 10.0.x.x:5000: no route to host
But I still get the following in my docker logs:
level=fatal msg="open /certs/domain.crt: no such file or directory"
After trying to perform a push, there is created a new /certs folder into my existing certsfolder
EDIT3:
After finding the right directory for my certificate (/home/centos/certs/certs/*.). I get the following error:
level=fatal msg="open /certs/domain.crt: permission denied
Even if I perform a chmod -R 777 and chown -R root:root
You will need to place the certificate in this directory.
/etc/docker/certs.d/<your-domain-name>:5000/ca.crt