st3fan/dovecot-xaps-plugin

Dovecot not advertising new messages to socket

Closed this issue · 20 comments

I'm running Dovecot 2.2.18 on Debian 7. I installed both the plugin and the daemon with success.
Dovecot is adding the XAPPLEPUSHSERVICE capability to IMAP and my iOS device is recognising it. Also does the list in ~/xaps.json get filled with devicesId's.

However, when a new email gets sent to Dovecot, it does not call the method to actually send a command over the socket. I enabled loggin on my daemon, and it does not receive a single thing.

My last logs from the daemon:

2015/07/28 18:10:48 [DEBUG] Opening database at /root/xapsd.json
2015/07/28 18:10:48 [DEBUG] Listening on UNIX socket at /var/run/dovecot/xapsd.sock
2015/07/28 18:10:48 [DEBUG] Parsing /root/certificate.pem to obtain APNS Topic
2015/07/28 18:10:48 [DEBUG] Topic is com.apple.mail.XServer.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
2015/07/28 18:10:48 [DEBUG] Creating APNS client to gateway.push.apple.com:2195
2015/07/28 18:10:48 Starting xapsd 1.0b1 on /var/run/dovecot/xapsd.sock

Dovecot plugin config:

protocol imap {
  mail_plugins = $mail_plugins imap_xaps
}

protocol lda {
  mail_plugins = $mail_plugins xaps
}

protocol lmtp {
  mail_plugins = $mail_plugins xaps
}

plugin {
        # Defaults to /var/run/dovecot/xapsd.sock
  xaps_socket = /var/run/dovecot/xapsd.sock
}

The command I'm running:

/usr/local/dovecot-xaps-daemon/bin/xapsd -key=/root/key.pem -certificate=/root/certificate.pem -database=/root/xapsd.json -socket=/var/run/dovecot/xapsd.sock -debug=true

Any thoughts why this might be causing this?

I'm having this exact issue. Did openssl s_client -connect gateway.push.apple.com:2195 -cert certificate.pem -key key.pem work for you?

@Y-ME369 No, but havent noticed that before. Tested the keys on my laptop and they worked there. When I run the command on my server, I get a timeout.

I can't connect unless I pass it the CAfile from Entrust. Perhaps it is just coincidence though.

@Y-ME369 I just figured out it was my firewall that gave the timeout. Opened up the outgoing port, and then it did connect. But same as you, had a missing root certificate. Downloaded it and tested it with openssl: works.

I now appended the -CAfile ~/entrust_2048_ca.cer to the daemon. Checking if it works now...

@georgeboot It seems the daemon does not allow the passing of a CA file.
The debug output from the daemon seems to recognise when I add folders to my push list on my iDevice, but like you, it does not seem to advertise new messages.

@Y-ME369 Hmm oke. It indeed still doesn't advertise new messages. Adding folders to the push list does also work with me (just checked the xapsd.json and it updates.

@georgeboot Perhaps there is something amiss on the plugin side.

@georgeboot Do you get anything in your mail.log? I have only ever got a message when it could not find the socket (before I set up the daemon).

@Y-ME369 Jup, exactly the same here. I then fixed the path of the daemon and after that the error never shown before.

I just installed the required root cert to my server so that openssl works without manually applying the CA cert. The connection does work now, but still no success with pushing.

@georgeboot Where did you install the cert to? I copied it to /etc/ssl/certs/ along with my others but still need to use the CAfile flag.
I'm starting the think the plugin config file is not pointing to the correct directory of the imap-xaps plugin.

@Y-ME369 Make sure the cert gets stored as /usr/share/ca-certificates/extra/entrust_2048_ca.crt (note the crt instead of cer)
Then run dpkg-reconfigure ca-certificates and select extra/entrust_2048_ca. That should do the trick.

@georgeboot Seems that did not work for me, I still get error 20 despite the certificate being added (it's the right one, as I can explicitly reference it).

Any ideas @st3fan ?

Hi @georgeboot found the problem, at least for my set up.
Dovecot LDA was not enabled. I use postfix as my SMTP server, so added
mailbox_command = /usr/lib/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"
to my main.cf .

Instructions for other backends are here http://wiki2.dovecot.org/LDA

@Y-ME369 Awesome, thanks for the info. Will try if that also solves the issue on my side. Will let you know.

@georgeboot Hi George, did you get it fixed?

@Y-ME369 No unfortunately not. My setup uses Exim instead of postfix. And to be hones I don't have a clue how Exim works, I got it pre-configured on a DirectAdmin box.

Maybe you or someone else can help me out?

I'm sorry, I set up postfix/dovecot from a clean Debian install. I've never used Exim.

I'n in the same boat as @georgeboot I use Virtualmin and when it sets up the server, it configures procmail to do the delivery and dovecot simply does the IMAP transport. I'm wondering if the issue with it not working is because dovecot-lda is not moving the mail so it doesn't know to notify. I too get no notify. You can see my notes on a separate report. I asked @st3fan for help over Twitter and am hoping he may have some insight. I don't know how to approach this to fix it. When I tried putting in the

mailbox_command = /usr/libexec/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"

mail stopped being delivered.

Any conclusive answer on this?

This may be relevant on this thread to. See #10