Mat*_*att 11 security ssl ssl-certificate apache-2.2
我想知道有多少浏览器在向我们的网络服务器发出 HTTP 请求时拒绝了我们的 SSL 证书。我们正在使用一个免费的 CA,它现在似乎被大多数现代浏览器所识别,但我想获得一些数字,而无需详尽地测试浏览器和操作系统的组合。
我知道浏览器会在证书验证失败时终止连接,那么 Apache 有什么方法可以检测到这一点吗?我不希望获得特定的诊断信息 - 仅存在证书/SSL 问题的事实就足够了。
SSL 协议确实有一个当 CA 未知时的警报代码......我想你可以使用 tshark 之类的东西来检测它。
但更有用的是知道如何避免问题。在 Apache 中,确保您有以下三个指令:
SSLCertificateFile /etc/pki/tls/certs/myserver.cert
SSLCertificateKeyFile /etc/pki/tls/private/myserver.key
SSLCertificateChainFile /etc/pki/tls/certs/myserver.ca-bundle
Run Code Online (Sandbox Code Playgroud)
文件名的扩展名对于 Apache 来说并不重要。在这种情况下,SSLCertificateFile 将是带有服务器主题的单个 X.509 证书,而 SSLCertificateChainFile 将是中间 CA 证书和根 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)
}
'
Run Code Online (Sandbox Code Playgroud)
(这个特定的脚本也用于特定的 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
Run Code Online (Sandbox Code Playgroud)
注意一对一证书的颁发者如何与父主题相邻[紧接在下面]
这是如何使用该脚本来检查本地文件的另一个示例。
$ < /etc/pki/tls/certs/example.ca-bundle ssl-rfc-xargs openssl x509 -subject -issuer -noout
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
283 次 |
| 最近记录: |