Cleaning spurious presence subscription requests in Isode XMPP server

This is an old issue, but I would like to document it publically.

Presence subscription requests are regular business in XMPP world. The recipient can accept or deny the request. That is fine. In my case, something fishy was going on, since I had been receiving presence subscription requests that I could not "clean up" from the same addresses for months. There are two posibilities:

  1. The presence request origins keep trying and trying. The usual approach here would be for me to block those users. Good bye.
  2. A bug in the XMPP server. For some reason the presence subscription requests are not being cleared when I "deny" the requests.

After a few tests I was pretty sure I was suffering a bug of the XMPP server: blocking origins didn't work and I got new presence subscription requests -that I "dened"- every time I connected to the XMPP server, even in "rapid fire" mode.

If I am hitting a bug, how to proceed? Next step?

In January 2018 I sent the following email to stpeter, admin of jabber.org XMPP server:

To: Peter Saint-Andre <stpeter@stpeter.im>
From: Jesus Cea <jcea@jcea.es>
Subject: Presence issue in jabber.org
Message-ID: <f583c16a-5a26-b9a8-3f6f-1344c15f112b@jcea.es>
Date: Thu, 25 Jan 2018 01:15:40 +0100

Hi, Peter. Long time without talking. Hope you are doing well.

I write you because you are listed as the main administrator of
jabber.org XMPP server, according to <https://www.jabber.org/team.html>.
If I must talk with anybody else, please let me know.

I am "jcea@jabber.org". I am getting these presence requests I can not
get rid of, after months!.

  <presence from='zoe3zd@skryre.org'
            to='jcea@jabber.org'
            type='subscribe'/>

  <presence from='crystaldbd@nerv.tech'
            to='jcea@jabber.org'
            type='subscribe'/>

Getting notifications four times per presence subscription request in
each connection and every few hours. For months. Doesn't matter I select
"Deny" or "Accept".

What can I do?.

I have even written a small script to connect to XMPP and do
"unsubscribe/unsubscribed". Nothing works!. I have used that script to
block those addresses with XEP-191. It doesn't help either.

Bug in jabber.org?

Can you help me?.

Thanks for your time, Peter. I know you are busy.

Regards from Spain.

After a while and several mail exchanges, I got his reply:

Subject: Re: Presence issue in jabber.org
From: Peter Saint-Andre <stpeter@stpeter.im>
To: Jesus Cea <jcea@jcea.es>
References: <f583c16a-5a26-b9a8-3f6f-1344c15f112b@jcea.es>
 <44f3def5-dbb4-4ad2-0d7f-e3ac2061ae6d@stpeter.im>
 <fce753ca-a72a-e4de-246f-1778ed7bdeeb@jcea.es>
 <318652ca-375b-d5de-98ab-6cc811f17140@stpeter.im>
 <3f5d6f5d-6946-cfbc-84de-a4a276a80f94@jcea.es>
 <3135f3d9-f460-c94d-f678-bfe2e4b3e639@stpeter.im>
Message-ID: <68806e58-23ea-b05f-797c-24a442a89ae8@stpeter.im>
Date: Wed, 6 Jun 2018 19:51:00 -0600
In-Reply-To: <3135f3d9-f460-c94d-f678-bfe2e4b3e639@stpeter.im>

OK, please try this...

First, accept all pending subscription requests (or deny ones that you
don't want, of course). Just make sure you don't have anything pending
or in a "deferred" state.

Then, open an XML console (I used Psi for this) and paste in this XML:

<iq type='set' id='purge-subscribe'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
    <purge node='http://isode.com/subscribe'/>
  </pubsub>
</iq>

When you log in again, you shouldn't see the subscriptions requests again.

I had the same problem and I've verified that this fixes it, so I hope
it works for you, too.

Sorry about taking so long to find an answer. :(

Peter

I tried the suggestion and it worked! I replied stpeter and requested permission to share this conversation online:

Subject: Re: Presence issue in jabber.org
To: Peter Saint-Andre <stpeter@stpeter.im>
References: <f583c16a-5a26-b9a8-3f6f-1344c15f112b@jcea.es>
 <44f3def5-dbb4-4ad2-0d7f-e3ac2061ae6d@stpeter.im>
 <fce753ca-a72a-e4de-246f-1778ed7bdeeb@jcea.es>
 <318652ca-375b-d5de-98ab-6cc811f17140@stpeter.im>
 <3f5d6f5d-6946-cfbc-84de-a4a276a80f94@jcea.es>
 <3135f3d9-f460-c94d-f678-bfe2e4b3e639@stpeter.im>
 <68806e58-23ea-b05f-797c-24a442a89ae8@stpeter.im>
From: Jesus Cea <jcea@jcea.es>
Message-ID: <e2dacd26-6af2-aaf3-2a54-7a5045516ccf@jcea.es>
Date: Thu, 29 Nov 2018 19:27:05 +0100
In-Reply-To: <68806e58-23ea-b05f-797c-24a442a89ae8@stpeter.im>

It worked!!!!.

Can I publish your message in my blog? I think the content deserves to
be public.

Thanks!.

stpeter replied:

Subject: Re: Presence issue in jabber.org
From: Peter Saint-Andre <stpeter@stpeter.im>
In-Reply-To: <e2dacd26-6af2-aaf3-2a54-7a5045516ccf@jcea.es>
Date: Thu, 29 Nov 2018 11:54:14 -0700
Message-Id: <2C973A27-CE7D-420D-9F1C-87AC9F256D81@stpeter.im>
References: <f583c16a-5a26-b9a8-3f6f-1344c15f112b@jcea.es> <44f3def5-dbb4-4ad2-0d7f-e3ac2061ae6d@stpeter.im> <fce753ca-a72a-e4de-246f-1778ed7bdeeb@jcea.es> <318652ca-375b-d5de-98ab-6cc811f17140@stpeter.im> <3f5d6f5d-6946-cfbc-84de-a4a276a80f94@jcea.es> <3135f3d9-f460-c94d-f678-bfe2e4b3e639@stpeter.im> <68806e58-23ea-b05f-797c-24a442a89ae8@stpeter.im> <e2dacd26-6af2-aaf3-2a54-7a5045516ccf@jcea.es>
To: Jesus Cea <jcea@jcea.es>

Sure, of course!

I hope you are doing well.

Peter

Sent from mobile, might be terse

At that is, my friends.

Update 20190420: You can send the XMPP stanzas by hand using almost any XMPP client out there. I coded several Python programs in the process of triaging this issue, so I used the source code listed in Código para limpiar peticiones de suscripción de presencia espurias en el servidor XMPP Isode.