I have a Digital Ocean droplet running a NodeJS app with a Mongo DB v 3.2.21. I have been using the Compass app to access the DB via its SSH tunnel option, however it stopped working and is giving me this error when I try to connect:
connect ECONNREFUSED 127.0.0.1:27017.
The Compass configuration is using:
Hostname: localhost
Port: 27017
Authentication: None
SSH Tunnel: Use Identity File
SSH Hostname:
SSH Tunnel Port: 22
SSH Username: root
SSH Identity File: ID_RSA
The result of netstat -ntlp | grep LISTEN on the remote machine is:
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 621/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3209/sshd
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 8395/mongod
tcp6 0 0 :::80 :::* LISTEN 9009/node /app/app.
tcp6 0 0 :::22 :::* LISTEN 3209/sshd
tcp6 0 0 :::443 :::* LISTEN 9009/node /app/app.
Some possible clues:
The Compass app is running on a Mac that I just updated to 10.15.4 - I am not 100% sure that the problem coincided with this update but it seems suspicious.
I can SSH into the remote machine using the same credentials via Terminal on my Mac. When I SSH in, I can run the Mongo shell fine, read the db, etc.
My nodeJS app can access the DB fine.
If I stop the app, same message.
If I stop the app and also stop the mongod service, the error message is: Error creating SSH Tunnel: (SSH) Channel open failure: Connection refused
So I think the SSH tunnel is working, but Mongo is refusing the connection (?)
Any help, or pointers would be greatly appreciated. Thanks.
I was having same issue. According to #user2876623's suggestion the problem lies with the Compass app. I just updated Compass to the latest version and it worked fine.
Related
I want to use my raspberry pi, which runs Manjaro ARM, as a server for my local network. I have a golang server running permanently using systemd services. However, I can't access the website from another computer in the network. I disabled iptables and nftables but it still did not work. The server is running and I can even access the website, but only when using curl on the pi itself.
A ping from another machine works fine but scanning the port with nmap fails (the port is marked as filtered)
My code worked fine on my laptop, which runs regular Manjaro, I was able to access the website from any device on the network (even though iptables was not disabled there)
ss -lnt outputs:
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 0.0.0.0:5355 0.0.0.0:*
LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 4096 [::]:5355 [::]:*
LISTEN 0 4096 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 4096 *:443 *:*
curl -k https://andre-pi outputs Permanent Redirect but only when run on the pi
Any suggestions what else I could try?
With which command have you tried to access the website with curl? And does the server listen to 0.0.0.0 or 127.0.0.1?
Found the answer. There was another firewall I didn't know about called firewalld. I found it by going through all the installed packages with pacman -Qqe wich I piped through less.
I am building a home server on Raspberry Pi 3 model A+ and am trying to set up Webmin. IP is 192.168.2.16 and the hostname is raspberrypi. Using SSH, I downloaded Webmin and ran it on port 10000, but I cannot access it on my browser at raspberrypi:10000. I can access raspberrypi, though.
I tried restarting it, reinstalling it, and changing the port number as in this post Unable to access Webmin through browser, but none of these seemed to work.
Firewall is disabled as default on Raspberry Pi, so it should not be an issue.
The port is accepting connections and I can access it through the command line, but on the browser the website never loads.
$ nc -zvw 3 raspberrypi 10000
Connection to raspberrypi 10000 port [tcp/webmin] succeeded!
$ netstat -an | grep 10000
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN
tcp 0 0 192.168.2.16:10000 192.168.2.13:53130 ESTABLISHED
udp 0 0 0.0.0.0:10000 0.0.0.0:*
Any help would be appreciated.
Accessing https://raspberrypi:10000 instead of http worked.
I'm trying to create a tunnel to a remote server, using this command:
sudo ssh -i ~/.ssh/id_rsa -g -L 5433:remote-ip:5432 user#dbserver.com -v
So, the goal is to set up tunnel that listens on local port 5433 and redirects the request to dbserver.com:5432
I have Teampostgresql set up on my local machine and try to connect to the remote DB, using the tunnel.
When I set up the tunnel and try to connect, I can see the following message in the terminal window:
debug1: channel 3: free: direct-tcpip: listening port 5433 for 127.0.0.1 port 5432,
connect from 127.0.0.1 port 51893 to 127.0.0.1 port 5433, nchannels 5
Unfortunately, it's not working.
Any ideas what I'm doing wrong?
[Edit]
Changed the localhost to remote-host IP, as recommended by the first commenter (who, interestingly, deleted the comment)...
[Edit2]
As per request, the results from netstat -nlp | grep 5432
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN -
unix 2 [ ACC ] STREAM LISTENS 15963 - /tmp/.s.PGSQL.5432
unix 2 [ ACC ] STREAM LISTENS 15961 - /var/run/postgresql/.s.PGSQL.5432
I have followed all the advice I've found online, but I can't seem to get this to work.
Background:
I have setup Postgresql 9.6 on a server running RHEL 6.8. I am trying to remotely connect to this server's Postgresql service from a client running Linux Mint 17.3.
What I've tried:
1) In postgresql.conf, I added these two lines:
listen_addresses = '*'
port = 5432
2) In pg_hba.conf, I added this line:
host all all 0.0.0.0/0 md5
3) Restarted postgresql server afterwards:
service postgresql-9.6 restart
4) Added rule to firewall to allow connections to port 5432 just in case:
iptables -A INPUT -s 0/0 -p tcp --dport 5432 -j ACCEPT
5) Ran netstat -tulpn | grep 5432 and got this output:
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 2625/postmaster
tcp 0 0 ::::5432 :::* LISTEN 2625/postmaster
Here is the command I ran to connect to my server from the client:
psql -h my_host_name -d my_database_name -U postgres
And I got the following output:
psql: could not connect to server: Connection timed out
Is the server running on host "my_host_name" (my_ip_address) and accepting
TCP/IP connections on port 5432?
Question:
What else can I do to further troubleshoot this issue?
Turns out there was another firewall on our network that I wasn't taking into account. To anybody else dealing with this issue, make sure that you are absolutely sure that you are not dealing with a firewall.
I recently installed postgresql on my ubuntu 14.04 vm, but I can't seem to be able to connect to my database from localhost: postgres://127.0.0.1:5432/mydb?sslmode=disable is not found, although psql mydb brings me to the correct terminal, sudo netstat -plunt |grep postgres returns nothing, but su postgres -c "netstat -plunt |grep postgres" prints:
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 31/postgres
tcp6 0 0 ::1:5432 :::* LISTEN 31/postgres
So it's clearly there, just somehow under the postgres ubuntu user (but with the database belonging to root). I know that there is a way to reconfigure my postgresql installation such that it can be reached through localhost (postgres://127.0.0.1:5432/mydb?sslmode=disable works), and if anyone could tell me what I need to do, that would be awesome. Thank you!