メインコンテンツ

このページは機械翻訳を使用して翻訳されました。最新版の英語を参照するには、ここをクリックします。

webapps-secrets

WindowsLinuxmacOS システムでウェブ アプリ サーバーのシークレットを管理する

R2024a 以降

説明

webapps-secrets set keyName keyValue [--mode Overwrite|FailIfExists] は値 keyValue をシークレット keyName に割り当て、キーを vault に追加します。オプションで、keyName を上書きするか、キーがすでに存在する場合は中止するかを設定できます。

webapps-secrets remove keyName keyValue [--scope scopeValue] は vault からシークレット keyName を削除します。

webapps-secrets set-attributes --secret-key keyName [attrName attrValue] [--scope scopeValue] [--mode Add|Merge|Replace] は、シークレット keyName の属性を設定します。オプションで、キーに新しい属性を追加するか、新しい属性と既存の属性をマージするか、既存のすべての属性を新しい属性に置き換えるかを構成できます。

webapps-secrets get-attributes --secret-key keyName [--scope scopeValue] は、keyName という名前のシークレットの属性を返します。

webapps-secrets list [--scope scopeValue] は、スコープ scopeValue 内で現在設定されているすべての秘密鍵を一覧表示します。

webapps-secrets listAll は、すべてのスコープ内で現在設定されているすべての秘密鍵を一覧表示します。

webapps-secrets --help はコマンドのヘルプ テキストを表示します。

webapps-secrets --version はコマンドのバージョン情報を表示します。

特定の秘密鍵の値を設定する

特定の秘密鍵の値を設定するには、システム コマンド ラインで次のように入力します。

webapps-secrets set mypassword hunter2
Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml
MATLAB Web App Server secrets configuration has been updated.

シークレットが追加されたことを確認します。

webapps-secrets listAll
Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml
List of secret keys configured:
    scope:<default>, secret key:mypassword

サーバーからシークレットを削除する

既存の秘密鍵 mypassword をサーバーから削除するには、システム コマンド ラインで次のように入力します。

webapps-secrets remove mypassword 
Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml
MATLAB Web App Server secrets configuration has been updated.

秘密鍵の属性を設定する

属性は、秘密鍵と暗号化された値とともに webapps_secrets XML ファイルに保存される暗号化されていないメタデータです。

秘密鍵 myusername の値を設定するには、システム コマンド ラインで次のように入力します。

webapps-secrets set myusername mluser
Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml
MATLAB Web App Server secrets configuration has been updated.

秘密鍵 myusername の属性を設定するには、システム コマンド ラインで次のように入力します。

webapps-secrets set-attributes --secret-key myusername hostname myhost port 8080
Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml
MATLAB Web App Server secrets configuration has been updated.

--mode 演算子を使用して、秘密鍵の既存の属性を変更できます。

webapps-secrets set-attributes --secret-key myusername port 422 --mode Merge
Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml
MATLAB Web App Server secrets configuration has been updated.

秘密鍵の属性を取得する

秘密鍵 myusername の属性を取得するには、システム コマンド ラインで次のように入力します。

webapps-secrets get-attributes --secret-key myusername
Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml
List of secret keys configured:
    hostname --->myhost
    port --->422

スコープ別にシークレットを一覧表示する

特定のスコープを持つシークレットを設定するには、システム コマンド ラインで次のように入力します。

webapps-secrets set mysecret2 97e846a4-a913-4a26 --scope $UserID
Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml
MATLAB Web App Server secrets configuration has been updated.

スコープ $UserID を持つ現在設定されているすべての秘密鍵を一覧表示するには、システム コマンド ラインで次のように入力します。

webapps-secrets list --scope $UserID
Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml
List of secret keys configured:
    scope:$UserID, secret key:mysecret2

すべてのシークレットを一覧表示する

現在設定されているすべての秘密鍵を一覧表示するには、システム コマンド ラインで次のように入力します。

webapps-secrets listAll
Vault location:C:\ProgramData\MathWorks\webapps\R2025a\config\webapps_private\webapps_secrets.xml
List of secret keys configured:
    scope:<default>, secret key:myusername
    scope:$UserID, secret key:mysecret2

ヘルプテキストを表示

webapps-secrets ヘルプ テキストを印刷するには、システム コマンド ラインで次のように入力します。

webapps-secrets -h
Usage:
  webapps-secrets [--help | -h]
 Display this help message
  webapps-secrets [--version | -v]
 Display the version of MATLAB Web App Server
  webapps-secrets list  [--scope <value>]
 List currently configured secret keys
  webapps-secrets listAll
 List all currently configured secret keys in all scopes
  webapps-secrets set <key> <value> [--scope <value>] [--mode Overwrite|FailIfExists]
 Set a secret to MATLAB Web App Server
  webapps-secrets remove <key> [--scope <value>]
 Remove a secret key from MATLAB Web App Server
  webapps-secrets set-attributes --secret-key <secret_key> [<attr_key> <attr_value>] [--scope <value>] [--mode Add|Merge|Replace]    
 Set attributes of a secret to MATLAB Web App Server
  webapps-secrets get-attributes --secret-key <secret_key>  [--scope <value>]
 Get attributes of a secret from MATLAB Web App Server

表示バージョン

MATLAB® Web App Server™ のバージョン情報を出力するには、システム コマンド ラインで次のように入力します。

webapps-secrets -v
MATLAB Web App Server (R2025a)

入力引数

すべて折りたたむ

シークレットを識別するための秘密鍵名。一意の文字列として指定されます。名前にスペースが含まれている場合は、keyName を二重引用符で囲む必要があります (")。

シークレット名の末尾ではワイルドカード (*) がサポートされます。たとえば、"myapp1.*" です。

例: "my password"

文字列として指定された秘密鍵の値。値は暗号化され、MATLAB Web App Server vault に保存されます。getSecret (MATLAB) 関数を使用して、Web アプリから値を取得できます。

値にスペースが含まれている場合は、keyValue を二重引用符で囲む必要があります (")。

例: "AdL3DS2$CyMEgCQQCo9+BpMoYQJxRF+j6ctTi3"

スコープ値。任意の静的文字列またはマクロを含む文字列として指定されます。スコープでは、指定されたシークレットへのアクセスを許可するユーザー、グループ、または特定の Web アプリを指定できます。

次のマクロがサポートされています:

  • $UserID - ログオン セッションのユーザー ID。このマクロを使用するには、config/webapps_private ディレクトリに userinfo.json を含める必要があります。詳細については、ユーザーに基づいてWebアプリの動作をカスタマイズする を参照してください。

  • $AppName - CTF ファイル名とフォルダー名を含む Web アプリ名。

シークレットにデフォルト以外のスコープがある場合は、set-attributesget-attributeslist、または remove を呼び出すときに、--scope 引数を使用してスコープ値を指定する必要があります。

例: "$AppName.$UserID"

文字列として指定された属性名。属性は、秘密鍵名と暗号化された値とともに webapps_secrets XML ファイルに保存される暗号化されていないメタデータです。属性名は、attrValue によって指定された関連付けられた属性値を説明します。

例: port

文字列として指定される属性値。属性は、秘密鍵名と暗号化された値とともに webapps_secrets XML ファイルに保存される暗号化されていないメタデータです。属性値は、関連付けられた attrName によって記述されます。

例: 8080

詳細

すべて折りたたむ

バージョン履歴

R2024a で導入