APNS ssl://gateway.sandbox.push.apple.com:2195 连接失败
我尝试制作一个推送通知服务器。 我通过 telnet 连接到 ssl://gateway.sandbox.push.apple.com:2195 。
telnet gateway.sandbox.push.apple.com 2195
Trying 17.172.232.229...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.
我的 *.pem 没问题(我在另一台服务器上使用它)。 我在其他服务器上使用相同的项目,它可以在那里工作,但其他服务器上的克隆却不能。
我收到这些错误:
Warning: stream_socket_client() [function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages: error:14094415:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate expired in /var/www/try.php on line 69
Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /var/www/try.php on line 69
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /var/www/try.php on line 69
证书未过期,它在其他服务器上有效并且日期相同。
有人知道错误可能是什么吗?
我从事
Apache/2.2.9 (Debian) PHP/5.2.17-0.dotdeb.0 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g
编辑工作: 看来,在不同的服务器上使用相同的证书是行不通的。也许这被苹果服务器阻止了。
i try to make a push-notification server.
I get connection to ssl://gateway.sandbox.push.apple.com:2195 with telnet.
telnet gateway.sandbox.push.apple.com 2195
Trying 17.172.232.229...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.
my *.pem is ok (I use it on another server).
I use the SAME project on an other Server and it works there but the clone on an other Server doesn't.
I get these Errors:
Warning: stream_socket_client() [function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages: error:14094415:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate expired in /var/www/try.php on line 69
Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /var/www/try.php on line 69
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /var/www/try.php on line 69
The certificate is NOT expired, it works on the other Server and the date is the same.
Does someone has a clue what the mistake could be?
I work on
Apache/2.2.9 (Debian) PHP/5.2.17-0.dotdeb.0 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g
EDIT:
It seems, that using the same certificate on different servers doesn't work. Maybe this is blocked by Apples servers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我使用 apn_on_rails 来实现此目的,但我认为只要您使用
pem 文件
。我通过重新下载证书和中间证书、使用以下说明重新生成推送通知pem
文件来解决此问题:一旦您获得 Apple 为您的应用程序提供的证书,请导出您的密钥
和苹果证书作为 p12 文件。以下是有关如何执行此操作的快速演练:
I use apn_on_rails for this, but I think it will work for you as long as you are using a
pem file
. I fixed this by re-downloading the certificate and intermediate certificate, regenerating the push notificationpem
file using these instructions:Once you have the certificate from Apple for your application, export your key
and the apple certificate as p12 files. Here is a quick walkthrough on how to do this:
这种错误发生在两种情况下:
.pem
文件未正确制作时(如我的情况)。尝试这两点。您肯定不会收到任何错误。
This kind of error occur in two situation:
.pem
file is not made correctly (as in my case).Try these two points. You will surely not get any error.
我遇到了同样的问题,但我的解决方案是需要绝对路径的 pem 证书
来自此处
I had the same problem but the solution in my case was that pem certificate that required absolute path
from here
从互联网上随机发现的一些内容可能会有所帮助:
这可能是证书问题。尝试使用流选项allow_self_signed 和verify_peer 来检查这一点。
尝试明确使用 sslv2:// 或 sslv3:// ?
“/dev/urandom”的权限问题
Some random finding from the internet which could help:
It may be a certificate problem. Try the stream options allow_self_signed and verify_peer to check that.
Try to use explicitely sslv2:// or sslv3:// ?
Permission problem on "/dev/urandom"
也许你的 ISP 阻止了端口 2195 和 2196。我也遇到了同样的问题,要求他们打开它,这对我有用。
Maybe your ISP block ports 2195 and 2196. I had the same problem, asked them to open it and that worked for me.
你提到:
我发现 .pem 证书无法转移。以下是我让一个在一台 OS X 机器上运行的应用程序在另一台机器上运行的步骤(不知道如何为非 Apple 机器执行此操作):
希望这有帮助
You mention:
I've found that .pem certificates don't transfer. Here are the steps I followed to get an app that works on one OS X machine to work on another (don't know how to do it for non-Apple machines):
Hope this is helpful
我的 Linux 机器上也有类似的问题。对我来说,这是 SELinux 问题。
因此,在 /etc/selinux/config 文件中,将 SELINUX=enforcing 设置为 SELINUX=disabled。并重新启动。就是这样。
I had a similar issue on my Linux box. To me, it was the SELinux issue.
So in your /etc/selinux/config file, set the SELINUX=enforcing to SELINUX=disabled. And restart. Thats it.
尝试...
telnet gateway.sandbox.push.apple.com:2195
而不是...
telnet gateway.sandbox.push.apple.com 2195
try...
telnet gateway.sandbox.push.apple.com:2195
instead of ...
telnet gateway.sandbox.push.apple.com 2195