Pyro call over WAN - pyro

I have a Pyro4 application that needs to be accessed by users globally. Users from within the US can access it fine. However, a user from a London PC seems to have issues connecting to the server. He can ping the nameserver correctly, but gets a Pyro CommunicationError ([Errno 11004] getaddrinfo failed) when executing an actual call on the proxy.
Has anyone seen this problem?

The problem was that when I created the daemon and registered it with the nameserver, I didn't use the fully qualified hostname (aka socket.getfqdn()). As a result it could find the remote object over the local network but not across the WAN.

Related

GCP Can't Connect to MongoDB

This is my first attempt at deploying a Node.js application on a Google VM instance while connecting to MongoDB.
In MongoDB, I have whitelisted my IP address and the VM instance's IP address. When I start my server using Google Cloud Shell, I receive the following error:
op.cb(new error_1.MongoNetworkError(`connection ${this.id} to ${this.address} closed`));
^
MongoNetworkError: connection 1 to 34.71.95.215:27017 closed
I'm connecting on port 8080. The external IP is listed on my GCP instance page and when I ping it, it is up. IP: 34.68.254.120
When I whitelist 0.0.0.0/0 in Mongodb, the code runs successfully, and I can preview my app through GCP.
I created a new instance from scratch, and it also crashes with the same error.
ETA: In looking at the source code around the error message at:
...\node_modules\mongoose\node_modules\mongodb\lib\cmap\connection.js
it looks like a closed connection. The error message above spits out the IP address as the Iowa Google Data Center where my VM is housed.
I don't know what this means, but if you do, please let me know.
ETA2: I have 2 problems, and they may be connected. The first is that my VM server cannot connect to MongoDB. This should be simple -- whitelist the external IP address of my VM server. It does not work (I have to open MongoDB to 0.0.0.0/0 for it to connect).
The second is that I cannot connect to my server via the external IP address, regardless of whether MongoDB is connected or not. It "refuses to connect." I can do a web preview of my running server, though.
It seems the two may be connected somehow. I've rebooted my VM, but it did not fix anything. I whitelisted the error message IP address in MongoDB, but it did not help.
ETA3: Okay, it appears I have solved the whitelist to MongoDB issues. Through Cloud Shell, I asked my VM what the IP is. It is different than the one GCP tells me is the external IP. By adding this IP to the whitelist, I can connect between GCP VM and MongoDB. Whew. No idea why.
The VM's external IP address through my browser still gives me a cannot connect message, and when I use the new VM IP address I found through Cloud Shell, it gives me a "took too long to respond" message.
So I feel I have made progress. The remaining problem is accessing my server through Chrome.
Any suggestions on how I can investigate the issue further? I'm at a dead end. I believe the problem is likely simple given my inexperience.
Thanks!
Problem solved by a friend, for anyone in the future with this issue.
I had set up my GCP VM using Cloud Shell. I had housed my code by coping my repository through Cloud Shell. It turns out, this is more of a virtual interface with my VM, and the files are not physically on my VM. I needed to go through SSH, clone my repository there, and run my server through SSH. Cloud Shell was causing the problem.

How to find all the available MIDI ports over network using CoreMIDI?

I am working on an app which needs to send Midi over wifi. I looked at CoreMIDI and the MIDINetworkSession class. I have set the default session's policy to .anyone and also enabled it. But I am not clear what to do next. I looked at PGMidi but it didn't list out the remote host's MIDI ports after making changes to the session.
What I want is a list of all the MIDI ports that I can connect to on the remote machine running MacOSX.
Is it even possible? Can someone please give me some hints?
I was able to figure it out. Here is what I did:
Scanning the remote service
Suppose my mac is running a MIDI session which is advertised over Bonjour. I used NetServiceBrowser to scan the local network and find out which server supports "_apple-midi._udp" service. Look at the documentation.. NetServiceBrowserDelegate receives a service in the delegate callbacks. Please note that the service object is not yet resolved against the DNS and therefore doesn't contain IP address of the host.
The next step is to resolve the service by using a NetServiceDelegate. The service object passed in the success delegate callback contains everything that is there to know about that service. So now, you have a list of IP addresses/hostnames and corresponding port numbers.
Sending MIDI
Create a MIDINetworkConnection instance using the ip address/hostname and the port number. It looks like a synchronous call, so may be it doesn't contact the server itself. Next, get all the midi devices and iterate over Entities and Destinations. Its given in this document

Is it possible to see connection attempts to a Google Cloud SQL instance?

We are currently encountering the following error when trying to connect to a Cloud SQL instance: Lost connection to MySQL server at 'reading initial communication packet', system error: 0.
This is a familiar error, and as detailed here usually means the IP address needs to be whitelisted. However, we believe we have done so.
Is there a way to see connection attempts and their IP addresses that have been made (and refused) to the Cloud SQL instance?
Currently we don't expose that information but it is something we would like fix. :-)
According to #Razvan, as of September 2014, this information isn't exposed.
We ended up using CIDR blocks to search the space and find the actual IP address. This is unsatisfying, obviously, but it's a way to pin down the problem.
If other people want to sanity check that the problem is their IP is being refused, you can add 0.0.0.0/0 in order to accept all ranges and try to connect. If it works, you know what is the problem.
Be absolutely sure to remove this as an accepted range, after you are done, however!
Figured I might help someone who stumbles here.
Had exactly the same issue essentially trying to connect to a GCP SQL instance from a hosting provider.
Whitelist the IP address that is shown in my cpanel and it will not connect. (It used to, but the provider made some changes with their infrastructure lately and it stopped working)
put 0.0.0.0/0 in my Cloud Platform whitelist and it connects no problem.
So now I know that my cpanel IP is not the IP trying to connect to GCP.
After some hair pulling (figured that the bare metal server had a different IP than my cpanel IP, it did, but this also didn't work.)
finally tried the IP address for the name servers that point to my domain and bam. All is good.
If you are facing this issue, try your name server (usually something like NS1.hostingprovider.com etc..). I put both the NS1 and NS2 ip's in the whitelist and we are working fine.

apache camel - deploying with cxfs web service

I'm trying to deploy my camel app which on start is creating a cxfrs endpoint. The url is like this: http://localhost:9876 . When I try to hit this one on a rest client or anywhere within my machine it works. But when I try to access it using my phone or other external devices, I'm not able to connect.
Am I missing something?
TIA
Using localhost will mean it is only accessible to your local machine, using 0.0.0.0 instead should make it publicly accessible.
0.0.0.0 should bind all available network interface on your remote machine, but from your description, somehow it only bind to localhost|127.0.0.1 so only accessible from local machine, could you use
http://external.ip.address:9876/foo/FooService
instead to see if it helps?
Also, you can try to access other network service(for example start a tomcat on remote machine and see if you can access it from your local machine) from that remote machine to see if it works, this can determine if your DNS correct or if there's really no firewall between them.

Using any/fake domains with ejabberd

I've recently purchased a cloud server which has public IP and I am using it to host an xmpp server.
My first task was to ensure my users connected using my subdomain - as an example m.chat.com.
In my configuration I have the following:
%% Hostname
{hosts, ["m.chat.com"]}.
I then created an admin user with that domain.
In parrellel I have created the following DNS record with my host provider, hostgator for my subdomain m.chat.com
Name TTL Class Type Record
m.chat.com 14400 IN A [IP of the server]
One thing that puzzled me was my ability to access the ejabberd web admin console. This was achieved via: [IP of the server]:5280/admin however I could not access it via m.chat.com:5280/admin
That aside, inside the web console, under "Virtual Hosts" I could see the host "m.chat.com". I created a user "user#m.chat.com" and tried to connect via Adium.
Inside Adium, simply typing in user#m.chat.com with the password did not work. Instead I had to also specify the "Connect server" which in this case was the [IP of the server].
It has connected fine and I have registered other users to check everything is working and it is.
Then I thought I'd go back to the ejabberd configuration and start messing around. I changed the hostname to the following:
%% Hostname
{hosts, ["m.chat.com", "facebook.com"]}.
I registered a user with that domain and restarted ejabberd. Upon checking the web console, to my surprise, I could see the Virtual host "facebook.com". I tested this user in Adium with the [IP of the server] defined in the "Connect server" section and it connected fine. I asked other people with their own internet connections to use this account on their PCs and they were able to connect too.
Story over - my question to everyone is how is this possible? Am I missing something? Is there no domain authentication. After searching online, it seems you can even use fake domains.
If I am to operate my own service in the future (iOS chat app) I do not want anyone using my domain names with their own public servers.
Can someone shine some light.
Thanks!
Edit: A second question - Preferably I do not want to have to define the "Connect Server" upon using a client. I would like the client to recognise the #m.chat.com domain and establish a connection to the Servers IP automatically. Have I configured my DNS record correctly? For anyone else using Hostgator, is there an additional task I must do?
Edit: I can now access the web console via m.chat.com:5280/admin and I no longer have to specify the Connect server when using a client. I didnt do anything, I think it was a case of Hostgater updating the DNS or something, they say it usually takes 4 hours. However I am still slightly puzzled as to why I can create accounts with the facebook.com domain. I understand that because I can not access the DNS admin for this domain I can not create any records but that does not prevent me from using the domain and just specifying a Connect server.
Your initial problems (unable to access the server by using m.chat.com) were almost certainly DNS issues, and it seems you have isolated that down to the time taken to update the record.
Your second question - about the fact that you can name virtual hosts without restriction, is simple but interesting. What makes you think there should be any kind of restriction? It would be like you dictating that I can't save "m.chat.com" in a file on my disk, or that I can't send "m.chat.com" in a message across the internet.
This is why DNS exists and is structured the way it is. Although I can tell my server that it hosts facebook.com, nobody will connect to it because the DNS record for facebook.com does not point at my server (users generally don't set the "connect host" manually). Which begs the question... why would I want to tell my server it hosts facebook.com, and if I did, why should Facebook care?
An additional, but relevant, identity layer on top of DNS are certificates - which clients should validate for the virtual host name in spite of any "connect host" set. Since it's not possible to have a certificate for facebook.com, clients should generally pop up warnings or fail to connect at all. If they don't, they're probably not validating the certificate correctly.