Hi. Are there any articles or other places where I can see example(s) of s2s streams? I'm trying to build a minimal XMPP server to understand the protocol, but so far the behavior I'm seeing in the real world from different servers doesn't always align with the specs.
jonas’
report any divergence from the specifications to the relevant software projects to get them fixed :)
kikuchiyohas joined
Laurahas left
Zash
https://xmpp.org/rfcs/rfc6120.html#examples-s2s
grishka@5222.de
Take starttls for example:
- jabber.ru doesn't *require* TLS, but messages I send don't get through to my client either
- 5222.de (the one I'm writing this from) does go through starttls fine, but then sends me a dialback request that has my server domain in "from", on my outbound connection, wtf?
- matrix.org requires TLS, but after TLS negotiation is done, closes the stream saying "Your server's certificate is invalid, expired, or not trusted by matrix.org" — what does this mean even? I don't receive an inbound connection from it. Am I supposed to provide a client certificate? Am I supposed to use my TLS server certificate for that?
Laurahas joined
jonas’
you seem to be mostly confused about the abomination which is dialback
Zash
Yeah, dialback causes instant confusion. All the terms are backwards.
pasdesushihas left
grishka@5222.de
hm, okay, so does this actually mean that 5222.de wants me to verify its dialback key?
Zash
grishka@5222.de, in summary, your servers cert is probably wrong
Zash
Dialback is generally only used today when the cert is wrong somehow, e.g. expired or so
grishka@5222.de
and for my toy server it would be fine to swap to and from around and add result="valid" and send that back?
Zash
That's also what the message from matrix.org points at
grishka@5222.de
yeah well how *does* the other server get my server certificate?
jonas’
grishka@5222.de, you need to send it as client certificate
grishka@5222.de
the kind of TLS I'm used to only involves a single certificate, the one the server sends to the client
jonas’
ah
grishka@5222.de
ah okay
jonas’
xmpp s2s may use mutual TLS, so you'll have to send the cert along
jonas’
and then you may have to do SASL EXTERNAL to lock that in as authentication method
msavoritiashas left
grishka@5222.de
thanks, I'll try that (I'll have to go through the misery of dealing with Java's cryptography APIs either way, this just means I'll have to do it sooner than planned, lol)
Zash
https://xmpp.org/extensions/xep-0178.html#s2s might be handy
Zash
https://xmpp.org/extensions/xep-0288.html makes things even nicer and faster
msavoritiashas joined
Laurahas left
pasdesushihas joined
antranigvhas left
dezanthas left
Laurahas joined
adxhas joined
Martinhas left
dezanthas joined
Martinhas joined
msavoritiashas left
paulhas left
msavoritiashas joined
adxhas left
norayrhas left
Wojtekhas left
norayrhas joined
PapaTutuWawahas joined
Laurahas left
antranigvhas joined
Wojtekhas joined
Laurahas joined
antranigvhas left
nikhas left
dezanthas left
larmahas left
Mx2has left
Laurahas left
pasdesushihas left
Laurahas joined
rom1dephas left
pasdesushihas joined
Laurahas left
Laurahas joined
Mx2has joined
adxhas joined
Laurahas left
dezanthas joined
nikhas joined
xnamedhas left
kikuchiyohas left
PapaTutuWawahas left
PapaTutuWawahas joined
nikhas left
nikhas joined
Laurahas joined
msavoritiashas left
Laurahas left
rom1dephas joined
Laurahas joined
jubalhhas left
Mx2has left
Laurahas left
Laurahas joined
xnamedhas joined
dezanthas left
Laurahas left
dezanthas joined
marmistrzhas left
marmistrzhas joined
Laurahas joined
Mx2has joined
marmistrzhas left
marmistrzhas joined
Laurahas left
pulkomandyhas joined
antranigvhas joined
Laurahas joined
raghavgururajanhas joined
Laurahas left
Laurahas joined
pasdesushihas left
edhelashas left
pasdesushihas joined
antranigvhas left
PapaTutuWawahas left
antranigvhas joined
xnamedhas left
Wojtekhas left
Laurahas left
grishka@5222.de
After setting up a client certificate + private key (and cursing at Java cryptography APIs) I'm now getting a different error:
<unsupported-feature xmlns="urn:ietf:params:xml:ns:xmpp-streams"/><text xmlns="urn:ietf:params:xml:ns:xmpp-streams">No viable authentication method offered</text>
So the client certificate replaces dialback, right?
xnamedhas joined
Zash
Huh
grishka@5222.de
or probably I'm not doing the stream restart correctly, it's as if the receiving side doesn't expect me to send <stream:features> after restart
grishka@5222.de
gotta read the RFC again
Marandahas left
Mjolnir Archonhas left
Zash
Unless you found a server other than Prosody producing that <text> message, it likely means _you_ did not offer TLS or SASL
Zash
Prosody says that for outgoing connections
Laurahas joined
Zash
Prosody → you. You're supposed to offer TLS or SASL
Zash
So, not about client certificates anymore
antranigvhas left
grishka@5222.de
I did offer TLS, I did negotiate TLS, and then I received that error over the encrypted connection after only offering dialback 🤔
grishka@5222.de
I'll try sending empty <stream:features/>
Zash
If the connection is secured it's expecting to be offered SASL probably
Zash
It's saying that if it gets a `<stream:features/>` without anything it knows how to handle, and the connection is not completed
Zash
I.e. it didn't do starttls, nor sasl, nor dialback
Zash
Due to the modular architecture, it has no idea why
grishka@5222.de
still
I receive: <stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>EXTERNAL</mechanism></mechanisms><dialback xmlns="urn:xmpp:features:dialback"/></stream:features>
I send: <stream:features><dialback xmlns="urn:xmpp:features:dialback"/></stream:features>
then I receive the aforementioned error
grishka@5222.de
dialback _is_ a matching feature, so why is it not happy with that?
xnamedhas left
Laurahas left
FireFlyhas left
Zash
Dialback is not advertised in `<stream:features>` for historical reasons
Zash
So if no SASL is offered, it's probably assumed to be there and attempted. Unless the module is not loaded, or some reason.
moparisthebest
grishka@5222.de, honestly if you implement TLS client auth (SASL EXTERNAL) you won't need to implement dialback today in 2022, but you need a trusted certificate from a CA
nikhas left
grishka@5222.de
I tried not sending <stream:features> and sending <db:request> instead, now it feels like I'm getting further — I'm receiving an incoming connection from 5222.de that gets stuck at starttls because I don't implement the receiving end of that yet, so that's the next thing to be taken care of I guess
grishka@5222.de
moparisthebest, it is a trusted certificate from a CA, it's a let's encrypt one I pulled out of my server
moparisthebest
and you are sending it as your client cert on outgoing connections ?
grishka@5222.de
yes
moparisthebest
then dialback shouldn't even come up
Kev
And you're constructing the chain correctly?
edhelashas joined
FireFlyhas joined
Zash
Also, you may be interested in https://badxmpp.eu/
msavoritiashas joined
moparisthebest
I guess what I'm saying is you should chase the bug in your TLS cert auth and forget about dialback, seeing a dialback attempt is just telling you your cert auth failed
Zash
Hm, wait
Zash
> I receive: <stream:features>
> I send: <stream:features>
on the same connection?
Zash
The party answering the connection sends stream features, not both
Zash
This all of course gets confusing when there are two connections involved
Zash
So it's a good idea to clarify which connections are involved