找出有多less浏览器拒绝SSL证书

我想知道有多less浏览器在向我们的networking服务器发送HTTP请求时会拒绝我们的SSL证书。 我们正在使用一个免费的CA,现在似乎已经被大多数现代浏览器所认可,但是我希望获得一些数字,而不是详尽地testing浏览器和操作系统的组合。

我知道浏览器在证书validation失败时会终止连接,那么Apache有没有办法检测到这个? 我不希望得到具体的诊断信息 – 只是有证书/ SSL问题就足够了。

SSL协议确实有一个警报代码,当CA是未知的…你可以使用像我想的tshark检测它。

但更有用的是知道如何避免这个问题。 在Apache中,确保你有以下的THREE指令:

SSLCertificateFile /etc/pki/tls/certs/myserver.cert SSLCertificateKeyFile /etc/pki/tls/private/myserver.key SSLCertificateChainFile /etc/pki/tls/certs/myserver.ca-bundle 

给予文件名的扩展名对于Apache来说并不重要。 在这种情况下,SSLCertificateFile将是服务器主体的单个X.509证书,而SSLCertificateChainFile将是中间和根CA证书(从根开始)的串联。

这里有一个有用的脚本来帮助探索PEM编码中的证书链。

 #!/bin/bash # # For an input of concatenated PEM ("rfc style") certificates, and a # command-line consisting of a command to run, run the command over each PEM # certificate in the file. Typically the command would be something like # 'openssl x509 -subject -issuer'. # # Example: # # ssl-rfc-xargs openssl x509 -subject -issuer -validity -modulus -noout < mynewcert.pem # sed -e 's/^[ \t]*<ds:X509Certificate>\(.*\)$/-----BEGIN CERTIFICATE-----\n\1/' \ -e 's/^[ \t]*<\/ds:X509Certificate>[ \t]*$/-----END CERTIFICATE-----\n/' \ -e 's/^\(.*\)<\/ds:X509Certificate>[ \t]*$/\1\n-----END CERTIFICATE-----\n/' \ | gawk -vcommand="$*" ' /^-----BEGIN /,/^-----END / { print |& command } /^-----END / { while ((command |& getline results) > 0) { print results } close(command) } ' 

(这个特定的脚本也被用于特定的XML应用程序,这是开始附近的sed位用来支持的;有趣的位是由gawk完成的。)

以下是一个如何使用它的例子(例如,在CA包中的证书中确定的顺序是否正确 – 有时这很重要)

 $ openssl s_client -connect google.com:443 -showcerts </dev/null 2>&1 | ssl-rfc-xargs openssl x509 -subject -issuer -noout subject= /C=US/ST=California/L=Mountain View/O=Google Inc/CN=google.com issuer= /C=US/O=Google Inc/CN=Google Internet Authority G2 subject= /C=US/O=Google Inc/CN=Google Internet Authority G2 issuer= /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA subject= /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA issuer= /C=US/O=Equifax/OU=Equifax Secure Certificate Authority 

请注意,一个证书的签发人是如何与母公司的主体紧邻的

这是另一个如何使用该脚本来检查本地文件的例子。

 $ < /etc/pki/tls/certs/example.ca-bundle ssl-rfc-xargs openssl x509 -subject -issuer -noout