# コマンダーを使用した検出

## 概要

本ページでは、Keeperコマンダーを使用して、対象インフラ内のリソースを検出する方法について取り扱います。

## 要件

コマンダーで検出を実行する前に、「検出の基本」のページをご覧ください。

### コマンダーの起動

`keeper shell`のコマンドでKeeperコマンダーCLIにログインします。

```bash
$ keeper shell
```

### ゲートウェイの一覧表示

使用可能なゲートウェイを一覧表示するには、`pam gateway list`か`pam g l`のコマンドを実行します。

```
My Vault> pam gateway list
KSM Application Name (UID)  Gateway Name     Gateway UID             Status
--------------------------- ---------------- ------------------------ --------
AWS Rotation                Canada AWS       ce_Gg4jGS2a1ywiMo61Sow   ONLINE
Azure AD                    Azure useast1    j-xC9HwOQEKCfVsdyfdeLg   ONLINE
KeeperPAM US-WEST-1         US-WEST-1        QPkRsR8KQmf_4vnHTcofZA   ONLINE
Windows Domain              lureydemo.local  rB8bR3drQrqPErKDzbKl9g   ONLINE

My Vault>
```

検出ジョブを開始するには、該当ゲートウェイのUIDが必要です。

### 検出ジョブの開始

`pam action discover start`のコマンドで検出ジョブを開始します。`-g`オプションでゲートウェイUIDを指定します。

```bash
pam action discover start -g QPkRsR8KQmf_4vnHTcofZA
```

### 検出ジョブのステータス確認

現在の検出ジョブのステータスを確認するには`pam action discover status`のコマンドを実行します。

```bash
My Vault> pam action discover status

Job ID         Gateway Name    Gateway UID            Status
============== =============== ====================== ============
JOBGQyK8PQYlhc KeeperPAM GW1   QPkRsR8KQmf_4vnHTcofZA COMPLETE

There is one COMPLETED job. To process, use the following command.
  pam action discover process -j JOBsR5G0VQBVV0
```

検出ジョブが完了した後は、以下のコマンドを実行することで詳細なステータス情報を確認できます。

```bash
pam action discover status -j JOBsR5G0VQBVV0
```

検出ジョブのステータスが「COMPLETE」になったら、次の手順にお進みください。環境の規模によっては、完了までに数分かかる場合があります。

### 検出結果の処理

検出ジョブの完了後、以下のコマンドを実行すると詳細なステータス情報が得られます。

```bash
pam action discover process -j JOBsR5G0VQBVV0
```

このコマンドを実行するとインタラクティブモードが開始され、検出されたリソースが表示されます。各リソースをボルトにPAMレコードとして登録できます。

```
My Vault> pam action discover process -j JOBsR5G0VQBVV0

AWS EC2, us-west-1, Gateway3 - RHEL8, 10.0.0.139
Record Title: Aws AWS-US-WEST-1, EC2 us-west-1 Gateway3 - RHEL8
  Label: pamHostname, Type: pamHostname, Value: Hostname: 10.0.0.139, Port: 22
  Label: operatingSystem, Type: text, Value: linux
  Label: sslVerification, Type: checkbox, Value: False
  Label: instanceName, Type: text, Value: Gateway3 - RHEL8
  Label: instanceId, Type: text, Value: i-0319d6e8703875706
  Label: providerGroup, Type: text, Value: None
  Label: providerRegion, Type: text, Value: us-west-1
[2/2] (E)dit, (A)dd to Resources, Add to (F)older, (S)kip, (I)gnore, (Q)uit> A
Adding record to save queue.
```

検出プロセス中に、対象リソースと関連付けるための管理者用認証情報として、PAMユーザーレコードの指定またはその場での作成を求められることがあります。

初期の検出と管理者用認証情報の登録が完了すると、同じ対象に対して再度検出ジョブを実行できます。この2回目の検出では、提供された資格情報を活用して、対象リソース内のローカルユーザーアカウント、サービス、スケジュールされたタスクを詳細に特定することができます。

### コマンダーの機能をさらに活用する

Keeperコマンダーは、ゲートウェイ管理、構成設定、ローテーション、検出など多くの高度な機能を備えています。利用できるすべてのコマンド一覧については、[KeeperPAMコマンド](/keeperpam/jp/commander-cli/command-reference/keeperpam-commands.md)のページをご参照ください。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/privileged-access-manager/discovery/discovery-using-commander.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
