発行済みの証明書をTomcatサーバーにダウンロードしてインストールできます。 Tomcatサーバーは、PFX証明書とJKS証明書の2種類の証明書をサポートしています。
You can download a PFX certificate or a JKS certificate based on your Tomcat version.
This topic describes how to download and install a PFX certificate on a Tomcat server.
始める前に
- You are logged on to your Tomcat server.
- Tomcatサーバーのポート443が有効になっています。 ポート443は、HTTPSサービスのデフォルトポートです。
- OpenSSLツールがインストールされています。 OpenSSL公式Webサイトにアクセスして、OpenSSLツールをダウンロードしてインストールできます。
- Tomcatサーバーにインストールする証明書がコンピューターにダウンロードされます。 証明書のダウンロード方法の詳細については、「証明書をコンピューターにダウンロードする」をご参照ください。
重要
- 証明書を申請するときにCSR生成を自動に設定しないと、ダウンロードした証明書パッケージにTXTパスワードファイルが含まれません。 In this case, you must download a CRT
certificate for servers of the Other type and then use the OpenSSL tool to convert the certificate to the PFX format.
- PFX形式ではない証明書がある場合は、OpenSSLツールを使用して証明書をPFX形式に変換できます。
背景情報
このトピックでは、Linuxオペレーティングシステムを実行するTomcat 7サーバーにPFX証明書をインストールする方法の例を示します。
手順
- Decompress the downloaded certificate package.
The following files are obtained:
- 証明書ファイル: ドメイン名pfx
- パスワードファイル: pfx-password.txt
注 A new password is generated each time you download a certificate. パスワードはダウンロードした証明書に対してのみ有効です。
If you want to update a certificate, you must also update the password.
- Create the cert directory in the installation directory of Tomcat and copy the certificate file and
password file that you obtained to the cert directory.
注 インストールディレクトリは、サーバーの環境によって異なります。 sudo find / -name * tomcat *
コマンドを実行して、インストールディレクトリを照会できます。
- 設定ファイルserver.xmlを変更して保存します。 The configuration file is stored in Tomcat installation directory/conf/server.xml.
次のいずれかの方法を使用して、SSL実装を指定できます。
重要 方法1を使用してSSLコネクタの設定を変更すると、Tomcatサーバーは自動的にSSL実装を選択します。 方法1を使用しても後続の設定を完了できない場合、サーバーの環境はSSL実装の自動選択をサポートしていない可能性があります。
この場合、方法2を使用して、環境に基づいてSSL実装を手動で指定できます。
- 方法1: Tomcatサーバーは自動的にSSL実装を選択します。
次のコードに基づいてSSLコネクタの属性を変更します。
<Connector port="443"# ビジネス要件に基づいてポートを変更します。 ポート443は、HTTPSサービスのデフォルトポートです。 別のポートを使用する場合は、https:// domain name: portを使用してWebサイトにアクセスする必要があります。
protocol="HTTP/1.1"
SSLEnabled="true"
scheme="https"
secure="true"
keystoreFile=" Tomcatインストールディレクトリ /cert/ domain name .pfx"# 証明書名の前に証明書の絶対パスを追加します。 ドメイン名を証明書ファイルの名前に置き換えます。
keystoreType="PKCS12"
keystorePass=" 証明書パスワード "# pfx-password.txtファイルに内容を入力します。
clientAuth="false"
SSLProtocol="TLSv1.1+TLSv1.2+TLSv1.3"
ciphers="TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256"/>
- Method 2: Manually specify SSL implementation.
Remove the comments of the following code in the
server.xml file and specify JSSE-based SSL implementation:
<コネクタ
protocol="org.apache.coyote.http11.Http11NioProtocol"
port="443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile=" Tomcatインストールディレクトリ /cert/ domain name .pfx" keystorePass=" 証明書パスワード"
clientAuth="false" sslProtocol="TLS"/>
- オプション:HTTPリクエストをHTTPSリクエストにリダイレクトするようにweb.xmlファイルを設定します。
次のコンテンツを
</welcome-file-list> ファイルに追加します。
<login-config>
<!-- SSLの認証設定 -->
<auth-method>CLIENT-CERT</auth-method>
<realm-name> クライアントCertユーザー専用エリア </realm-name>
</login-config>
<security-constraint>
<!-- SSLの認証設定 -->
<web-resource-collection >
<web-resource-name>Project name</web-resource-name> # Replace Project name with the name of your project.
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
- Tomcatサーバーを再起動します。
- Run the following command to stop your Tomcat server:
- 次のコマンドを実行して、Tomcatサーバーを起動します。
次の手順
上記の操作を完了すると、証明書にバインドされているドメイン名にアクセスして、証明書がインストールされているかどうかを確認できます。
https:// domain name# domain nameを証明書にバインドされているドメイン名に置き換えます。
- アドレスバーにロックアイコンが表示された場合、証明書がインストールされます。
- HTTPS経由でWebサイトにアクセスできない場合は、証明書がインストールされているサーバーでポート443が有効になっているかどうかを確認します。