1.5. WildFly Elytron ツールを使用したクレデンシャルストア操作


WildFly Elytron ツールを使用して、オフラインでクレデンシャルストアのさまざまな操作を実行できます。

1.5.1. WildFly Elytron ツールを使用した credential-store の作成

Elytron では、すべてのクレデンシャルタイプを保存できる credential-store をオフラインで作成できます。

手順

  • 以下のコマンドで、WildFly Elytron ツールを使用して credential-store を作成します。

    構文

    $ EAP_HOME/bin/elytron-tool.sh credential-store --create --location "<path_to_store_file>" --password <store_password>

    $ EAP_HOME/bin/elytron-tool.sh credential-store --create --location "../cred_stores/example-credential-store.jceks" --password storePassword
    Credential Store has been successfully created

    ストアのパスワードをコマンドに含めない場合は、この引数を省略して、プロンプトでパスワードを手動で入力してください。また、WildFly Elytron ツールで生成したマスキングされたパスワードを使用することもできます。マスクされたパスワードの生成については、Generating masked encrypted strings using the WildFly Elytron tool を参照してください。

1.5.2. Bouncy Castle プロバイダーを使用した credential-store の作成

Bouncy Castle プロバイダーを使用して credential-store を作成します。

前提条件

  • お使いの環境が Bouncy Castle を使用するように設定されていることを確認する。
注記

credential-storesecret-key-credential-store は同じ Elytron 機能 (org.wildfly.security.credential-store) を実装しているため、同じ名前を指定できません。

手順

  1. BCFKS (Bouncy Castle FIPS Keystore) のキーストアを定義します。FIPS とは Federal Information Processing Standards の略です。このキーストアがすでにある場合は、次のステップに進んでください。

    $ keytool -genkeypair -alias <key_pair_alias> -keyalg <key_algorithm> -keysize <key_size> -storepass <key_pair_and_keystore_password> -keystore <path_to_keystore> -storetype BCFKS -keypass <key_pair_and_keystore_password>
    重要

    キーストアの keypass 属性と storepass 属性が同一であることを確認してください。そうでない場合は、elytron サブシステムの BCFKS キーストアでは定義できません。

  2. credential-store のシークレットキーを生成します。

    $ keytool -genseckey -alias <key_alias> -keyalg <key_algorithm> -keysize <key_size> -keystore <path_to_keystore> -storetype BCFKS -storepass <key_and_keystore_password> -keypass <key_and_keystore_password>
  3. 以下のコマンドで、WildFly Elytron ツールを使用して credential-store を定義します。

    $ EAP_HOME/bin/elytron-tool.sh credential-store -c -a <alias> -x <alias_password> -p <key_and_keystore_password> -l <path_to_keystore> -u "keyStoreType=BCFKS;external=true;keyAlias=<key_alias>;externalPath=<path_to_credential_store>"

1.5.3. WildFly Elytron ツールを使用した secret-key-credential-store の作成

Elytron では、secret-key-credential-store をオフラインで作成し、SecretKeyCredential インスタンスを保存できます。

手順

  • 以下のコマンドで WildFly Elytron ツールを使用して PropertiesCredentialStore を作成します。

    構文

    $ EAP_HOME/bin/elytron-tool.sh credential-store --create --location "<path_to_store_file>" --type PropertiesCredentialStore

    $ bin/elytron-tool.sh credential-store --create --location=standalone/configuration/properties-credential-store.cs --type PropertiesCredentialStore
    Credential Store has been successfully created

1.5.4. WildFly Elytron ツールの credential-store 操作

WildFly Elytron ツールを使用して、次のようなさまざまな credential-store タスクを実行できます。

PasswordCredential の追加

次の WildFly Elytron ツールコマンドを使用して、PasswordCredential を credential-store に追加できます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "<path_to_store_file>" --password <store_password> --add <alias> --secret <sensitive_string>

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "../cred_stores/example-credential-store.jceks" --password storePassword --add examplePasswordCredential --secret speci@l_db_pa$$_01
Alias "examplePasswordCredential" has been successfully stored

コマンドにシークレットを指定しない場合は、この引数を省略して、プロンプトが表示されたら手動でシークレットを入力します。

SecretKeyCredential の生成

次の WildFly Elytron ツールコマンドを使用して、SecretKeyCredential を credential-store に追加できます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --generate-secret-key=example --location=<path_to_the_credential_store> --password <store_password>

$ EAP_HOME/bin/elytron-tool.sh credential-store --generate-secret-key=example --location "../cred_stores/example-credential-store.jceks" --password storePassword
Alias "example" has been successfully stored

コマンドにシークレットを指定しない場合は、この引数を省略して、プロンプトが表示されたら手動でシークレットを入力します。

デフォルトでは、JBoss EAP で SecretKeyCredential を作成すると、256 ビットの秘密鍵が作成されます。サイズを変更する場合は、--size=128 または --size=192 を指定すると、それぞれ 128 ビット、192 ビットの鍵を作成できます。

SecretKeyCredential のインポート

SecretKeyCredential のインポートは、以下の WildFly Elytron ツールのコマンドで行うことができます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --import-secret-key=imported --location=<path_to_credential_store> --password=<store_password>

$ EAP_HOME/bin/elytron-tool.sh credential-store --import-secret-key=imported --location=../cred_stores/example-credential-store.jceks --password=storePassword

インポートする秘密鍵を入力します。

すべてのクレデンシャルのリスト表示

次の WildFly Elytron ツールコマンドを使用して、credential-store 内のクレデンシャルをリスト表示できます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "<path_to_store_file>" --password <store_password> --aliases

以下に例を示します。

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "../cred_stores/example-credential-store.jceks" --password storePassword --aliases
Credential store contains following aliases: examplepasswordcredential example

エイリアスが存在するかどうかの確認

クレデンシャルストアにエイリアスが存在するかどうかを確認するには、次のコマンドを使用します。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "<path_to_store_file>" --password <store_password> --exists <alias>

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "../cred_stores/example-credential-store.jceks" --password storePassword --exists examplepasswordcredential
Alias "examplepasswordcredential" exists

SecretKeyCredential のエクスポート

次のコマンドを使用して、credential-store から SecretKeyCredential をエクスポートできます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --export-secret-key=<alias> --location=<path_to_credential_store> --password=storePassword

$ EAP_HOME/bin/elytron-tool.sh credential-store --export-secret-key=example --location=../cred_stores/example-credential-store.jceks --password=storePassword
Exported SecretKey for alias example=RUxZAUtBiAnoLP1CA+i6DtcbkZHfybBJxPeS9mlVOmEYwjjmEA==

クレデンシャルの削除

以下のコマンドを使用して、クレデンシャルストアから認証情報を削除できます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "<path_to_store_file>" --password <store_password> --remove <alias>

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "../cred_stores/example-credential-store.jceks" --password storePassword --remove examplepasswordcredential
Alias "examplepasswordcredential" has been successfully removed

1.5.5. WildFly Elytron ツールの secret-key-credential-store 操作

以下のように、WildFly Elytron ツールを使って、SecretKeyCredential に対する secret-key-credential-store 操作を実行できます。

SecretKeyCredential の生成

次の WildFly Elytron ツールコマンドを使用して、SecteKeyCredentialsecret-key-credential-store に生成できます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --generate-secret-key=example --location "<path_to_the_credential_store>" --type PropertiesCredentialStore

$ EAP_HOME/bin/elytron-tool.sh credential-store --generate-secret-key=example --location "standalone/configuration/properties-credential-store.cs" --type PropertiesCredentialStore
Alias "example" has been successfully stored

SecretKeyCredential のインポート

SecretKeyCredential のインポートは、以下の WildFly Elytron ツールのコマンドで行うことができます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --import-secret-key=imported --location=<path_to_credential_store> --type PropertiesCredentialStore

$ EAP_HOME/bin/elytron-tool.sh credential-store --import-secret-key=imported --location "standalone/configuration/properties-credential-store.cs" --type PropertiesCredentialStore

すべてのクレデンシャルのリスト表示

次の WildFly Elytron ツールコマンドを使用して、secret-key-credential-store 内のクレデンシャルをリスト表示できます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "<path_to_store_file>"  --aliases --type PropertiesCredentialStore

$ EAP_HOME/bin/elytron-tool.sh credential-store  --location "standalone/configuration/properties-credential-store.cs" --aliases --type PropertiesCredentialStore
Credential store contains following aliases: example

SecretKeyCredential のエクスポート

次のコマンドを使用して、secret-key-credential-store から SecretKeyCredential をエクスポートできます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --export-secret-key=<alias> --location "<path_to_credential_store>"  --type PropertiesCredentialStore

$ EAP_HOME/bin/elytron-tool.sh credential-store --export-secret-key=example --location "standalone/configuration/properties-credential-store.cs" --type PropertiesCredentialStore
Exported SecretKey for alias example=RUxZAUt1EZM7PsYRgMGypkGirSel+5Eix4aSgwop6jfxGYUQaQ==

クレデンシャルの削除

以下のコマンドを使用して、クレデンシャルストアから認証情報を削除できます。

構文

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "<path_to_store_file>" --remove <alias> --type PropertiesCredentialStore

$ EAP_HOME/bin/elytron-tool.sh credential-store --location "standalone/configuration/properties-credential-store.cs"  --remove example --type PropertiesCredentialStore
Alias "example" has been successfully removed

1.5.6. WildFly Elytron Tool で作成された credential-store の JBoss EAP サーバーへの追加

WildFly Elytron ツールで credential-store を作成したら、実行中の JBoss EAP サーバーに追加できます。

前提条件

手順

  • 以下の管理 CLI コマンドを使用して、実行中の JBoss EAP サーバーにクレデンシャルストアを追加します。

    構文

    /subsystem=elytron/credential-store=<store_name>:add(location="<path_to_store_file>",credential-reference={clear-text=<store_password>})

    /subsystem=elytron/credential-store=my_store:add(location="../cred_stores/example-credential-store.jceks",credential-reference={clear-text=storePassword})

クレデンシャルストアを JBoss EAP 設定に追加することで、credential-reference 属性 を使用してクレデンシャルストアに保存されているパスワードまたは機密文字列を参照できます。

詳細は、EAP_HOME/bin/elytron-tool.sh credential-store --help コマンドを使用して、利用可能なオプションの詳細な一覧を表示してください。

1.5.7. WildFly Elytron ツールによるキーペア管理の操作

以下の引数を使用して、クレデンシャルストアのエイリアスに保存するキーペアを新規生成するなど、elytron-tool.sh を実行してクレデンシャルストアを操作できます。

キーペアの生成

generate-key-pair コマンドでキーペアを作成します。その後、キーペアをクレデンシャルストアのエイリアスのに保存できます。以下の例では、割り当てられたサイズが 3072 ビットの RSA キーペアを作成し、クレデンシャルストアに指定された場所に保存しています。キーペアに割り当てられたエイリアスは example です。

$ EAP_HOME/bin/elytron-tool.sh credential-store --location=<path_to_store_file> --generate-key-pair example --algorithm RSA --size 3072
キーペアのインポート

既存の SSH キーペアを、指定したエイリアスでクレデンシャルストアにインポートするには、import-key-pair コマンドを使用します。以下の例では、OpenSSH 形式の秘密鍵を含む /home/user/.ssh/id_rsa ファイルから example というエイリアスのキーペアをインポートしています。

$ EAP_HOME/bin/elytron-tool.sh credential-store --import-key-pair example --private-key-location /home/user/.ssh/id_rsa --location=<path_to_store_file>
キーペアのエクスポート

キーペアの公開鍵を表示するには、export-key-pair-public-key コマンドを使用します。公開鍵には、OpenSSH 形式のエイリアスが指定されています。以下の例では、エイリアス example の公開鍵を表示しています。

$ EAP_HOME/bin/elytron-tool.sh credential-store --location=<path_to_store_file> --export-key-pair-public-key example

Credential store password:
Confirm credential store password:
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMfncZuHmR7uglb0M96ieArRFtp42xPn9+ugukbY8dyjOXoi
cZrYRyy9+X68fylEWBMzyg+nhjWkxJlJ2M2LAGY=
注記

export-key-pair-public-key コマンドを実行すると、クレデンシャルストアのパスフレーズの入力が求められます。パスフレーズが存在しない場合は、プロンプトを空白にします。

1.5.8. Elytron の設定ファイルに保存されたキーペアの使用例

キーペアは対応する 2 つの個別の暗号化キー (公開鍵と秘密鍵) で構成されます。キーペアをクレデンシャルストアに保存してから、elytron の設定ファイルでキーペアを参照する必要があります。これにより、スタンドアロンサーバーの設定データ管理用のアクセス権を Git に割り当てることができます。

以下の例では、elytron の設定ファイルの <credential-stores> 要素でクレデンシャルストアとそのプロパティーを参照しています。<credential> 要素は、クレデンシャルストアとキーペアを格納するエイリアスを参照します。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <authentication-client xmlns="urn:elytron:client:1.6">

     <credential-stores>
        <credential-store name="${credential_store_name}">
           <protection-parameter-credentials>
              <clear-password password="${credential_store_password}"/>
           </protection-parameter-credentials>
           <attributes>
              <attribute name="path" value="${path_to_credential_store}"/>
           </attributes>
        </credential-store>
     </credential-stores>

     <authentication-rules>
        <rule use-configuration="${configuration_file_name}"/>
     </authentication-rules>

     <authentication-configurations>
        <configuration name="${configuration_file_name}">
           <credentials>
              <credential-store-reference store="${credential_store_name}" alias="${alias_of_key_pair}"/>
           </credentials>
        </configuration>
     </authentication-configurations>

  </authentication-client>
</configuration>

elytron 設定ファイルの設定後に、そのキーペアを SSH 認証に使用できます。

1.5.9. WildFly Elytron Tool を使用した、マスクされた文字列の生成

WildFly Elytron ツールで、クレデンシャルストアのプレーンテキストパスワードの代わりに使用する暗号化した文字列を生成できます。

手順

  • マスクされた文字列を生成するには、以下のコマンドを使用して salt および iteration count の値を指定します。

    $ EAP_HOME/bin/elytron-tool.sh mask --salt <salt> --iteration <iteration_count> --secret <password>

    以下に例を示します。

    $ EAP_HOME/bin/elytron-tool.sh mask --salt 12345678 --iteration 123 --secret supersecretstorepassword
    
    MASK-8VzWsSNwBaR676g8ujiIDdFKwSjOBHCHgnKf17nun3v;12345678;123

    コマンドでシークレットを指定しない場合は、その引数を省略し、標準入力を使用して手動でシークレットを入力するように求められます。

詳細は、EAP_HOME/bin/elytron-tool.sh mask --help コマンドを使用して、利用可能なオプションの詳細な一覧を表示してください。

Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る