geniltodallo / prosody-mod_cluster

Module cluster for Prosody IM
2 stars 0 forks source link

Node validation seems broken when cluster_servers are defined by name #2

Open m-kozlowski opened 11 hours ago

m-kozlowski commented 11 hours ago

node 1:

cluster_interfaces = { "frytka" };
cluster_node_name = "xmpp1.empeka.pl";
cluster_servers = { "xmpp2.empeka.pl:7473"};
cluster_server_port = 7473;
cluster_port = 7473;

node 2:

cluster_interfaces = { "burger" };
cluster_node_name = "xmpp2.empeka.pl";
cluster_servers = { "xmpp1.empeka.pl:7473"};
cluster_server_port = 7473;
cluster_port = 7473;

However client sends stanza using ip: <stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='prosody:cluster' to='145.239.95.225'> which server rejects: <stream:stream xmlns:stream='http://etherx.jabber.org/streams' id='' version='1.0' xmlns='prosody:cluster'><stream:error><host-unknown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xmlns='urn:ietf:params:xml:ns:xmpp-streams'>unknown node name 145.239.95.225</text></stream:error></stream:stream>

geniltodallo commented 11 hours ago

In cluster_interfaces I use the local IP address wich cluster module will open the port. Ex: interfaces = { "179.x.x.x", "10.8.0.10", "127.0.0.1" }; Your domain xmpp2.empeka.pl and xmpp1.empeka.pl must resolve to IP address. You can add in /etc/hosts

m-kozlowski commented 11 hours ago

both domains are resolvable

root@frytka:~# getent hosts xmpp1.empeka.pl xmpp2.empeka.pl
145.239.95.225  frytka.empeka.pl xmpp1.empeka.pl
141.95.55.229   burger.empeka.pl xmpp2.empeka.pl

specifying interfaces with ip instead of name didn't help.

I have a poor grasp in lua, but I think that this https://github.com/geniltodallo/prosody-mod_cluster/blob/23cf690e300aeb32fc2c7f671c1f5b3a6f274fc3/mod_cluster_client.lua#L233 will always put IP in stream stanza and this https://github.com/geniltodallo/prosody-mod_cluster/blob/23cf690e300aeb32fc2c7f671c1f5b3a6f274fc3/mod_cluster_server.lua#L88 always compares this IP to module:get_option("cluster_node_name", nil);

geniltodallo commented 8 hours ago

Try with only one domain resolving to IP