3
7

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.

必要なCA証明書がサーバにインストールされているかを確認する(Amazon Linux & curl 編)

Last updated at Posted at 2018-07-13

はじめに

API連携先より、特定の証明書がサーバ内にインストールされているかを確認をするように連絡があった。

DigiCert Global Root CA

curl接続時に使われている暗号化方法

APIへはcurlで接続されている。https通信する際に、内部でNSSやOpenSSLを使って暗号化している様子。 curlは標準ではNSSを使っているらしい。以下で確認できる。

$ curl --version
curl 7.40.0 (x86_64-redhat-linux-gnu) libcurl/7.40.0 NSS/3.19.1 Basic ECC zlib/1.2.8 libidn/1.18 libssh2/1.4.2
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets

NSSを使っているのがわかる。通常、サーバにはメジャーなCA(Certificate authority、認証局)については、証明書がプリインストールされているとのこと。ゆえに、特に設定せずhttpsのURLに対してcurlを実行しても結果が返ってくるみたい。ブラウザでの閲覧時も同様。ちなみに、NSS/3.19.1-6 versionからTLS 1.2に標準対応しているとのこと。

NSSの証明書のサーバ内の所在

ググるとRHEL 6 or laterの場合は、
Curl is using the system-default CA bundle is stored in /etc/pki/tls/certs/ca-bundle.crt. との記述あり。
Amazon LinuxはRedHat系なので、実際にサーバを調べるとNSSについてのコメントが書かれたファイルが見つかった (OS、OS version、そして暗号化方法によって異なる可能性あるので注意)。

vi /etc/pki/tls/certs/ca-bundle.crt

いくつもの証明書の中に探していたIssuerの「DigiCert」のものが見つかる!

証明書イメージ↓

長い部分は(省略)としています。

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            08:3b:e0:56:90:42:46:b1:a1:75:6a:c9:59:91:c7:4a
    Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA
        Validity
            Not Before: Nov 10 00:00:00 2006 GMT
            Not After : Nov 10 00:00:00 2031 GMT
        Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                                     (省略)
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign, CRL Sign
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier:
                03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55
            X509v3 Authority Key Identifier:
                keyid:03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55

    Signature Algorithm: sha1WithRSAEncryption
          (省略)
-----BEGIN CERTIFICATE-----
(証明書部分)
-----END CERTIFICATE-----

これで安心して更新を待てそうです。

補足

  • 最初、誤ってopensslの証明書を探していた。

    • /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt にそれらしきものが見つかる。
    • Issuerなどの情報が書かれていない & 複数の証明書が1ファイル内で連結されている。
    • 1証明書ずつ、openssl x509 -in {cert_file} -noout -textで中身を見ることはできた。
  • 2017/10/31に、DigiCertsがSymantecのPKIソリューションを買収した。

  • エンジニア経験浅いので、間違った内容があればご指摘いただけると助かります。

参考

3
7
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
3
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?