โปรโตคอล 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 จะเป็นการเชื่อมต่อของใบรับรอง Intermediate และ Root 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 เฉพาะซึ่งเป็นสิ่งที่บิตบิตใกล้จุดเริ่มต้นมีวัตถุประสงค์เพื่อสนับสนุน; บิตที่น่าสนใจจะทำโดยเพ่งพิศ)
นี่คือตัวอย่างของวิธีการใช้งานของคุณ (เช่นการตรวจสอบในใบรับรองในกลุ่ม 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