简体   繁体   English

如何找出我的SSL设置有什么问题?

[英]How can I find out what's wrong with my SSL setup?

I have a Windows server, with the proper SSL trust chain. 我有一台Windows服务器,带有正确的SSL信任链。 On this server runs a nodejs signaling server for my voip app. 在此服务器上,为我的voip应用程序运行一个nodejs信令服务器。 I used to run the nodejs server on CentOS, but it was migrated to windows not too long ago. 我曾经在CentOS上运行nodejs服务器,但是不久前它已迁移到Windows。 I had disabled SSL in the app for the time being, but now that I enable it again I can't connect with the message "CFNetwork SSLHandshake failed (-9824)". 我暂时在应用程序中禁用了SSL,但现在再次启用它,就无法连接“ CFNetwork SSLHandshake failed(-9824)”消息。

I understand nobody can help me with finding out what's wrong, but I expected a more descriptive message from apple. 我知道没有人可以帮助我找出问题所在,但我希望苹果能提供更具描述性的信息。 9824 Just means "handshake failed" and the device logs reveal nothing special. 9824只是表示“握手失败”,并且设备日志中没有显示任何特殊内容。 I added: 我补充说:

setenv("CFNETWORK_DIAGNOSTICS", "3", 1);

And checked the logs that it produced, but it only told me that the handshake failed :/ I tried adding 并检查了它产生的日志,但它只告诉我握手失败://我尝试添加

CFReadStreamSetProperty(readStream, kCFStreamSSLValidatesCertificateChain, kCFBooleanFalse);
CFWriteStreamSetProperty(writeStream, kCFStreamSSLValidatesCertificateChain, kCFBooleanFalse);

to the socket initialization to see if that allowed me to connect, but it didn't. 到套接字初始化,看看是否允许我连接,但没有。 I also added that weird info.plist snippet to allow TLS1.0 instead of TLS1.2 on iOS9, but even that didn't change anything. 我还添加了一个奇怪的info.plist代码段,以允许在iOS9上使用TLS1.0而不是TLS1.2,但是即使那样也没有任何改变。

So my question: How the hell do I get enough information to start debugging this mess? 所以我的问题是:我怎么会得到足够的信息来开始调试这个烂摊子? I get that the handshake failed, Apple, but I'd like to know WHY it failed... 我知道握手失败了,Apple,但我想知道为什么失败了...

Edit: sorry for bad formatting, I'm in a hurry :) 编辑:抱歉,格式不正确,我很忙:)

Here is my socket init code: 这是我的套接字初始化代码:

APP.onlineUsers = [[NSMutableArray alloc] init];

self.didOpenInputStream = NO;
self.didOpenOutputStream = NO;

self.messageQueue = [[NSMutableArray alloc] init];

CFReadStreamRef readStream;
CFWriteStreamRef writeStream;

NSInputStream* inputStream;
NSOutputStream* outputStream;

CFStreamCreatePairWithSocketToHost(NULL, (__bridge CFStringRef)serverUrl, (uint)serverPort, &readStream, &writeStream);

CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);

CFReadStreamSetProperty(readStream, kCFStreamSSLValidatesCertificateChain, kCFBooleanFalse);//tried without this as well
CFWriteStreamSetProperty(writeStream, kCFStreamSSLValidatesCertificateChain, kCFBooleanFalse);//tried without this as well

CFReadStreamSetProperty(readStream, kCFStreamPropertySocketSecurityLevel, kCFStreamSocketSecurityLevelSSLv3);//tried v2 this as well
CFWriteStreamSetProperty(writeStream, kCFStreamPropertySocketSecurityLevel, kCFStreamSocketSecurityLevelSSLv3);//tried v2 this as well

inputStream = (__bridge_transfer NSInputStream*)readStream;
outputStream = (__bridge_transfer NSOutputStream*)writeStream;

[inputStream setProperty:NSStreamNetworkServiceTypeVoIP forKey:NSStreamNetworkServiceType];

[inputStream setDelegate:self];
[outputStream setDelegate:self];

self.runLoop = [NSRunLoop currentRunLoop];

[inputStream scheduleInRunLoop:self.runLoop forMode:NSDefaultRunLoopMode];
[outputStream scheduleInRunLoop:self.runLoop forMode:NSDefaultRunLoopMode];

[inputStream open];
[outputStream open];

self.inputStream = inputStream;
self.outputStream = outputStream;

Most likely the problem is that your server is not "ATS compliant". 最有可能的问题是您的服务器不兼容“ ATS”。 ATS brings enforced security to the device starting with iOS 9 resp. 从iOS 9开始,ATS为设备带来了强制的安全性。 OS X 10.11. OS X 10.11。 Especially you need 特别是你需要

  • TLS 1.2 on server side, 服务器端的TLS 1.2,
  • a certificate not encrypted with SHA (without 2). 未使用SHA加密的证书(无2)。

If your server does not fulfill this requirements you can turn ATS off for this server as described here . 如果服务器不满足此要求,则可以按此处所述关闭该服务器的ATS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM