Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
LemonWiki共筆
Search
Search
Appearance
Log in
Personal tools
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
SSL Certificate Test
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== 在自己電腦 SSL 憑證測試 == 以下以 <code>example.com</code> 為例,檢查網站憑證、伺服器提供的憑證鏈,以及實際驗證結果。 === 1. 查看伺服器提供的憑證鏈 === <pre lang="bash"> openssl s_client \ -connect example.com:443 \ -servername example.com \ -showcerts \ </dev/null </pre> 查看 <code>Certificate chain</code>: * <code>s:</code>:憑證主體。 * <code>i:</code>:憑證簽發者。 * 每張憑證的簽發者,應能銜接下一張憑證的主體。 * 根憑證通常不需要由伺服器傳送。 '''列出憑證鏈不代表已通過信任驗證。''' === 2. 查看憑證期限、序號與指紋 === <pre lang="bash"> openssl s_client \ -connect example.com:443 \ -servername example.com \ </dev/null 2>/dev/null | openssl x509 -noout \ -subject -issuer -serial -dates -fingerprint -sha256 </pre> 重點欄位: <table> <tr><th>欄位</th><th>檢查用途</th></tr> <tr><td><code>subject</code></td><td>憑證主體</td></tr> <tr><td><code>issuer</code></td><td>簽發者</td></tr> <tr><td><code>notBefore</code>/<code>notAfter</code></td><td>有效期間</td></tr> <tr><td><code>serial</code></td><td>憑證序號</td></tr> <tr><td><code>SHA256 Fingerprint</code></td><td>比對更新前後是否為同一張憑證</td></tr> </table> 指紋不同,表示網站憑證已更換;指紋相同但鏈不同,可能只是修正了憑證鏈。 === 3. 驗證憑證信任與網域名稱 === <pre lang="bash"> openssl s_client \ -connect example.com:443 \ -servername example.com \ -verify_hostname example.com \ -verify_return_error \ </dev/null </pre> 成功時應看到: <pre lang="text"> Verification: OK Verified peername: example.com Verify return code: 0 (ok) </pre> 這表示通過本機 OpenSSL 使用的信任庫與網域驗證,不等於所有用戶端皆能通過,也不代表已完成撤銷狀態檢查。 === 4. 使用 curl 驗證 HTTPS 請求 === <pre lang="bash"> curl -sS -o /dev/null \ -w "HTTP=%{http_code} ssl_verify=%{ssl_verify_result}\n" \ https://example.com/ </pre> 例如: <pre lang="text"> HTTP=200 ssl_verify=0 </pre> * <code>HTTP=200</code>:首頁請求成功。 * <code>ssl_verify=0</code>:憑證驗證成功。 其他 HTTP 狀態碼不一定代表 SSL 有問題,例如 <code>301</code>、<code>302</code> 表示轉址。若要跟隨轉址,可加入 <code>-L</code>: <pre lang="bash"> curl -sS -L -o /dev/null \ -w "URL=%{url_effective} HTTP=%{http_code} ssl_verify=%{ssl_verify_result}\n" \ https://example.com/ </pre> 檢測時不要使用 <code>-k</code> 或 <code>--insecure</code>,否則會跳過憑證驗證。 === 5. 使用 SSL Labs 進行外部檢測 === 1. 前往 [https://www.ssllabs.com/ssltest/ SSL Server Test (Powered by Qualys SSL Labs)] (範例:[https://www.ssllabs.com/ssltest/analyze.html?d=www.google.com Google.com 檢測結過]) 2. 確認: # 選擇重新測試,避免只查看舊快取。 # 測試時間晚於憑證更新時間。 # 沒有憑證不受信任、過期或網域不符警告。 # 展開 <code>Certification Paths</code>,確認能連到受信任根憑證。 # 若網站有多個 IP,確認各端點的結果。
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki共筆:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)