SSL 인증서를 거부하는 브라우저 수를 확인하십시오. 할 때 SSL 인증서를 거부하는 브라우저 수를

웹 서버에 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

파일 이름에 주어진 확장자는 실제로 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


답변