> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/sso-connect-cloud/jp/device-approvals/commander-cli.md).

# CLIを使用した承認

## コマンダー方式による自動承認

KeeperコマンダーはCLIおよびSDKプラットフォームであり、Keeper管理コンソールにログインしなくても、管理者によるデバイス承認を自動化できます。Keeperコマンダーが実行可能なコンピュータ (Mac、PC、Linux) であれば、管理者承認を設定できます。

この方式ではKeeperクラウドからの着信接続は不要なため、イングレスポートを開けられない環境に適しています。ポーリング方式 (送信接続のみ) を使用します。

### Keeperコマンダーのインストール

インストール手順は[こちら](/keeperpam/jp/commander-cli/commander-installation-setup.md)をご参照ください。\
\
Mac/PC/Linux用のバイナリをインストールするか、`pip3` を使用します。

### CLIを使用したデバイス承認

`keeper shell` コマンドでコマンダーCLIを起動します。コマンダーのバイナリをインストールした場合は、そのファイルを実行します。

```
$ keeper shell
  _  __
 | |/ /___ ___ _ __  ___ _ _
 | ' </ -_) -_) '_ \/ -_) '_|
 |_|\_\___\___| .__/\___|_|
              |_|

 password manager & digital vault   
```

`login` コマンドで、デバイス承認権限を持つKeeper管理者としてログインします。コマンダーでは、SSO、マスターパスワード、2FAを使用できます。自動化のため、デバイス承認専用のKeeper管理サービスアカウントを作成することを推奨します。これにより、ユーザーアカウントへの変更 (強制適用ポリシーなど) によってコマンダーの処理が中断されることを防げます。

```
My Vault> login my_service_user@acme-demo.com
Password: *******

```

すべてのデバイスを一覧表示するには、`device-approve` と入力します。

```
My Vault> device-approve
Email               Device ID           Device Name       Client Version
------------------  ------------------  ----------------  ----------------
demo@acme-demo.com  f68de375aacdff3846  Web Vault Chrome  w15.0.4
demo@acme-demo.com  41sffcb44187222bcc  Web Vault Chrome  w15.0.4
```

特定のデバイスを手動で承認するには、以下のコマンドを使用します。

```
My Vault> device-approve --approve <device ID>
```

過去に正常なログインが記録されたIPアドレスからのデバイスをすべて承認するには、以下のコマンドを使用します。

```
My Vault> device-approve --approve --trusted-ip
```

IPアドレスに関係なくすべてのデバイスを承認するには、以下のコマンドを使用します。

```
My Vault> device-approve --approve
```

特定のデバイス承認リクエストを拒否するには、`deny` コマンドを使用します。

```
My Vault> device-approve --deny <device ID>
```

すべての承認リクエストを拒否するには、デバイスIDパラメータを省略します。

```
My Vault> device-approve --deny
```

シェルを終了せずに最新のデバイス承認を再読み込みするには、`reload` コマンドを使用します。

```
My Vault> device-approve --reload
```

### X秒ごとのデバイス自動承認

コマンダーには、X秒ごとに承認を実行する自動化モードがあります。設定するには、自動作成される `config.json` ファイルを変更します。このファイルは、ユーザーフォルダ内の `.keeper` フォルダ (Windowsでは `C:\Users\Administrator\.keeper\config.json`、Mac/Linuxでは `/home/user/.keeper/config.json`) にあります。

既存のデータは変更せず、以下の行を追加します。

```json
"commands":["enterprise-down","device-approve --approve"],
"timedelay":30
```

{% hint style="info" %}
JSONファイルでは、最後の行を除くすべての行の末尾にコンマが必要です。
{% endhint %}

コマンダーを開く (または `keeper shell` を実行する) と、指定した間隔ごとに以下のようにコマンドが実行されます。

```
$ keeper shell
Executing [enterprise-down]...
Password:
Logging in...
Syncing...

Executing [enterprise-down]...

Email               Device ID           Device Name       Client Version
------------------  ------------------  ----------------  ----------------
user@acme-demo.com  f68de375aacdff3846  Web Vault Chrome  w15.0.4

Executing [device-approve --approve]...
2020/09/20 21:59:47 Waiting for 30 seconds
Executing [enterprise-down]...
There are no pending devices to approve
.
.
.
```

### チームとユーザーの自動承認

上記の例と同様に、コマンダーを使用して、Azure、Okta、JumpCloudなどのSCIMプロバイダによって作成されたチームおよびユーザー割り当てを自動的に承認できます。

設定するには、JSON設定ファイルに `team-approve` コマンドを追加します。

```json
{
    "user": "my_service_user@acme-demo.com",
    "commands": [
        "enterprise-down",
        "device-approve --approve",
        "team-approve"
    ],
    "timedelay": 60
}
```

### 持続的セッション

Keeperコマンダーでは持続的ログインセッションを使用できるため、実行中にマスターパスワードでログインしたり、configurationファイルにマスターパスワードをハードコードしたりする必要はありません。

以下は、デバイス上で30日間 (最大) 持続的ログインを有効にするコマンドです。

```
My Vault> this-device register
My Vault> this-device persistent-login on
My Vault> this-device ip-auto-approve on
My Vault> this-device timeout 30d
My Vault> quit
```

{% hint style="info" %}
値には秒数 (60秒の場合は60) または数字と文字の組み合わせ (1分の場合は1m、5時間の場合は5h、7日間の場合は7d) を使用できます。

`logout` と入力するとセッションが無効になります。コマンダーセッションを終了するには `quit` を使用してください。
{% endhint %}

デバイスで持続的ログインを設定すると、ローカルフォルダ内の `config.json` は以下のようになります。

```
{
    "private_key": "8n0OqFi9o80xGh06bPzxTV1yLeKa5BdWc7f7CffZRQ",
    "device_token": "R2O5wkajo5UjVmbTmvWnwzf7DK1g_Yf-zZ3dWIbKPOng",
    "clone_code": "retObD9F0-WDABaUUGhP0Q",
    "user": "my_service_user@acme-demo.com",
    "server": "keepersecurity.com"
}
```

持続的ログインについて詳しくは、コマンダー資料の[設定ページ](/keeperpam/jp/commander-cli/commander-installation-setup/configuration/configuration.md#persistent-login-sessions)をご参照ください。

Keeperコマンダーで自動化コマンドをカスタマイズする方法は多数あります。詳しくは[コマンダー資料](/keeperpam/jp/commander-cli/overview.md)をご参照ください。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.keeper.io/sso-connect-cloud/jp/device-approvals/commander-cli.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
