tmolitor-stud-tu / mod_push_appserver

Simple and extendable appserver for XMPP pushes (aka. XEP-0357)
MIT License
25 stars 9 forks source link

Could not tls-wrap APNS socket #25

Closed rong-00gle closed 4 years ago

rong-00gle commented 4 years ago

prosody conf file

Component "upload.jitsi.xxxxxxx.org" "push_appserver_apns"
    --component_secret = "123456"
    modules_enabled={
        --"bush";
        "pubsub";
        "push_appserver";
        "push_appserver_apns";
    }
    push_appserver_debugging = true
    push_appserver_apns_sandbox = true
    push_appserver_apns_cert = "/etc/prosody/certs/voip/voip.crt"
    push_appserver_apns_key = "/etc/prosody/certs/voip/voip.key"
    push_appserver_apns_capath = "/etc/ssl/certs"
    -- push_appserver_apns_push_priority = "high"
    ssl = {
        key = "/etc/prosody/certs/jitsi.xxxxxxx.org.key";
        certificate = "/etc/prosody/certs/jitsi.xxxxxxx.org.crt";
    }

error logs

Dec 24 17:08:09 upload.jitsi.xxxxxxx.org:push_appserver info    Registered push device, returning: 'OK', 'node', 'secret'
Dec 24 17:08:14 http.server debug   Firing event: GET /push_appserver/v1/settings
Dec 24 17:08:14 http.server debug   Firing event: GET upload.jitsi.xxxxxxx.org/push_appserver/v1/settings
Dec 24 17:08:14 sql debug   SQL transaction begin [function(mod_storage_sql.lua:137)]
Dec 24 17:08:14 sql debug   SQL transaction success [function(mod_storage_sql.lua:137)]
Dec 24 17:08:25 socket  debug   connection failed in read event: closed 
Dec 24 17:08:25 socket  debug   closing client with id: 55cb64fc15f0 closed 
Dec 24 17:08:34 http.server debug   Firing event: GET /push_appserver/v1/settings/node
Dec 24 17:08:34 http.server debug   Firing event: GET upload.jitsi.xxxxxxx.org/push_appserver/v1/settings/node
Dec 24 17:08:57 http.server debug   Firing event: POST /push_appserver/v1/push
Dec 24 17:08:57 http.server debug   Firing event: POST upload.jitsi.xxxxxxx.org/push_appserver/v1/push
Dec 24 17:08:57 upload.jitsi.xxxxxxx.org:push_appserver info    Firing event 'incoming-push-to-apns' (node = 'node', secret = 'secret')
Dec 24 17:08:57 upload.jitsi.xxxxxxx.org:push_appserver_apns    debug   Frame ID: 19194DB2
Dec 24 17:08:57 upload.jitsi.xxxxxxx.org:push_appserver_apns    debug   Frame length: 80 (00000050)
Dec 24 17:08:57 upload.jitsi.xxxxxxx.org:push_appserver_apns    debug   Frame data: xxxxx
Dec 24 17:08:57 upload.jitsi.xxxxxxx.org:push_appserver_apns    debug   Frame: xxxxx
Dec 24 17:08:57 upload.jitsi.xxxxxxx.org:push_appserver_apns    debug   connecting to gateway.sandbox.push.apple.com on port 2195
Dec 24 17:08:58 upload.jitsi.xxxxxxx.org:push_appserver_apns    debug   connection established successfully
Dec 24 17:08:58 upload.jitsi.xxxxxxx.org:push_appserver_apns    debug   sending out frame with id '19194DB2'...
Dec 24 17:09:00 upload.jitsi.xxxxxxx.org:push_appserver_apns    info    Got error for ID '19194DB2': Invalid token
Dec 24 17:09:00 upload.jitsi.xxxxxxx.org:push_appserver_apns    info    Could not receive data from APNS socket: closed
Dec 24 17:09:00 upload.jitsi.xxxxxxx.org:push_appserver_apns    warn    APNS push error for ID '19194DB2' --> resending all following pushes...
Dec 24 17:09:00 upload.jitsi.xxxxxxx.org:push_appserver_apns    debug   Queue entry 1: 19194DB2
Dec 24 17:09:00 upload.jitsi.xxxxxxx.org:push_appserver warn    Push handler for type 'apns' not executed successfully: APNS error: Invalid token
Dec 24 17:09:00 sql debug   SQL transaction begin [function(mod_storage_sql.lua:132)]
Dec 24 17:09:00 sql debug   SQL transaction success [function(mod_storage_sql.lua:132)]
tmolitor-stud-tu commented 4 years ago

In the logs it clearly shows that you try to use the wrong apns token. The token is saved in the push server when you register a node.

I guess you simply provided the wrong token when you registered the node. Maybe you confused the apple sandbox token with the token for the production service or vice versa? (yes, tokens for the sandbox are different from those for the production service and cannot be interchanged)

btw: the issue title seems to be wrong for your issue?

tmolitor-stud-tu commented 4 years ago

You don't have to add

"push_appserver";
"push_appserver_apns";

to the modules_enabled list if you have it already in the component line.

And if not, it is sufficient to add push_appserver_apns to the enabled list (the main module is automatically pulled in via dependencies).

tmolitor-stud-tu commented 4 years ago

I will close this now, feel free to reopen it if your issues persist