在 Debian 上,可以用 OpenSSL 的 s_client 来测试(尤其是 HTTPS / TLS 端口)。下面按常见场景说明。
例如测试 example.com 的 443 端口:
openssl s_client -connect example.com:443
如果你想看证书信息:
openssl s_client -connect example.com:443 | openssl x509 -noout -text
或者只看关键信息:
openssl s_client -connect example.com:443 2>/dev/null | openssl x509 -noout -dates -subject
现代网站通常需要 SNI:
openssl s_client -connect example.com:443 -servername example.com
例如 8443:
openssl s_client -connect example.com:8443 -servername example.com
openssl s_client -connect mail.example.com:587 -starttls smtp
openssl s_client -connect mail.example.com:993
openssl s_client -connect mail.example.com:995
连接成功后,可以手动输入 HTTP 请求:
GET / HTTP/1.1
Host: example.com
Connection: close
按两次回车即可。
如果不是 TLS,OpenSSL 不适合,推荐用:
nc -vz example.com 80
或
telnet example.com 80
如果你愿意,可以告诉我:
我可以给你精确命令。