Prosody S2S communication with Zeroconf

423 views
Skip to first unread message

Bartłomiej Korpała

unread,
Jan 5, 2016, 7:41:42 AM1/5/16
to Prosody IM Users
Hello! I have local network without DHCP: 3 computers (2 with Prosody and Avahi). I can't for example ping computer with XMPP server like "ping host.local". I can connect by Psi+ with account on computer with Avahi but when I'm trying to establish subscription between accounts on computers with Avahi I get information that it can't resolve name like "host.local". Information is like "Server-to-server connection failed: DNS resolution failed". In other words how to establish S2S connection between 2 servers using Avahi ("host.local")? Any ideas?

Thijs Alkemade

unread,
Jan 5, 2016, 8:55:38 AM1/5/16
to prosod...@googlegroups.com

> On 5 jan. 2016, at 12:13, Bartłomiej Korpała <bartlomie...@essystem.pl> wrote:
>
> Hello! I have local network without DHCP: 3 computers (2 with Prosody and Avahi). I can't for example ping computer with XMPP server like "ping host.local". I can connect by Psi+ with account on computer with Avahi but when I'm trying to establish subscription between accounts on computers with Avahi I get information that it can't resolve name like "host.local". Information is like "Server-to-server connection failed: DNS resolution failed". In other words how to establish S2S connection between 2 servers using Avahi ("host.local")? Any ideas?

This is somewhat tricky. Prosody's DNS support is mostly custom written (as
there's no good other way to do asynchronous SRV looks in a cross-platform
way). It would be possible to do add support for mDNS, but that would require
either a plugin or modification of Prosody.

If the number of hosts is limited and you can give them a static IP address,
then maybe you can use this module instead:

https://modules.prosody.im/mod_srvinjection.html

Hope this helps,
Thijs
signature.asc

Bartłomiej Korpała

unread,
Jan 7, 2016, 5:44:24 AM1/7/16
to Prosody IM Users, m...@thijsalkema.de
Configuration should look like:
srvinjection = {
       ["*"] = {"host0.local", 5222};
       ["*"] = {"host0.local", 5269};
}; 
or maybe
srvinjection = {
       ["host0.local"] = {"localhost", 5222};
       ["host0.local"] = {"localhost", 5269};
}; 
?
I tried both but it doesn't help. 

Thijs Alkemade

unread,
Jan 7, 2016, 8:43:05 AM1/7/16
to prosod...@googlegroups.com

> On 7 jan. 2016, at 11:44, Bartłomiej Korpała <bartlomie...@essystem.pl> wrote:
>
> Configuration should look like:
> srvinjection = {
> ["*"] = {"host0.local", 5222};
> ["*"] = {"host0.local", 5269};
> };
> or maybe
> srvinjection = {
> ["host0.local"] = {"localhost", 5222};
> ["host0.local"] = {"localhost", 5269};
> };

Both look wrong, you don’t need a record for port 5222, as that’s only for
client to server connections. Correct syntax would be:

srvinjection = {
["host0.local"] = {"localhost", 5269};
};

Hope this helps,
Thijs
signature.asc

Bartłomiej Korpała

unread,
Jan 8, 2016, 3:55:24 AM1/8/16
to Prosody IM Users, m...@thijsalkema.de
It didn't help. :/

Thijs Alkemade

unread,
Jan 8, 2016, 12:55:34 PM1/8/16
to prosod...@googlegroups.com

> On 8 jan. 2016, at 09:55, Bartłomiej Korpała <bartlomie...@essystem.pl> wrote:
>
> It didn't help. :/
>

Please post debug logs from a connection attempt.
> --
> You received this message because you are subscribed to the Google Groups "Prosody IM Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prosody-user...@googlegroups.com.
> To post to this group, send email to prosod...@googlegroups.com.
> Visit this group at https://groups.google.com/group/prosody-users.
> For more options, visit https://groups.google.com/d/optout.

signature.asc

Bartłomiej Korpała

unread,
Jan 11, 2016, 2:44:03 AM1/11/16
to Prosody IM Users, m...@thijsalkema.de
This is from XML console:
<presence type="subscribed" to="bkor...@vertex1.local"/>



<presence from="bkor...@vertex1.local" type="error" to="bkor...@bprxubuntu1.local">
<error type="cancel">
<remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Server-to-server connection failed: DNS resolution failed</text>
</error>
</presence>



<presence from="bkor...@vertex1.local" type="error" to="bkor...@bprxubuntu1.local/Psi+">
<error type="cancel">
<remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Server-to-server connection failed: DNS resolution failed</text>
</error>
</presence>
This is from "prosody.log":
Jan 11 08:37:33 c2s888cbb8 info Client connected
Jan 11 08:37:33 c2s888cbb8 info Authenticated as bkor...@bprxubuntu1.local
Jan 11 08:38:03 s2sout8884e48 info Out of connection options, can't connect to vertex1.local
Jan 11 08:38:03 s2sout8884e48 info sending error replies for 1 queued stanzas because of failed outgoing connection to vertex1.local
Jan 11 08:39:34 s2sout87f32d8 info Out of connection options, can't connect to vertex1.local
Jan 11 08:39:34 s2sout87f32d8 info sending error replies for 2 queued stanzas because of failed outgoing connection to vertex1.local

Thijs Alkemade

unread,
Jan 11, 2016, 5:20:12 AM1/11/16
to prosod...@googlegroups.com
>
> On 11 jan. 2016, at 08:44, Bartłomiej Korpała <bartlomie...@essystem.pl> wrote:
>
> This is from XML console:
> <presence type="subscribed" to="bkor...@vertex1.local"/>
>
>
>
> <presence from="bkor...@vertex1.local" type="error" to="bkor...@bprxubuntu1.local">
> <error type="cancel">
> <remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
> <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Server-to-server connection failed: DNS resolution failed</text>
> </error>
> </presence>
>
>
>
> <presence from="bkor...@vertex1.local" type="error" to="bkor...@bprxubuntu1.local/Psi+">
> <error type="cancel">
> <remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
> <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Server-to-server connection failed: DNS resolution failed</text>
> </error>
> </presence>
> This is from "prosody.log":
> Jan 11 08:37:33 c2s888cbb8 info Client connected
> Jan 11 08:37:33 c2s888cbb8 info Authenticated as bkor...@bprxubuntu1.local
> Jan 11 08:38:03 s2sout8884e48 info Out of connection options, can't connect to vertex1.local
> Jan 11 08:38:03 s2sout8884e48 info sending error replies for 1 queued stanzas because of failed outgoing connection to vertex1.local
> Jan 11 08:39:34 s2sout87f32d8 info Out of connection options, can't connect to vertex1.local
> Jan 11 08:39:34 s2sout87f32d8 info sending error replies for 2 queued stanzas because of failed outgoing connection to vertex1.local

Please set the log level to “debug” first and then try again.

Regards,
Thijs

signature.asc

Bartłomiej Korpała

unread,
Jan 11, 2016, 6:28:50 AM1/11/16
to Prosody IM Users, m...@thijsalkema.de
Jan 11 12:22:39 c2s9430b38 debug Received[c2s]: <presence to='bkor...@vertex1.local' type='subscribed'>
Jan 11 12:22:39 bprxubuntu1.local:presence debug outbound presence subscribed from bkor...@bprxubuntu1.local for bkor...@vertex1.local
Jan 11 12:22:39 rostermanager debug load_roster: asked for: bkor...@bprxubuntu1.local
Jan 11 12:22:39 stanzarouter debug Routing to remote...
Jan 11 12:22:39 mod_s2s debug opening a new outgoing connection for this stanza
Jan 11 12:22:39 mod_s2s debug stanza [presence] queued until connection complete
Jan 11 12:22:39 mod_s2s debug First attempt to connect to vertex1.local, starting with SRV lookup...
Jan 11 12:22:39 adns debug Records for _xmpp-server._tcp.vertex1.local. not in cache, sending query (thread: 0x9369690)...
Jan 11 12:22:39 adns debug Sending DNS query to 127.0.0.1
Jan 11 12:22:39 stanzarouter debug Routing to remote...
Jan 11 12:22:39 s2sout9419710 debug trying to send over unauthed s2sout to vertex1.local
Jan 11 12:22:39 s2sout9419710 debug stanza [presence] queued 
Jan 11 12:22:39 bprxubuntu1.local:presence debug broadcasted presence of 1 resources from bkor...@bprxubuntu1.local to bkor...@vertex1.local
Jan 11 12:22:39 socket debug server.lua: client dns:clientport read error: connection refused
Jan 11 12:22:39 adns warn DNS socket for 127.0.0.1 disconnected: connection refused
Jan 11 12:22:39 adns error Exhausted all 1 configured DNS servers, next lookup will try 127.0.0.1 again
Jan 11 12:22:39 socket debug server.lua: closed client handler and removed socket from list
Jan 11 12:22:54 adns debug Reply for _xmpp-server._tcp.vertex1.local. (thread: 0x9369690)
Jan 11 12:22:54 mod_s2s debug vertex1.local has no SRV records, falling back to A/AAAA
Jan 11 12:22:54 adns debug Records for vertex1.local not in cache, sending query (thread: 0x9453940)...
Jan 11 12:22:54 adns debug Sending DNS query to 127.0.0.1
Jan 11 12:22:54 adns debug Records for vertex1.local not in cache, sending query (thread: 0x943c820)...
Jan 11 12:22:54 adns debug Sending DNS query to 127.0.0.1
Jan 11 12:23:09 adns debug Reply for vertex1.local (thread: 0x9453940)
Jan 11 12:23:09 adns debug Reply for vertex1.local (thread: 0x943c820)
Jan 11 12:23:09 mod_s2s debug DNS lookup failed to get a response for vertex1.local
Jan 11 12:23:09 s2sout9419710 info Out of connection options, can't connect to vertex1.local
Jan 11 12:23:09 mod_s2s debug No other records to try for vertex1.local - destroying
Jan 11 12:23:09 s2sout9419710 debug Destroying outgoing session bprxubuntu1.local->vertex1.local: DNS resolution failed
Jan 11 12:23:09 s2sout9419710 info sending error replies for 2 queued stanzas because of failed outgoing connection to vertex1.local
Jan 11 12:23:09 stanzarouter debug Received[s2sin]: <presence type='error' to='bkor...@bprxubuntu1.local' from='bkor...@vertex1.local'>
Jan 11 12:23:09 stanzarouter debug Received[s2sin]: <presence type='error' to='bkor...@bprxubuntu1.local/Psi+' from='bkor...@vertex1.local'>

I installed also dnsmasq and added line "srv-host=_xmpp-server._tcp.localhost,vertex1.local,5269" but was only difference that faster I did receive the response.

Bartłomiej Korpała

unread,
Jan 12, 2016, 9:16:02 AM1/12/16
to Prosody IM Users
Right now I have dnsmasq on two hosts with following records:
srv-host=_xmpp-server._tcp.host1.local,localhost,5269
srv
-host=_xmpp-server._tcp.host2.local,host2.local,5269
and
srv-host=_xmpp-server._tcp.host2.local,localhost,5269
srv
-host=_xmpp-server._tcp.host1.local,host1.local,5269
When I ask for subscription I get:
Jan 12 15:09:44 c2s9aea8a0 debug Received[c2s]: <presence to='bkor...@vertex1.local' type='subscribed'>
Jan 12 15:09:44 bprxubuntu1.local:presence debug outbound presence subscribed from bkorpala@bprxubuntu1.local for bkorpala@vertex1.local
Jan 12 15:09:44 rostermanager debug load_roster: asked for: bkorpala@bprxubuntu1.local
Jan 12 15:09:44 stanzarouter debug Routing to remote...
Jan 12 15:09:44 mod_s2s debug opening a new outgoing connection for this stanza
Jan 12 15:09:44 mod_s2s debug stanza [presence] queued until connection complete
Jan 12 15:09:44 mod_s2s debug First attempt to connect to vertex1.local, starting with SRV lookup...
Jan 12 15:09:44 adns debug Records for _xmpp-server._tcp.vertex1.local. not in cache, sending query (thread: 0x9bf9758)...
Jan 12 15:09:44 adns debug Sending DNS query to 127.0.0.1
Jan 12 15:09:44 stanzarouter debug Routing to remote...
Jan 12 15:09:44 s2sout9bf8cd8 debug trying to send over unauthed s2sout to vertex1.local
Jan 12 15:09:44 s2sout9bf8cd8 debug stanza [presence] queued
Jan 12 15:09:44 bprxubuntu1.local:presence debug broadcasted presence of 1 resources from bkorpala@bprxubuntu1.local to bkorpala@vertex1.local
Jan 12 15:09:44 socket debug server.lua: closed client handler and removed socket from list
Jan 12 15:09:44 adns debug Reply for _xmpp-server._tcp.vertex1.local. (thread: 0x9bf9758)
Jan 12 15:09:44 mod_s2s debug vertex1.local has SRV records, handling...
Jan 12 15:09:44 mod_s2s debug Best record found, will connect to vertex1.local.:5269
Jan 12 15:09:44 adns debug Records for vertex1.local. not in cache, sending query (thread: 0x9bfd088)...
Jan 12 15:09:44 adns debug Sending DNS query to 127.0.0.1
Jan 12 15:09:44 adns debug Records for vertex1.local. not in cache, sending query (thread: 0x9bff2d0)...
Jan 12 15:09:44 adns debug Sending DNS query to 127.0.0.1
Jan 12 15:09:44 adns debug Reply for vertex1.local. (thread: 0x9bfd088)
Jan 12 15:09:44 socket debug server.lua: closed client handler and removed socket from list
Jan 12 15:09:44 adns debug Reply for vertex1.local. (thread: 0x9bff2d0)
Jan 12 15:09:44 mod_s2s debug DNS lookup failed to get a response for vertex1.local.
Jan 12 15:09:44 s2sout9bf8cd8 info Out of connection options, can't connect to vertex1.local
Jan 12 15:09:44 mod_s2s debug No other records to try for vertex1.local - destroying
Jan 12 15:09:44 s2sout9bf8cd8 debug Destroying outgoing session bprxubuntu1.local->vertex1.local: DNS resolution failed
Jan 12 15:09:44 s2sout9bf8cd8 info sending error replies for 2 queued stanzas because of failed outgoing connection to vertex1.local
Jan 12 15:09:44 stanzarouter debug Received[s2sin]: <presence type='
error' to='bkorpala@bprxubuntu1.local' from='bkorpala@vertex1.local'>
Jan 12 15:09:44 stanzarouter debug Received[s2sin]: <presence type='
error' to='bkorpala@bprxubuntu1.local/Psi+' from='bkorpala@vertex1.local'>
and there is no error about no SRV record.

Bartłomiej Korpała

unread,
Jan 14, 2016, 2:18:14 AM1/14/16
to Prosody IM Users
I've found a solution: I had to add to "/etc/dnsmasq.conf" line like "srv-host=_xmpp-server._tcp.remote_host.local,IP_address,5269".
Reply all
Reply to author
Forward
0 new messages