0

I have an ssh config file like this. I have a proxy jump to host1 from test2.

Host host1
  Hostname xxxxxx.us-east-1.elb.amazonaws.com
  Port 2222
  User xxxx
  IdentityFile ~/.ssh/cert
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  KeepAlive yes
  ServerAliveInterval 30
  ServerAliveCountMax 30

Host test2
  Hostname xx.xxx.xx.xxx
  ProxyCommand  ssh.exe host1  -q -W %h:%p host1
  User ubuntu
  IdentityFile ~/.ssh/cert
  KeepAlive yes
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  ServerAliveInterval 30
  ServerAliveCountMax 30

I have to Use SSH Tunneling to Mongodb using Host test2, But it uses Proxy Jump using ProxyCommand

I want to connect to mongodb using SSH Tunneling with a Mongo DB Compass and also with node js mongoose.

How Can I connect using the Mongo DB Compass?

enter image description here

Here I don't have an option to enter ProxyCommand details.

How Can I connect using node js?

I am using tunnel-ssh, I have a reference code ,

var config = {
    username:'ubuntu',
    host:'xx.xxx.xx.xxx',
    agent : process.env.SSH_AUTH_SOCK,
    privateKey:require('fs').readFileSync('~/.ssh/cert'),
    port:22,
    dstPort:27017,
    password:'mypassword'
};

var server = tunnel(config, function (error, server) {
  
});

Here as well how can I enter ProxyCommand details here?

0 Answers0