HTTPS の設定
このタスクでは、自己署名証明書を使用する Spectrum Spatial サーバーとの HTTPS 通信を設定する手順について説明します。
Spectrum JDK を使用して以下の操作を行います。
C:\>set JAVA_HOME=JDK Folder Spectrum points to
C:\>set path=%JAVA_HOME%\bin;%path%
- キーストアおよび自己署名証明書を作成します。
C:\>keytool -genkeypair -alias client -keystore keystore.p12 -storetype pkcs12 -keyalg RSA -sigalg SHA256withRSA Enter keystore password: password Re-enter new password: password What is your first and last name? [Unknown]: Spectrum server hostname What is the name of your organizational unit? [Unknown]: Spectrum What is the name of your organization? [Unknown]: PB What is the name of your City or Locality? [Unknown]: What is the name of your State or Province? [Unknown]: What is the two-letter country code for this unit? [Unknown]: Is CN=Spectrum server hostname, OU=Spectrum, O=PB, L=Unknown, ST=Unknown, C=Unknown correct? [no]: yes
- 証明書を Spectrum キーストア spectrum-keystore.p12 にインポートします。
C:\>keytool -importkeystore -srckeystore keystore.p12 -destkeystore %SpectrumPath%\server\conf\certs\spectrum-keystore.p12 -destkeypass Spectrum keystorePassword Importing keystore keystore.p12 to client-keystore.p12... Enter destination keystore password: Enter source keystore password: Entry for alias client successfully imported. Import command completed: 1 entries successfully imported, 0 entries failed or cancelled
- Spectrum の spectrum-container.properties ファイルを変更します。
#Spectrum SSL Setting spectrum.encryption.enabled=true spectrum.encryption.trustAllHosts=true # Spectrum HTTP settings spectrum.http.default.protocol=https spectrum.https.port=8443 spectrum.https.enabled=true spectrum.https.encryption.validateCerts=false spectrum.https.encryption.selfSignedCert=true spectrum.https.encryption.trustAllHosts=true # specify the imported keystore alias spectrum.https.encryption.keystoreAlias=client (the same as the alias of keypair in step 1 (it should be in lowercase))
tilegenerator などの Spectrum Spatial ユーティリティを使用するには、手順 1 で作成するキーストアを trustStore と指定します。
JAVA_OPTS=-Djavax.net.ssl.trustStore=.\keystore.p12 -Djavax.net.ssl.trustStorePassword=password
実稼働環境で認証局 (CA) が署名した証明書を使用している場合は、手順 3 で validateCerts
パラメータを true に、selfSignedCert
パラメータを false に設定します。
spectrum.https.encryption.validateCerts=true
spectrum.https.encryption.selfSignedCert=false