Orchestrator
2022.4
バナーの背景画像
Orchestrator ユーザー ガイド
最終更新日 2024年4月19日

HashiCorp Vault との連携

HashiCorp Vault は、Orchestrator で資格情報ストアとして使用できるプラグインです。

次の 2 つのプラグインが含まれています。

  • HashiCorp Vault – 読み取り/書き込みプラグイン (シークレットは Orchestrator によって作成される)。
  • HashiCorp Vault (読み取り専用) – 読み取り専用プラグイン (シークレットは Vault で直接プロビジョニングする必要がある)。

前提条件

  • サポートされている、以下のいずれかの認証方法を設定する必要があります。

    • AppRole (推奨)
    • UsernamePassword
    • LDAP
    • トークン

      認証の設定方法については、こちらをご覧ください。

  • サポートされている、以下のいずれかのシークレット エンジンを設定する必要があります。

    • KeyValueV1 - HashiCorp Vault と HashiCorp Vault (読み取り専用) の両方のプラグインで使用できます。
    • KeyValueV2 - HashiCorp Vault と HashiCorp Vault (読み取り専用) の両方のプラグインで使用できます。
    • ActiveDirectory - HashiCorp Vault (読み取り専用) プラグインでのみ使用できます。
  • 選択した認証方法には、シークレットを保存するパスに対して以下の機能を許可するポリシーが設定されている必要があります。

    • HashiCorp Vault (読み取り専用) プラグイン: read
    • HashiCorp Vault プラグイン: createreadupdatedelete、および KeyValueV2 シークレット エンジンを使用する場合は、任意でメタデータ パスに対する delete

連携を構成する

以下に、Docker コンテナーで実行されている開発バージョンの HashiCorp Vault を、Orchestrator で資格情報ストアとして使用されるように設定する方法の例を示します。この例を、個々の環境に応じて調整する必要があります。HashiCorp Vault について詳しくは、公式ドキュメントをご覧ください。

認証を構成する

シークレットの作成と読み取りを開始するには、まず以下の手順を実行して、認証方法を設定する必要があります。

  1. コンテナー内でシェルを開きます。
    docker exec -it dev-vault shdocker exec -it dev-vault sh
  2. ルートとしてログインします。以下のコマンドを実行して、環境変数を設定するためのルート トークンがログに表示されていることを確認します。
    export VAULT_TOKEN=s.hA7RJ5lBqSnKUPd8nrQBaK1fexport VAULT_TOKEN=s.hA7RJ5lBqSnKUPd8nrQBaK1f
  3. 以下のコマンドを実行して、Vault のステータスを確認します。
    vault statusvault status
  4. Orchestrator のダミー シークレットを KV ストアに追加します。
    vault kv put secret/applications/orchestrator/testSecret supersecretpassword=123456vault kv put secret/applications/orchestrator/testSecret supersecretpassword=123456
  5. Orchestrator に、新たに作成された secret/applications/orchestrator パスへのアクセス権を付与します。それには、まず以下のコマンドを実行して、このパスとそのすべてのサブパスに対する読み取りと書き込みのポリシーを作成する必要があります。
    cat <<EOF | vault policy write orchestrator-policy -
    path "secret/data/applications/orchestrator/*" {
      capabilities = ["create", "read", "update", "delete"]
    }
    path "secret/metadata/applications/orchestrator/*" {
      capabilities = ["delete"]
    }
    EOFcat <<EOF | vault policy write orchestrator-policy -
    path "secret/data/applications/orchestrator/*" {
      capabilities = ["create", "read", "update", "delete"]
    }
    path "secret/metadata/applications/orchestrator/*" {
      capabilities = ["delete"]
    }
    EOF
    注:
    KeyValueV2 シークレット エンジンを使用すると、シークレットはパス <mount>/data/<secret-path> に書き込まれ、取得されます。これに対し、KeyValueV1 では <mount>/<secret-path> に書き込まれ、取得されます。CLI コマンドは変更されません (つまり、パスにデータは指定しません)。
    ただし、機能は実際のパスに適用されるため、ポリシーは変更されます。前の例では、KeyValueV2 シークレット エンジンを使用しているため、パスは secret/data/applications/orchestrator/* です。KeyValueV2 が使用されていた場合、パスは secret/applications/orchestrator/* でした。

    メタデータ パス上での削除機能が必要になるのは、Orchestrator で接続の検証時にテスト キーが残されないようにする場合のみです。この機能がない場合、Orchestrator で資格情報ストアを作成するときに、キーが作成されて、そのまま残ります。

  6. userpass認証方法として使用した認証を有効化した後、Orchestrator のユーザーを作成し、作成済みのポリシーを割り当てます。
    vault auth enable userpass
    vault write auth/userpass/users/orchestrator password=123456 policies=orchestrator-policyvault auth enable userpass
    vault write auth/userpass/users/orchestrator password=123456 policies=orchestrator-policy
    注: Orchestrator は複数の認証モードをサポートしています。設定方法については、HashiCorp Vault のドキュメントをご覧ください。
  7. ログインし、前に作成したシークレットを読み取って、すべてを正しく設定したことを確認します。
    vault login -method=userpass username=orchestrator password=123456vault login -method=userpass username=orchestrator password=123456

    このコマンドの出力:

    WARNING! The VAULT_TOKEN environment variable is set! This takes precedence
    over the value set by this command. To use the value set by this command,
    unset the VAULT_TOKEN environment variable or set it to the token displayed
    below.
    Success! You are now authenticated. The token information displayed below
    is already stored in the token helper. You do NOT need to run "vault login"
    again. Future Vault requests will automatically use this token.
    Key                    Value
    ---                    -----
    token                  s.nwombWQH3gGPDhJumRzxKqgI
    token_accessor         aGJL6Pzc6fRRuP8d8tTjS2Kj
    token_duration         768h
    token_renewable        true
    token_policies         ["default" "orchestrator-policy"]
    identity_policies      []
    policies               ["default" "orchestrator-policy"]
    token_meta_username    orchestratorWARNING! The VAULT_TOKEN environment variable is set! This takes precedence
    over the value set by this command. To use the value set by this command,
    unset the VAULT_TOKEN environment variable or set it to the token displayed
    below.
    Success! You are now authenticated. The token information displayed below
    is already stored in the token helper. You do NOT need to run "vault login"
    again. Future Vault requests will automatically use this token.
    Key                    Value
    ---                    -----
    token                  s.nwombWQH3gGPDhJumRzxKqgI
    token_accessor         aGJL6Pzc6fRRuP8d8tTjS2Kj
    token_duration         768h
    token_renewable        true
    token_policies         ["default" "orchestrator-policy"]
    identity_policies      []
    policies               ["default" "orchestrator-policy"]
    token_meta_username    orchestratorWARNING! The VAULT_TOKEN environment variable is set! This takes precedence
    over the value set by this command. To use the value set by this command,
    unset the VAULT_TOKEN environment variable or set it to the token displayed
    below.
    Success! You are now authenticated. The token information displayed below
    is already stored in the token helper. You do NOT need to run "vault login"
    again. Future Vault requests will automatically use this token.
    Key                    Value
    ---                    -----
    token                  s.nwombWQH3gGPDhJumRzxKqgI
    token_accessor         aGJL6Pzc6fRRuP8d8tTjS2Kj
    token_duration         768h
    token_renewable        true
    token_policies         ["default" "orchestrator-policy"]
    identity_policies      []
    policies               ["default" "orchestrator-policy"]
    token_meta_username    orchestratorWARNING! The VAULT_TOKEN environment variable is set! This takes precedence
    over the value set by this command. To use the value set by this command,
    unset the VAULT_TOKEN environment variable or set it to the token displayed
    below.
    Success! You are now authenticated. The token information displayed below
    is already stored in the token helper. You do NOT need to run "vault login"
    again. Future Vault requests will automatically use this token.
    Key                    Value
    ---                    -----
    token                  s.nwombWQH3gGPDhJumRzxKqgI
    token_accessor         aGJL6Pzc6fRRuP8d8tTjS2Kj
    token_duration         768h
    token_renewable        true
    token_policies         ["default" "orchestrator-policy"]
    identity_policies      []
    policies               ["default" "orchestrator-policy"]
    token_meta_username    orchestrator
  8. このトークンをルート トークンの代わりに設定した後、テスト シークレットを読み取ります。
    export VAULT_TOKEN=s.nwombWQH3gGPDhJumRzxKqgI
    vault kv get secret/applications/orchestrator/testSecretexport VAULT_TOKEN=s.nwombWQH3gGPDhJumRzxKqgI
    vault kv get secret/applications/orchestrator/testSecret

このコマンドの出力:

====== Metadata ======
Key              Value
---              -----
created_time     2020-10-12T06:24:41.7827631Z
deletion_time    n/a
destroyed        false
version          1
=========== Data ===========
Key                    Value
---                    -----
supersecretpassword    123456====== Metadata ======
Key              Value
---              -----
created_time     2020-10-12T06:24:41.7827631Z
deletion_time    n/a
destroyed        false
version          1
=========== Data ===========
Key                    Value
---                    -----
supersecretpassword    123456====== Metadata ======
Key              Value
---              -----
created_time     2020-10-12T06:24:41.7827631Z
deletion_time    n/a
destroyed        false
version          1
=========== Data ===========
Key                    Value
---                    -----
supersecretpassword    123456====== Metadata ======
Key              Value
---              -----
created_time     2020-10-12T06:24:41.7827631Z
deletion_time    n/a
destroyed        false
version          1
=========== Data ===========
Key                    Value
---                    -----
supersecretpassword    123456
注:

以下のコマンドを実行して appRole Orchestrator を有効化することもできます。

/ # vault auth enable approle 
/ # vault write auth/approle/role/orchestrator policies=orchestrator-policy 
/ # vault read auth/approle/role/orchestrator/role-id 
/ # vault write -f auth/approle/role/orchestrator/secret-id/ # vault auth enable approle 
/ # vault write auth/approle/role/orchestrator policies=orchestrator-policy 
/ # vault read auth/approle/role/orchestrator/role-id 
/ # vault write -f auth/approle/role/orchestrator/secret-id

これで、Orchestrator での設定に必要なロール ID とシークレット ID を使用できるようになりました。

Active Directory シークレット エンジンを設定する

Active Directory シークレット エンジンを設定するには、以下の手順を実行します。

  1. 以下のコマンドを実行して、Active Directory シークレット エンジンを有効化します。
    vault secrets enable advault secrets enable ad
  2. HashiCorp Vault が Active Directory と通信してパスワードを生成するために使用する資格情報を設定します。
    vault write ad/config \
        binddn=$USERNAME \
        bindpass=$PASSWORD \
        url=ldaps://138.91.247.105 \
        userdn='dc=example,dc=com'vault write ad/config \
        binddn=$USERNAME \
        bindpass=$PASSWORD \
        url=ldaps://138.91.247.105 \
        userdn='dc=example,dc=com'
  3. HashiCorp Vault の名前を Active Directory のアカウントにマップするロールを設定します。アプリケーションがパスワードを要求するときに、このロールでパスワード ローテーションの設定が管理されます。
    vault write ad/roles/orchestrator service_account_name="my-application@example.com"vault write ad/roles/orchestrator service_account_name="my-application@example.com"
  4. AppRole などの認証方法を使用して、ad/creds/orchestrator にある資格情報へのアクセス権を orchestrator に付与します。
    cat <<EOF | vault policy write orchestrator-policy -
    path "ad/creds/orchestrator" {
      capabilities = ["read"]
    }
    EOFcat <<EOF | vault policy write orchestrator-policy -
    path "ad/creds/orchestrator" {
      capabilities = ["read"]
    }
    EOF

HashiCorp Vault (読み取り専用) を使用する

HashiCorp Vault (読み取り専用) プラグインを使用する場合、Vault の管理者は Orchestrator が使用するシークレットを正しくプロビジョニングする必要があります。これらのシークレットのプロビジョニング形式は、シークレットの種類 (アセットあるいはロボットのパスワード) やシークレット エンジンによって異なります。

シークレットをプロビジョニングする手順については、以下をご覧ください。

Was this page helpful?

サポートを受ける
RPA について学ぶ - オートメーション コース
UiPath コミュニティ フォーラム
UiPath ロゴ (白)
信頼とセキュリティ
© 2005-2024 UiPath. All rights reserved.