116
113

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SSL証明書の有効期限や内容を確認する方法一覧

Last updated at Posted at 2018-09-06

コマンドラインでSSL証明書の有効期限や内容を確認するコマンドを収集した。

SSL証明書の有効期限の確認

ローカルファイルの確認

openssl x509 -noout -dates -in /etc/pki/tls/certs/example.com.crt

サーバー側の確認

https

echo | openssl s_client -connect example.com:443 2> /dev/null | openssl x509 -noout -enddate | cut -d= -f2

smtp

openssl s_client -connect example.com:25 -starttls smtp | openssl x509 -noout -dates
openssl s_client -connect example.com:587 -starttls smtp | openssl x509 -noout -dates

25番ポートや587番ポートを指定する際は -starttls smtp を指定しないと以下のようなエラーが出力される。

139641776269136:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:794:
unable to load certificate
140160526772048:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:707:Expecting: TRUSTED CERTIFICATE

SSL証明書のディスティングイッシュネームの確認

openssl x509 -noout -subject -in example.com.crt

.

openssl x509 -noout -issuer -in example.com.crt

証明書ファイルの確認

openssl x509 -noout -text -in example.com.crt
openssl asn1parse -in example.com.crt

秘密鍵ファイルの確認

openssl rsa -noout -text -in example.com.key

CSRファイルの確認

openssl req -noout -text -in example.com.csr

サーバーのSSL証明書の確認

openssl s_client -showcerts -connect example.org:443

HTTPS  443
POP over SSL  995
SMTP over SSL  465
IMAPS  993

SSL証明書の動作確認

openssl s_server -accept 10443 -cert example.com.crt -key example.com.key -CAfile example.com.ica -WWW
openssl s_client -connect localhost:10433

116
113
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
116
113

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?