Client → ClientHello (支持的加密套件, 随机数)
Server ← ServerHello + Certificate + ServerKeyExchange + ServerHelloDone
Client → ClientKeyExchange + ChangeCipherSpec + Finished
Server ← ChangeCipherSpec + Finished
简化了握手流程,移除不安全算法,默认前向安全。
# 查看远程证书
openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -text
# 关键信息
openssl x509 -noout -subject -dates -issuer -in cert.pem
# 证书链验证
openssl verify -CAfile ca-bundle.crt cert.pem
# 证书过期时间(批量检查)
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | \
openssl x509 -noout -enddate
| 类型 | 验证级别 | 颁发速度 | 适用场景 |
|---|---|---|---|
| DV | 域名验证 | 分钟级 | 个人网站 |
| OV | 组织验证 | 1-3 天 | 企业网站 |
| EV | 扩展验证 | 3-10 天 | 金融等高风险 |
# 生成自签证书
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
# 生成 CSR(证书签名请求)
openssl req -new -newkey rsa:4096 -keyout key.pem -out csr.pem -nodes
# certbot 自动获取
certbot certonly --standalone -d example.com -d www.example.com
certbot renew # 续期
certbot certificates # 查看已获取证书
# 测试 TLS 版本和密码套件支持
nmap --script ssl-enum-ciphers -p 443 example.com
sslscan example.com
testssl.sh https://example.com