Jump to content

Recommended Posts

Posted

Hi,

I made this same request before (https://www.helionet.org/index/topic/43467-solved-port-27017-for-mongodb-atlas/#comment-186601) but it looks like post system migration the port is again closed. So could you please open port 27017 for these IPs:

  1. radtech-shard-00-01.p4cyn.mongodb.net ( 18.138.205.196 ),
  2. radtech-shard-00-00.p4cyn.mongodb.net ( 54.255.46.254 ),
  3. radtech-shard-00-02.p4cyn.mongodb.net ( 52.74.75.34 )

Many thanks.

 

Posted

Hi,

18 hours ago, Krydos said:

Can you connect now?

I'm afraid it's still not working. The python script can be accessed at https://rarahim.heliohost.us/scripts/search_alert/test-mongo.py .

The source file is attached (no worries, only a test account with read-only access to a test database). The file permission is 755.

The exact same script when run locally on my machine works as expected. See the attached screenshot of the output.

image.png.a8da7e352996db267f437c10b69a0aac.png

My local machine is running Python 3.10. The requirements.txt file is also attached. The same script used to work fine before prior to system migration.

Thanks in advance.

test-mongo.py requirements.txt

Posted

Check your URL. The script you listed is trying to connect to radtech.p4cyn.mongodb.net which doesn't exist, or at least there is no DNS for it.

Posted
On 10/15/2022 at 9:12 AM, Krydos said:

Check your URL. The script you listed is trying to connect to radtech.p4cyn.mongodb.net which doesn't exist, or at least there is no DNS for it.

This is strange. You are right, the host might not have DNS entry but I can somehow connect to it from my local machine (which I cant explain why). Also, let me reiterate that I've had similar script on Tommy connecting to the same mongodb database before and it was working fine. Initially it didn't work but after I requested for port 27017 to be opened, it started working.

I tried to test whether port 27017 is open on Tommy using the script here (source attached), it doesn't seem like the port is open though. When I tried with port 80, 443 and 3306, it did respond saying the ports were open.. would appreciate if you could verify that port 27017 is indeed open for the three IPs requested above?

image.png.e11be366075cd09e50e3231f9bd9d191.png

This is the expected response when the test-port script was run on my machine..

image.png.65d87a7b78156e3aa5efbdc943639cfc.png

Thanks in advance.

test-port.py

Posted

Yes, outbound port 27017 is open, but only to the 3 IPs you listed.

tcp|out|d=27017|d=18.138.205.196       # rarahim
tcp|out|d=27017|d=54.255.46.254        # rarahim
tcp|out|d=27017|d=52.74.75.34          # rarahim

 

Posted

This issue is still unresolved..

I'm still suspecting that the problem is with the port 27017 on Tommy. (Btw, tommy2 is the same as tommy, right? I just noticed that my plesk dashboard host is tommy2.heliohost.org.)

I have created two scripts to test ports 3306 and 27017. The results are also shown here..

=> Test port 3306

image.png.cb22072e631861a6b157b9cc79384a68.png

=> Test port 27017 

image.png.a45834cb7e9b1c5262b7c1c59d3a1d93.png

The script content:

image.png.9ed88ecbe2967c223b9c990d7e586bea.png

When carried out on my local machine, both port tests passed:

image.png.e29303edc68271b47bc461e943183432.png

To me, it does seem like port 27017 is somehow not accessible from Heliohost server despite being reassured that it has been opened..

Puzzled.

 

Posted

Portquiz.net is on IP 35.180.139.74. The IPs you requested outbound port 27017 to be opened for are 18.138.205.196, 54.255.46.254, and 52.74.75.34. Since 35.180.139.74 is not one of the 3 IPs you listed it wasn't opened. Since you're so obsessed with portquiz I went ahead and opened port 27017 to 35.180.139.74 for you as well. You can see the result

root@tommy2 [/home/krydos]# curl portquiz.net:27017
Port test successful!
Your IP: 65.19.141.77

I determined the reason your scripts weren't working 5 days ago.

On 10/14/2022 at 8:12 PM, Krydos said:

Check your URL. The script you listed is trying to connect to radtech.p4cyn.mongodb.net which doesn't exist, or at least there is no DNS for it.

You can't connect to a website that doesn't return an A record. Either connect to it directly by IP address, ie: 18.138.205.196:27017, or come up with a new URL that actually exists.

Posted

It doesn't resolve for me either against any DNS server I've tried, same result as Krydos (it has no A record). You keep insisting that URL works locally, but it doesn't work for me (locally) or on Tommy. so I'm wondering if you defined it in the hosts file or something?

A normal lookup (A) returns no value, and doing an ALL lookup returned a single TXT record:

> set type=all
> radtech.p4cyn.mongodb.net 8.8.8.8
Server:  [8.8.8.8]
Address:  8.8.8.8

Non-authoritative answer:
radtech.p4cyn.mongodb.net       text =

        "authSource=admin&replicaSet=atlas-4rclg7-shard-0"
>

You need to either: Use an IP address directly, use a URL whose DNS zone actually has an A record in it, or contact the database host and ask them to fix their DNS zone.

Posted

Today I tested the same script on a totally different machine running python 3.8.10, dnspython 2.2.1 and pymongo 4.3.2 on an entirely different network.. and it still worked..

image.png.2ed1fdc393cf773afcfff3aa3d22e4cb.png

Script used:

#!/usr/bin/python3
 
import pymongo

DB_URI = "mongodb+srv://testuser:Mongopass123@radtech.p4cyn.mongodb.net/?retryWrites=true&w=majority"

def create_connection(db_file):
  conn = None

  try:
    conn = pymongo.MongoClient(db_file)
    conn = conn["testDB"]

    print("Success!")
  except Exception as ex:
    print("Error connecting to database.", ex)

  return conn

conn = create_connection(DB_URI)

alertsCol = conn["names"]
docs = alertsCol.find()
print("Name = " + docs[0]["name"])

print("Done.")

As you can see, I'm connecting using that same host without DNS A record without issue.. and as stated this same script used to run fine before the whole server migration.. this is so puzzling.. I don't want to switch to MySQL if I don't have to..

Btw, using that host is the right way we are supposed to connect to the mongo db on cloud.mongodb.com, there is no direct connection to an IP.. or at least we are not allowed to.

image.thumb.png.424022d6838d147842d688ca74a64d7d.png

 

 

Posted
On 10/20/2022 at 11:08 PM, wolstech said:

so I'm wondering if you defined it in the hosts file or something?

No..

And I haven't defined any specific IP whitelist... all IPs are allowed:

image.thumb.png.efad0d464e2546f316fa778fa7ebb36a.png

I can try to whitelist tommy server IP and see if it makes any different, which IP should I add ?

 

Posted

Tommy2 is 65.19.141.77

What we don't understand is how this is working for you without an A record present, unless it's doing something weird like only responding for requests in a certain part of the world (Krydos and I are both in the USA, as is Tommy), or perhaps it's using a SRV record instead?

Posted

Just to further add to the mystery.. I tested running the same script on yet another machine on a different network and it also worked..

image.png.1de8e9a96d459dfc57f37f1faf0ab3b9.png

Both machines have the same following configuration:

VERSION="20.04.3 LTS (Focal Fossa)
Python 3.8.10
dnspython==2.2.1
pymongo==4.3.2
 

first machine IP: 115.164.89.99

second machine IP: 210.24.102.234 

 
 
Posted
8 hours ago, wolstech said:

Tommy2 is 65.19.141.77

What we don't understand is how this is working for you without an A record present, unless it's doing something weird like only responding for requests in a certain part of the world (Krydos and I are both in the USA, as is Tommy), or perhaps it's using a SRV record instead?

I wanted to say that this might be the case but then how can we explain the fact that it used to be working fine before? I just saw that the original script file on Tommy was last uploaded on Feb 8, 2022.. 

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...