Failed to connect openshift using oc client on wsl2 - windows

I am using wsl2 (Ubuntu) on windows, and I have been installed openshift client for windows, but when I run oc login (oc login https://myhost --token=myToken) on wls2, it returns "error: dial tcp: lookup "myhost" on xxx.xx.xxx.x:xx: read udp xxx.xx.xxx.xxx:xxxxx->xxx.xx.xxx.x:xx: i/o timeout - verify you have provided the correct host and port and that the server is currently running."
Note: When i run oc login on windows (cmd/powershell) it works
Any solutions?
Thank you.
UPDATE
The problem is because I'm using vpn(GlobalProtect) when connecting to openshift. When I disconnect the vpn, the oc command runs properly.
Is it possible to run the oc command while connected to vpn (GlobalProtect)?

Related

Unable to connect MongoDB Compass to AWS DocumentDB using SSH tunnel

I am new to mongoDB trying to setup tools for my new project. Most of my infrastructure run on AWS so i prefer to use AWS documentDB. I manage to connect to documentDB from EC2 both via mongo client or NodeJS aplication. but it would be good to mange documentDB from my Windows workstation using MongoDB Compass.
As we know, we can not direct connect any mongo client from outside AWS to DocumentDB Connecting to an Amazon DocumentDB Cluster from Outside an Amazon VPC
so we need SSH tunnel through EC2. I try many options but still fail... below are most likely 2 options:
Option 1: Connect using MongoDB Compass SSH tunnel
Error: unable to get local issuer certificate
both RDS-COMBINED-CA-BUNDLE.PEM and SSH Key already supplied so which one unable to get?
as red highlight on SSH port, I also tried to open another SSHD port on server and tried to connect using second port but still failed.
Option 2: Connect using Putty SSH tunnel
Error: Hostname/IP does not match certificate's altnames...
since MongoDB Compass need to connect to locathost to get into tunnel and i still can not find the way to supply --sslAllowInvalidHostnames options.
So, what i can do to get around this ?
MongoDB Compass: 1.25.0
I am done with Compass.
successful established "robo3t" connection to AWS DocumentDB using this guild.
https://docs.aws.amazon.com/documentdb/latest/developerguide/robo3t.html
As of Jan 2022 MongoDB Compass does not support sslInvalidHostNameAllowed=true in the connection builder form, this is the parameter you are missing in order to connect to AWS DocumentDB while ssh tunneling to a machine inside the same VPC of the database itself.
I used Studio 3T and it worked perfectly. You could create the connection string yourself or try other GUI.
Edit Jan 2023:
I just gave a try to compass again and it seems they now support sslInvalidHostNameAllowed flag through the UI, you could still change manually the connection string but then any UI interaction would overwrite it.
If you edit the connection string directly in MongoDB Compass you can set options that may not be accessible in the user interface.
Below is an example with tweaked parameters to connect without using TLS:
mongodb://xxxx:yyyy#localhost:27017/?authSource=admin&connectTimeoutMS=10000&readPreference=primary&authMechanism=SCRAM-SHA-1&serverSelectionTimeoutMS=5000&appname=MongoDB%20Compass&ssl=false
For Hostname, are you using DocumentDB endpoint? In one screenshot, I see you are using localhost.
I have managed to connect with option 1.
The workaround can be by establish connection using SSH Tunnel (port forward) and so that SSH tunnel opens a port on your local system that connects through to another port at the other end of the tunnel.
Using the below command establishes a tunnel on terminal and later you can use this channel/connection to connect MongoDB using MongoDB Compass.
For example:
ssh user#aws-ec2-ip-address -L 35356:127.0.0.1:27017 -N
where -L as the Local listening side
Port 35356 is listening on localhost (that is in this case your EC2) and port forwards through to port 27017 on remote server.
Note - Add identity file in .ssh/config
Ex - On Mac
Host XXXXXXX
HostName 52.xx.xx.xx
User ubuntu
IdentityFile ./path/prod.pem

Gatsby on EC2 doesn't connect externally

I have a development installation of Gatsby Doc site running on my EC2 server.
When I run the code on my dev machine it works and I can connect my browser to port 8000 and everything is ok..
On my server i check out my github code and
yarn install
npm run start.
Everything builds correctly and Gatsby it listening on port 8000
From my dev machine when I connect using
X.X.X.X:8000 in my browser i receive
Unable to connect
I have opened the port on 8000 in the firewall and I have tested that it works as expected using:
nc -lv 8000
on the server (where gatsby is going to run) and connect using telnet.
on the server i receive
Listening on [0.0.0.0] (family 0, port 8000)
Connection from 84.232.Y.Y 38552 received!
So it works.
When Gatsby is finished starting i see
You can now view gatsbyjs.org in the browser. ⠀ http://localhost:8000/
⠀
when i enter the web address and port i receive
Unable to connect
again. do I need to start Gatsby in another mode?
Kim
I found out.
I just added -H 0.0.0.0 to the start up command and everything works now.

How can I connect to a remote mongodb server using the mongo shell?

Trying to connect to a remote MongoDB server I get: socket operation timed out.
and the firewall log also doesn't mention any attempted connection.
I have the Mongodb running on a remote Windows 2012 vm.
I used --bind_ip 0.0.0.0 and added the firewall rules from the docs.
ping´ing from either client/server works and so does the vnc.
And I'm able to connect from the server using either localhost or the ip
Im new to networking and thought I slowly understand, but apparently thats not the case!
Is there anything else I did not consider?
Try this in your terminal
mongo -u <USER> -p <PASSWORD> <HOST>:<PORT>/<DB> --authenticationDatabase <AUTH_DB>

How to use gcloud compute scp over a proxy network?

I want to use gcloud compute scp over an authentication proxy network. I tried setting the proxy in gcloud command line sdk using
gcloud proxy settings
Thereafter, I tried
gcloud compute scp --recurse nakumgaurav25#instance-2:~/myData ~/Desktop
But it doesn't work. The error shown is
ssh: connect to host 35.230.136.59 port 22: Connection timed out.
Note that the same command works when I disable the proxy settings and connect my PC to a non-proxy network.
are you still getting the connection refused message ? I need a little be more info to help you out; (1) which type of proxy are you using? (2) the remote machine (VM) is a linux OS? because is not possible use gcloud compute scp from a Windows VM. assuming the remote machine is using Linux OS, have you try to set a variable on your local host export http_proxy=server-ip:port then set again the proxy.

Java mail client can't reach SMTP server from Docker container

I have created simple Java application which sends emails. It's working properly when I running it from my IDE, but when running it inside a Docker container it can't reach the remote SMTP server. I'm using
docker run -d -p 25:25 [image]:[tag]
to expose port 25 when starting the container. Does anyone has an idea why the mail client can't connect?
I think you are confusing the point of the port mapping. This is to allow the host to bind the specified port on the given network interface to the port in the container. In your case you are trying to connect to port 25 i presume on another remote host.
If the app works when run in the IDE I'd assume either an issue resolving the SMTP server or a problem with the address on which the SMTP server is listening.
Are you running the SMTP server locally or connecting to one that is resolvable via public DNS? If you use docker exec to enter the running container can you telnet to the SMTP server?

Resources