surrealroad / Safari-Push-Notifications

Reference Server for pushing Safari Notifications via Apple Push Notification Service For use with Safari Push Plugin for Wordpress (https://github.com/surrealroad/wp-safari-push)
23 stars 9 forks source link

No pushs, no registration and errors in logs #18

Open Djibs opened 9 years ago

Djibs commented 9 years ago

Hello,

Since today, I do not get the push on my website. Registration not work either.

I installed the patch to tls Friday and it worked fine until today.

My certificate has not expired but I see it in the logs :

[Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:14094415:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate expired in /home/XXX/domains/XXX/private_html/kg/index.php on line 197 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: stream_socket_client(): Failed to enable crypto in /home/XXX/domains/XXX/private_html/kg/index.php on line 197 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: stream_socket_client(): unable to connect to tls://gateway.push.apple.com:2195 (Unknown error) in /home/XXX/domains/XXX/private_html/kg/index.php on line 197 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /home/XXX/domains/XXX/private_html/kg/index.php on line 133 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: Missing argument 4 for connect_apns(), called in /home/XXX/domains/XXX/private_html/kg/index.php on line 134 and defined in /home/XXX/domains/XXX/private_html/kg/index.php on line 192 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: Missing argument 5 for connect_apns(), called in /home/XXX/domains/XXX/private_html/kg/index.php on line 134 and defined in /home/XXX/domains/XXX/private_html/kg/index.php on line 192 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Notice: Undefined variable: passphrase in /home/XXX/domains/XXX/private_html/kg/index.php on line 195 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Notice: Undefined variable: caFile in /home/XXX/domains/XXX/private_html/kg/index.php on line 196

For information, Debian no longer accepts SSLv3

surrealroad commented 9 years ago

Can you double check when your certificate from apple expires? I know they only last for a year and I had to renew mine recently

On Monday, October 27, 2014, Djibs notifications@github.com wrote:

Hello,

Since today, I do not get the push on my website. Registration not work either.

I installed the patch to tls Friday and it worked fine until today.

My certificate has not expired but I see it in the logs :

[Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:14094415:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate expired in /home/XXX/domains/XXX/private_html/kg/index.php on line 197 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: stream_socket_client(): Failed to enable crypto in /home/XXX/domains/XXX/private_html/kg/index.php on line 197 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: stream_socket_client(): unable to connect to tls:// gateway.push.apple.com:2195 (Unknown error) in /home/XXX/domains/XXX/private_html/kg/index.php on line 197 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /home/XXX/domains/XXX/private_html/kg/index.php on line 133 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: Missing argument 4 for connect_apns(), called in /home/XXX/domains/XXX/private_html/kg/index.php on line 134 and defined in /home/XXX/domains/XXX/private_html/kg/index.php on line 192 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Warning: Missing argument 5 for connect_apns(), called in /home/XXX/domains/XXX/private_html/kg/index.php on line 134 and defined in /home/XXX/domains/XXX/private_html/kg/index.php on line 192 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Notice: Undefined variable: passphrase in /home/XXX/domains/XXX/private_html/kg/index.php on line 195 [Mon Oct 27 14:26:10 2014] [error] [client xx.xxx.xx.xx] PHP Notice: Undefined variable: caFile in /home/XXX/domains/XXX/private_html/kg/index.php on line 196

— Reply to this email directly or view it on GitHub https://github.com/surrealroad/Safari-Push-Notifications/issues/18.

Jack James http://about.me/jackjames, Surreal Road Limited http://www.surrealroad.com

www.surrealroad.com

surrealroad commented 9 years ago

Can you check if a new visitor can request notifications from your site? It seems like this is no longer working, which is weird because that code (createPushPackage) hasn't been changed.

Djibs commented 9 years ago

I had indeed a problem with an expired certificate.

Now we can subscribe, but it’s impossible to send a push, it doesn’t work anymore.

surrealroad commented 9 years ago

Doesn't look like it works for your site either. Apple must have revoked the .pem file or something.

surrealroad commented 9 years ago

could be we need to change: define('CERTIFICATE_AUTHORITY', 'entrust_2048_ca.cer'); to define('CERTIFICATE_AUTHORITY', './entrust_2048_ca.cer'); I'm still unable to connect at all so can't provide any more info yet

surrealroad commented 9 years ago

ok I've finally figured it out. So we got into a bit of a mess I think because your certificate had expired. So actually the only change that was ever required was to change ssl: to tls:

I've reverted all the unnecessary commits to index.php, give it a try.

surrealroad commented 9 years ago

Hey @Djibs is your production certificate (.pem file) encrypted with a password?

Djibs commented 9 years ago

yes

surrealroad commented 9 years ago

aha, we have a winner then I think. try implementing this in your service: https://github.com/surrealroad/Safari-Push-Notifications/blob/passworded-production-cert/index.php#L195

Djibs commented 9 years ago

it's not work. Notification sent (0 of 1 device(s) notified)

surrealroad commented 9 years ago

Can you try with error logging on? See what the actual error is?

Djibs commented 9 years ago

how do I enable it?

surrealroad commented 9 years ago

add something like:

error_reporting(E_ALL); ini_set('error_reporting', E_ALL); ini_set('display_errors',1); to the top of index.php on the push service

surrealroad commented 9 years ago

Hey @Djibs I added some code to provide a little bit more of an error message if the APNS connection fails, it might help track down what your issue is.

Also I noticed that sometimes APNS says it has made the push, although no push is received. I unsubscribed my safari and resubscribed it, and the pushes started coming through.