【RDS】2015年3月のSSL証明書バンドル・認証局(CA)の更新作業をやってみた

2015.02.25

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

こんにちは、ブログにはご無沙汰の三井田です。

今回の記事は、Amazon RDSでSSL通信を利用しているユーザ向けです。
SSL通信を使用していない場合は、特に更新作業は必要ありません。

はじめに

先日、AWSよりAmazon RDSでSSL通信を利用しているユーザ向けに脚注に引用したアナウンス *1がありました。RDSのマネジメントコンソールにも以下のようなバナーが表示されています。
RDS_00_banner

要点をかいつまむと、次のような内容です。

  • 対応が必要なのは、RDS(MySQL、SQL Server、またはPostgreSQL)とクライアント間でSSL通信を利用している方
  • 対応期限は、日本時間で、2015年3月24日 午前5時
  • SSL証明書が有効期限を迎えるので、引続きRDS〜クライアント間のSSL通信を行うには対応が必要
    1. クライアントプログラムは、AWSが提供する新しい証明書バンドルを利用するように変更が必要
    2. RDSインスタンスは、認証局(Certificate Authority、以下、CA)設定の変更が必要。設定変更時に、RDSインスタンスのリブートが発生します
  • 対応手順は次の順序で実施することが必須

    RDSの設定を先にアップデートしてしまうと、クライアントはRDSにSSL接続できなくなります

    1. AWSが提供する新しい証明書バンドルを取得(既存の旧証明書も含まれています)
    2. クライアントプログラムが、新しい証明書バンドルを使うよう、プログラムや設定を変更
    3. RDSインスタンスの認証局(CA)の設定をアップデート

ステップ1・2:クライアント側の証明書アップデート

この章では、クライアント側の作業を簡単に紹介します。

ステップ1:クライアント証明書のダウンロード

こちらは、単純です。冒頭の引用に記載のとおり、rds-combined-ca-bundle.pemをダウンロードします。
(期限を迎える旧証明書は、rds-ssl-ca-cert.pemでした。)

ちなみに、このバンドルに含まれる証明書をopenssl x509 -text -nooutで出力したものを抜粋すると、現行の証明書は全リージョン共通ですが、新証明書はリージョンごとに分かれている *2模様です。

ステップ2:クライアントやアプリケーションに新証明書を配備

各SQLクライアントやアプリケーションが、新しい証明書バンドルrds-combined-ca-bundle.pemを参照してRDSへ接続するよう証明書バンドルを配付します。
従来の証明書は、rds-ssl-ca-cert.pemというファイル名で配付されていたので、それらを差替える作業になります。

配付先は、RDSに接続する社内の開発者であったり、Webアプリケーションや業務アプリケーションのデプロイ先のEC2サーバなどですね。

新証明書バンドルでRDSへ接続できるかは、SQLクライアントコマンドレベルでは、以下のように確認できると思います。

MySQL

mysql -h db.example.com -u dbuser -p --ssl_ca=/path/to/rds-combined-ca-bundle.pem

SQL Server

こちらは、公式ドキュメントに手順がキャプチャ付きで載ってますので参照ください。

PostgreSQL

psql -h db.example.com -p 5432 -U dbuser -W "sslmode=verify-full sslrootcert=/path/to/rds-combined-ca-bundle.pem dbname=sampledb"

ステップ3:RDSの認証局(CA)アップデート

クライアント側の準備が整ったら、RDSインスタンスの認証局(CA)をアップデートします。手順は次のとおりです。

  1. RDSマネジメントコンソール、「Instances」画面を開きます。現在は「Certificate Authority」が、「rds-ca-2010 (4/4/15)」となっていると思います。
    RDS_01_detail
  2. 対象のRDSを選択し、「Instance Actions」ー>「Modify」をクリックしてModify画面を開きます
    RDS_02_menu
  3. 「Certificate Authority」オプションを、「rds-ca-2010」から「rds-ca-2015」に変更します
    RDS_03_modify_01
  4. 次の操作は、即時適用とするか、次回メンテナンスウィンドウで適用とするかで、操作が変わります
    1. 即時適用:「Apply Immediately」チェックボックスを「オン」にして、「Continue」ボタンをクリックします
      変更内容を確認し、「Modify DB Instance」ボタンをクリックすると、即時にRDSインスタンスのリブートが発生します
      RDS_03_modify_02
    2. 次回メンテナンス時適用:「Apply Immediately」チェックボックスを「オフ」にして、「Continue」ボタンをクリックします
      変更内容を確認し、「Modify DB Instance」ボタンをクリックすると、メンテナンス時刻に設定された次回の曜日時間帯にリブートが発生します
      (【追記】次回メンテナンスウィンドウに更新されるかの確認方法は、現時点では限られています。詳しくは脚注 *3 をご覧下さい) RDS_03_modify_03
  5. 適用確認
    • 変更したRDSインスタンスの「Certificate Authority」が、「rds-ca-2015 (3/5/20)」となっていることを確認します
      RDS_05_detail
    • RDSマネジメントコンソールのEvents画面で、DBインスタンスのリブート完了を確認できます
      RDS_04_Apply_02

まとめ

現証明書の期限まで時間的余裕が少なくなっています。クライアント側ー>RDS側との順序でアップデートする必要があるので、利用者・インフラ側のスケジュール調整に早めに着手する必要がありそうです。

また、RDSインスタンス側の変更については、即時適用を実施するか、次のメンテナンス期間に適用されるよう変更作業を行うかは、データベースの稼働実態に合わせて検討する必要があります。

参考資料

脚注

  1. AWSによるアナウンス

    Dear Amazon RDS Customer,

    This message provides specific instructions for you to perform in order to avoid interruption to your database connectivity, if your applications are using SSL to connect to your RDS instances in any AWS regions excepting China (Beijing) and AWS GovCloud (US).

    As part of AWS’s standard maintenance and security best practices for RDS, the SSL certificate for RDS instances is updated every few years. The next update for the SSL certificate for your RDS instances is scheduled on 23 Mar 2015. If your application uses SSL to connect to your RDS instance (whether it is Single-AZ or Multi-AZ), you MUST follow the steps below to use the new certificate bundle BEFORE 23 Mar 2015 20:00 UTC, otherwise, your applications may fail to connect to your RDS instances after that time. We strongly encourage you to test these steps within a development / staging environment before following them for your production environments.

    Step 1: Download the new combined certificate bundle here http://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem.

    Step 2: Update your database clients/applications to use the new certificate bundle.

    Step 3: Use the Modify operation for your RDS instance on the AWS Management Console (or the ModifyDBInstance API) and change the Certificate Authority from rds-ca-2010 to rds-ca-2015. Specify the Apply Immediately option. This step will update the SSL certificate on the database instance and initiate a reboot operation to have the certificate take effect. Note that the reboot operation typically takes less than two minutes to complete. In some cases such as when there are a large number of tables in a database, it could take longer. Refer to Amazon RDS best practices to learn more: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_BestPractices.html.

    To learn more about these steps, refer to http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html.

    Sincerely,
    The Amazon RDS Team

    Announcement: Action Required for SSL users by 23 Mar 2015

  2. SSL証明書情報抜粋

        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon.com, OU=RDS, CN=aws.amazon.com/rds/
            Validity
                Not Before: Apr  5 22:44:31 2010 GMT
                Not After : Apr  4 22:44:31 2015 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon.com, OU=RDS, CN=aws.amazon.com/rds/
    --
    --
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
            Validity
                Not Before: Feb  5 09:11:31 2015 GMT
                Not After : Mar  5 09:11:31 2020 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
    --
    --
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
            Validity
                Not Before: Feb  5 22:03:06 2015 GMT
                Not After : Mar  5 22:03:06 2020 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS ap-northeast-1 CA
    --
    --
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
            Validity
                Not Before: Feb  5 22:03:19 2015 GMT
                Not After : Mar  5 22:03:19 2020 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS ap-southeast-1 CA
    --
    --
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
            Validity
                Not Before: Feb  5 22:03:24 2015 GMT
                Not After : Mar  5 22:03:24 2020 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS ap-southeast-2 CA
    --
    --
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
            Validity
                Not Before: Feb  5 22:03:31 2015 GMT
                Not After : Mar  5 22:03:31 2020 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS eu-central-1 CA
    --
    --
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
            Validity
                Not Before: Feb  5 22:03:35 2015 GMT
                Not After : Mar  5 22:03:35 2020 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS eu-west-1 CA
    --
    --
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
            Validity
                Not Before: Feb  5 22:03:40 2015 GMT
                Not After : Mar  5 22:03:40 2020 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS sa-east-1 CA
    --
    --
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
            Validity
                Not Before: Feb  5 21:54:04 2015 GMT
                Not After : Mar  5 21:54:04 2020 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS us-east-1 CA
    --
    --
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
            Validity
                Not Before: Feb  5 22:03:45 2015 GMT
                Not After : Mar  5 22:03:45 2020 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS us-west-1 CA
    --
    --
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS Root CA
            Validity
                Not Before: Feb  5 22:03:50 2015 GMT
                Not After : Mar  5 22:03:50 2020 GMT
            Subject: C=US, ST=Washington, L=Seattle, O=Amazon Web Services, Inc., OU=Amazon RDS, CN=Amazon RDS us-west-2 CA

  3. 認証局(CA)の更新予定の確認方法
    Java版CLIであるRDS CLIの最新版(1.19.003)で確認できるとのことです。(ダウンロードページ
    rds-describe-db-instancesコマンド実行した際、PendingCACertificateIdentifierパラメータに値が入っている場合は、次回メンテナンス期間に適用のためのリブートが実行されます。