IBM Cloud の Cloud Foundry で使える無料の Let's Encrypt SSL 証明書を取得する

#必要なもの

- [IBM Cloud アカウント](https://cloud.ibm.com/registration)
- [IBM Cloud CLI](https://cloud.ibm.com/docs/cli?topic=cloud-cli-ibmcloud-cli#overview)
- 名前解決できるドメイン
    - 例）[freenomでドメインの取得 - Qiita](https://qiita.com/hanbaga324/items/da0c4f6fa8d365db10c9)
    - その後、DNSで名前解決してhttpでページが表示できるようにしておきます
    - IBM Cloud の CloudFoundry にカスタムドメインを使用するには、以下のリンク先にあるエンドポイントをCNAMEで設定してください。
        - [Adding and using a custom domain](https://cloud.ibm.com/docs/apps?topic=creating-apps-updatingapps#updatingapps)
        - 例えばこのように設定します。![image.png](https://qiita-image-store.s3.amazonaws.com/0/101361/4244a872-a09d-f1ea-6c91-59240c7834a0.png)



#参考
[ibmjstart/bluemix-letsencrypt: Let's Encrypt wrapper for Cloud Foundry apps on IBM Bluemix](https://github.com/ibmjstart/bluemix-letsencrypt)

#手順
以下のファイルをクローンします。

```
git clone https://github.com/ibmjstart/bluemix-letsencrypt
cd bluemix-letsencrypt
```

動かすためのライブラリ等をインストールします。

```
pip install --upgrade pip
pip install requests pyyaml
```

SSL 証明書を取得したいドメインのために用意する `json` ファイルを編集します。

>注意：この方法では、ワイルドカード証明書は取得できません。

```
cp domains.json.example domains.json
vi domains.json
```

有効なメールアドレスにしないと、エラーが出るので注意してください。

```json:domains.json
{
  "email": "xxx@example.com",
  "staging": false,
  "domains": [
    {
      "domain": "example.com",
      "hosts": [
        ".",
        "www"
      ]
    }
  ]
}
```

CLI を使って IBM Cloud にログインします。

```
ibmcloud login
``` 

または 

```
ibmcloud login --sso
```

まず Cloud Foundry 組織/スペースを対話式にターゲットにします。

```
ibmcloud target --cf
```

先ほど `clone` したファイル内にあったスクリプトをキックします。

```
python setup-app.py
```

以下、実行結果になります。

```
'cf push --no-start' を起動しています...

xxx@example.com としてマニフェストから組織 khayama-org / スペース khayama-au にプッシュしています...
マニフェスト・ファイル /Users/kyouhei/github/bluemix-letsencrypt/manifest.yml を使用しています
Deprecation warning: Use of 'buildpack' attribute in manifest is deprecated in favor of 'buildpacks'. Please see http://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#deprecated for alternatives and other app manifest deprecations. This feature will be removed in the future.

アプリ情報を取得しています...
これらの属性でアプリを作成しています...
+ 名前:           letsencrypt
  パス:           /Users/kyouhei/github/bluemix-letsencrypt
  ビルドパック:
+   python_buildpack
+ コマンド:       python run.py
+ インスタンス:   1
+ メモリー:       128M

アプリ letsencrypt を作成しています...
ローカル・ファイルをリモート・キャッシュと比較しています...
Packaging files to upload...
ファイルをアップロードしています...
 6.95 KiB / 6.95 KiB [===========================================================================================================] 100.00% 1s

API がファイルの処理を完了するのを待機しています...

名前:                   letsencrypt
要求された状態:         stopped
経路:                   
最終アップロード日時:   
スタック:               
ビルドパック:           

タイプ:           web
インスタンス:     0/1
メモリー使用量:   128M
開始コマンド:     python run.py
     状態     開始日時               cpu    メモリー     ディスク     詳細
#0   ダウン   2019-03-23T12:21:04Z   0.0%   0 の中の 0   0 の中の 0   

'cf map-route letsencrypt example.com --path .well-known/acme-challenge/' を起動しています...

xxx@example.com として組織 khayama-org / スペース khayama-au の経路 example.com/.well-known/acme-challenge/ を作成しています...
OK
xxx@example.com として経路 example.com/.well-known/acme-challenge/ を組織 khayama-org / スペース khayama-au 内のアプリ letsencrypt に追加しています...
OK
'cf map-route letsencrypt example.com --hostname www --path .well-known/acme-challenge/' を起動しています...

xxx@example.com として組織 khayama-org / スペース khayama-au の経路 www.example.com/.well-known/acme-challenge/ を作成しています...
OK
xxx@example.com として経路 www.example.com/.well-known/acme-challenge/ を組織 khayama-org / スペース khayama-au 内のアプリ letsencrypt に追加しています...
OK
'cf start letsencrypt' を起動しています...

xxx@example.com として組織 khayama-org / スペース khayama-au 内のアプリ letsencrypt を開始しています...

アプリをステージングし、ログをトレースしています...
   Downloading python_buildpack...
   Downloaded python_buildpack
   Cell 7b56a9d9-5376-48cd-a634-c79d49c6f9cf creating container for instance 0b0cfc39-216f-4f35-a738-518404bb7be0
   Cell 7b56a9d9-5376-48cd-a634-c79d49c6f9cf successfully created container for instance 0b0cfc39-216f-4f35-a738-518404bb7be0
   Downloading app package...
   Downloaded app package (6.8K)
   -----> Python Buildpack version 1.6.11
   -----> Supplying Python
   -----> Installing python 3.6.4
          Download [https://buildpacks.cloudfoundry.org/dependencies/python/python-3.6.4-linux-x64-8932d266.tgz]
   -----> Installing setuptools 38.5.2
          Download [https://buildpacks.cloudfoundry.org/dependencies/setuptools/setuptools-38.5.2-8246123e.zip]
   -----> Installing pip 9.0.1
          Download [https://buildpacks.cloudfoundry.org/dependencies/manual-binaries/pip/pip-9.0.1-35f01da3.tar.gz]
   -----> Installing pip-pop 0.1.1
          Download [https://buildpacks.cloudfoundry.org/dependencies/manual-binaries/pip-pop/pip-pop-0.1.1-d410583a.tar.gz]
   -----> Installing pipenv 11.1.4
          Download [https://buildpacks.cloudfoundry.org/dependencies/pipenv/pipenv-v11.1.4-7394418e.tgz]
   -----> Noticed dependency requiring libffi. Bootstrapping libffi.
   -----> Installing libffi 3.2.1
          Download [https://buildpacks.cloudfoundry.org/dependencies/manual-binaries/python/libffi-3.2.1-linux-x64-5f5bf32c.tgz]
   -----> Running Pip Install
          Collecting cffi>=0.8.0 (from -r /tmp/contents006447639/deps/0/requirements.txt (line 1))
            Downloading https://files.pythonhosted.org/packages/20/f7/87b62a8895bf7c93e907b05b97bc4459c81a38a61151f03a6eae13d863aa/cffi-1.12.2-cp36-cp36m-manylinux1_x86_64.whl (428kB)
          Collecting letsencrypt>=0.7.0 (from -r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/28/ca/cf17ceca2d8caf8f93ea844bd862ad3f595a796648958ae6c5faf846e354/letsencrypt-0.7.0.tar.gz
          Collecting six>=1.7 (from -r /tmp/contents006447639/deps/0/requirements.txt (line 3))
            Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
          Collecting pyyaml>=3.11 (from -r /tmp/contents006447639/deps/0/requirements.txt (line 4))
            Downloading https://files.pythonhosted.org/packages/9f/2c/9417b5c774792634834e730932745bc09a7d36754ca00acf1ccd1ac2594d/PyYAML-5.1.tar.gz (274kB)
          Collecting pip>=19.0.3 (from -r /tmp/contents006447639/deps/0/requirements.txt (line 5))
            Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
          Collecting pycparser (from cffi>=0.8.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 1))
            Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB)
          Collecting certbot (from letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/08/9a/6592046d1755a876a9b564be4ace4926ca8b6b38c9d7e916c01f15559674/certbot-0.32.0-py2.py3-none-any.whl (325kB)
          Collecting zope.component (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/97/e2/c785df1171f277ea93cc16bdcc112cb3ddfde1aeefbc401d46c49727f472/zope.component-4.5-py2.py3-none-any.whl (70kB)
          Collecting josepy>=1.1.0 (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/23/46/30ac29742b03be92e05d1fd9048df6f0902bb0b3b042a7ea76a2b3c30f7e/josepy-1.1.0-py2.py3-none-any.whl (53kB)
          Collecting zope.interface (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/19/17/1d198a6aaa9aa4590862fe3d3a2ed7dd808050cab4eebe8a2f2f813c1376/zope.interface-4.6.0-cp36-cp36m-manylinux1_x86_64.whl (167kB)
          Collecting acme>=0.29.0 (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/cf/b3/2ea67d26dbe8eaa9e324ba8f2ca968ed78e3dda4aef263e2c35b116fb789/acme-0.32.0-py2.py3-none-any.whl (86kB)
          Collecting ConfigArgParse>=0.9.3 (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/55/ea/f0ade52790bcd687127a302b26c1663bf2e0f23210d5281dbfcd1dfcda28/ConfigArgParse-0.14.0.tar.gz
          Collecting pyrfc3339 (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/c1/7a/725f5c16756ec6211b1e7eeac09f469084595513917ea069bc023c40a5e2/pyRFC3339-1.1-py2.py3-none-any.whl
          Collecting pytz (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/61/28/1d3920e4d1d50b19bc5d24398a7cd85cc7b9a75a490570d5a30c57622d34/pytz-2018.9-py2.py3-none-any.whl (510kB)
          Collecting setuptools (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/d1/6a/4b2fcefd2ea0868810e92d519dacac1ddc64a2e53ba9e3422c3b62b378a6/setuptools-40.8.0-py2.py3-none-any.whl (575kB)
          Collecting mock (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl (56kB)
          Collecting configobj (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/64/61/079eb60459c44929e684fa7d9e2fdca403f67d64dd9dbac27296be2e0fab/configobj-5.0.6.tar.gz
          Collecting cryptography>=1.2.3 (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/5b/12/b0409a94dad366d98a8eee2a77678c7a73aafd8c0e4b835abea634ea3896/cryptography-2.6.1-cp34-abi3-manylinux1_x86_64.whl (2.3MB)
          Collecting parsedatetime>=1.3 (from certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/e3/b3/02385db13f1f25f04ad7895f35e9fe3960a4b9d53112775a6f7d63f264b6/parsedatetime-2.4.tar.gz (58kB)
          Collecting zope.deferredimport>=4.2.1 (from zope.component->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/62/d2/e03e4b0c9103817e19d1ea577c1f7fb9b67e4c0397ca5127d377e1eafe0c/zope.deferredimport-4.3-py2.py3-none-any.whl
          Collecting zope.event (from zope.component->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/c5/96/361edb421a077a4c208b4a5c212737d78ae03ce67fbbcd01621c49f332d1/zope.event-4.4-py2.py3-none-any.whl
          Collecting zope.deprecation>=4.3.0 (from zope.component->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/f9/26/b935bbf9d27e898b87d80e7873a0200cebf239253d0afe7a59f82fe90fff/zope.deprecation-4.4.0-py2.py3-none-any.whl
          Collecting zope.hookable>=4.2.0 (from zope.component->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/41/b5/378175b959565de41f45c775cdfbf8897aaeaf29a258b94e40bd2661ce46/zope.hookable-4.2.0.tar.gz
          Collecting PyOpenSSL>=0.13 (from josepy>=1.1.0->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/01/c8/ceb170d81bd3941cbeb9940fc6cc2ef2ca4288d0ca8929ea4db5905d904d/pyOpenSSL-19.0.0-py2.py3-none-any.whl (53kB)
          Collecting requests-toolbelt>=0.3.0 (from acme>=0.29.0->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/60/ef/7681134338fc097acef8d9b2f8abe0458e4d87559c689a8c306d0957ece5/requests_toolbelt-0.9.1-py2.py3-none-any.whl (54kB)
          Collecting requests[security]>=2.6.0 (from acme>=0.29.0->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl (57kB)
          Collecting pbr>=0.11 (from mock->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/14/09/12fe9a14237a6b7e0ba3a8d6fcf254bf4b10ec56a0185f73d651145e9222/pbr-5.1.3-py2.py3-none-any.whl (107kB)
          Collecting asn1crypto>=0.21.0 (from cryptography>=1.2.3->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
          Collecting future (from parsedatetime>=1.3->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/90/52/e20466b85000a181e1e144fd8305caf2cf475e2f9674e797b222f8105f5f/future-0.17.1.tar.gz (829kB)
          Collecting zope.proxy (from zope.deferredimport>=4.2.1->zope.component->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/7c/f5/e9ed65cdf8c93d24d7512ef89e21b241bc9ae75d90bc8608cc142f4c26f9/zope.proxy-4.3.1.tar.gz (43kB)
          Collecting chardet<3.1.0,>=3.0.2 (from requests[security]>=2.6.0->acme>=0.29.0->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
          Collecting idna<2.9,>=2.5 (from requests[security]>=2.6.0->acme>=0.29.0->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
          Collecting certifi>=2017.4.17 (from requests[security]>=2.6.0->acme>=0.29.0->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/60/75/f692a584e85b7eaba0e03827b3d51f45f571c2e793dd731e598828d380aa/certifi-2019.3.9-py2.py3-none-any.whl (158kB)
          Collecting urllib3<1.25,>=1.21.1 (from requests[security]>=2.6.0->acme>=0.29.0->certbot->letsencrypt>=0.7.0->-r /tmp/contents006447639/deps/0/requirements.txt (line 2))
            Downloading https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl (118kB)
          Installing collected packages: pycparser, cffi, setuptools, zope.interface, zope.proxy, zope.deferredimport, zope.event, zope.deprecation, zope.hookable, zope.component, asn1crypto, six, cryptography, PyOpenSSL, josepy, chardet, idna, certifi, urllib3, requests, requests-toolbelt, pytz, pyrfc3339, pbr, mock, acme, ConfigArgParse, configobj, future, parsedatetime, certbot, letsencrypt, pyyaml, pip
            Running setup.py install for pycparser: started
              Running setup.py install for pycparser: finished with status 'done'
            Running setup.py install for zope.proxy: started
              Running setup.py install for zope.proxy: finished with status 'done'
            Running setup.py install for zope.hookable: started
              Running setup.py install for zope.hookable: finished with status 'done'
            Running setup.py install for ConfigArgParse: started
              Running setup.py install for ConfigArgParse: finished with status 'done'
            Running setup.py install for configobj: started
              Running setup.py install for configobj: finished with status 'done'
            Running setup.py install for future: started
              Running setup.py install for future: finished with status 'done'
            Running setup.py install for parsedatetime: started
              Running setup.py install for parsedatetime: finished with status 'done'
            Running setup.py install for letsencrypt: started
              Running setup.py install for letsencrypt: finished with status 'done'
            Running setup.py install for pyyaml: started
              Running setup.py install for pyyaml: finished with status 'done'
          Successfully installed ConfigArgParse-0.14.0 PyOpenSSL-19.0.0 acme-0.32.0 asn1crypto-0.24.0 certbot-0.32.0 certifi-2019.3.9 cffi-1.12.2 chardet-3.0.4 configobj-5.0.6 cryptography-2.6.1 future-0.17.1 idna-2.8 josepy-1.1.0 letsencrypt-0.7.0 mock-2.0.0 parsedatetime-2.4 pbr-5.1.3 pip-19.0.3 pycparser-2.19 pyrfc3339-1.1 pytz-2018.9 pyyaml-5.1 requests-2.21.0 requests-toolbelt-0.9.1 setuptools-40.8.0 six-1.12.0 urllib3-1.24.1 zope.component-4.5 zope.deferredimport-4.3 zope.deprecation-4.4.0 zope.event-4.4 zope.hookable-4.2.0 zope.interface-4.6.0 zope.proxy-4.3.1
   Traceback (most recent call last):
     File "/tmp/contents006447639/deps/0/bin/pip-grep", line 12, in <module>
       from pip.req import parse_requirements
   ModuleNotFoundError: No module named 'pip.req'
   No start command specified by buildpack or via Procfile.
   App will not start unless a command is provided at runtime.
   Exit status 0
   Uploading droplet, build artifacts cache...
   Uploading droplet...
   Uploading build artifacts cache...
   Uploaded build artifacts cache (59.6M)
   Uploaded droplet (64.8M)
   Uploading complete
   Cell 7b56a9d9-5376-48cd-a634-c79d49c6f9cf stopping instance 0b0cfc39-216f-4f35-a738-518404bb7be0

アプリが開始するのを待機しています...
   Cell 7b56a9d9-5376-48cd-a634-c79d49c6f9cf destroying container for instance 0b0cfc39-216f-4f35-a738-518404bb7be0

名前:                   letsencrypt
要求された状態:         started
経路:                   example.com/.well-known/acme-challenge, www.example.com/.well-known/acme-challenge
最終アップロード日時:   Sat 23 Mar 21:20:42 JST 2019
スタック:               cflinuxfs2
ビルドパック:           python

タイプ:           web
インスタンス:     1/1
メモリー使用量:   128M
開始コマンド:     python run.py
     状態   開始日時               cpu    メモリー          ディスク         詳細
#0   実行   2019-03-23T12:23:00Z   0.0%   128M の中の 37M   1G の中の 228M   
Parsing log files.
Waiting for certs...
Certs not ready yet, retrying in 5 seconds.
Running: bx --quiet cf ssh letsencrypt -c "cat ~/app/conf/live/example.com/cert.pem"
Running: bx --quiet cf ssh letsencrypt -c "cat ~/app/conf/live/example.com/chain.pem"
Running: bx --quiet cf ssh letsencrypt -c "cat ~/app/conf/live/example.com/fullchain.pem"
Running: bx --quiet cf ssh letsencrypt -c "cat ~/app/conf/live/example.com/privkey.pem"
失敗
ドメインの証明書 'example.com' が見つかりませんでした。

Making GET request to https://example.com
HTTPSConnectionPool(host='example.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: TLSV1_UNRECOGNIZED_NAME] tlsv1 unrecognized name (_ssl.c:590)'),))
'cf stop letsencrypt' を起動しています...

xxx@example.com として組織 khayama-org / スペース khayama-au 内のアプリ letsencrypt を停止しています...
OK
Attempting certificate upload...
ドメイン 'example.com' に証明書をアップロードしています...
OK
証明書はドメイン 'example.com' にアップロードされました。

å°å au-syd ã®ãã¡ã¤ã³ example.com ã®è¨¼ææ¸æå ±ãåå¾ãã¦ãã¾ã...
OK
                                                   
è¨¼ææ¸:                                            
              ãã¼ã¸ã§ã³:                       3   
              ã·ãªã¢ã«çªå·:                     331139779649743384452714831584777338846735   
              ãµãã¸ã§ã¯ã:                     CN=example.com   
              çºè¡è:                           C=US, CN=Let's Encrypt Authority X3, O=Let's Encrypt   
              æ¬¡ã®æ¥æä»¥é:                     2019-03-23T11:21:11Z   
              æ¬¡ã®æ¥æä»¥å:                     2019-06-21T11:21:11Z   
              ç½²åã¢ã«ã´ãªãºã :                 sha256WithRSAEncryption   
              ãµãã¸ã§ã¯ãå¬ééµã¢ã«ã´ãªãºã :   rsaEncryption   
              ãµãã¸ã§ã¯ãå¬ééµãããé·:       2048   
ä¸­éè¨¼ææ¸:                                        
              ãã¼ã¸ã§ã³:                       3   
              ã·ãªã¢ã«çªå·:                     13298795840390663119752826058995181320   
              ãµãã¸ã§ã¯ã:                     C=US, O=Let's Encrypt, CN=Let's Encrypt Authority X3   
              çºè¡è:                           O=Digital Signature Trust Co., CN=DST Root CA X3   
              æ¬¡ã®æ¥æä»¥é:                     2016-03-17T16:40:46Z   
              æ¬¡ã®æ¥æä»¥å:                     2021-03-17T16:40:46Z   
              ç½²åã¢ã«ã´ãªãºã :                 sha256WithRSAEncryption   
              ãµãã¸ã§ã¯ãå¬ééµã¢ã«ã´ãªãºã :   rsaEncryption   
              ãµãã¸ã§ã¯ãå¬ééµãããé·:       2048   


Warning: Please note that your SSL certificate, its corresponding PRIVATE KEY, and its intermediate certificates have been downloaded to the current working directory. If you need to remove them, use `rm *.pem`
Upload Succeeded
```

#確認
bluemix-letsencryptフォルダに証明書関連のファイルがダウンロードされたことが確認できます。

```
ls *.pem
cert.pem	chain.pem	fullchain.pem	privkey.pem
```

https://cloud.ibm.com/ から
Manage > Account > Cloud Foundry orgs > 組織名 > Domains タブ から証明書がアップロードされたことが確認できます。

また、アプリの Edit routes からもhttps通信が有効化できていることがわかります。
![image.png](https://qiita-image-store.s3.amazonaws.com/0/101361/6a0736e7-a3a5-f270-d660-cef2c532a73a.png)