# LinuxベースのDocker

<figure><img src="https://1914737032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mfd2v-YT48Ljtykb8qm%2Fuploads%2FwBR1r9mpprXuoyKqxELU%2FDocker.jpg?alt=media&#x26;token=0b34fd80-7f7b-4f52-9335-20e6dcbe1dcc" alt=""><figcaption></figcaption></figure>

## LinuxベースのDocker

本ガイドでは、Dockerを実行できるLinuxインスタンスでKeeperオートメーターを実行するための手順を解説します。

{% hint style="info" %}
SSL証明書が必要となりますので、お持ちでない場合は[カスタムSSL証明書の作成](/sso-connect-cloud/jp/device-approvals/automator/custom-ssl-certificate.md)ページをご参照ください。SSL証明書の秘密鍵や`.pfx`ファイルは、Keeperボルトに保存してください。
{% endhint %}

### セットアップ

1. Dockerのインストール

Dockerをインストールしていない場合は、ご利用のプラットフォームの手順に従ってセットアップします。たとえば、yumパッケージインストーラーを使用する場合、以下のようになります。

```
sudo yum install docker
```

Dockerサービスが実行されていない場合は、Dockerサービスを開始します。

```
sudo service docker start
```

次に、サービスが自動的に開始するように設定します。

```
sudo systemctl enable docker.service
```

root以外のユーザーにDockerの実行を許可するには (セキュリティ要件を満たしている場合）、以下のコマンドを実行します。

```
sudo chmod 666 /var/run/docker.sock
```

2. オートメーターイメージの取得

`docker pull`コマンドを使用して、最新のKeeperオートメーターイメージを取得します。

```
docker pull keeper/automator
```

3. サービスの開始

以下のコマンドを使用してサービスを開始します。以下の例では、ポート443をリッスンしています。

```
docker run -d -p443:443/tcp \
  --name "Keeper-Automator" \
 --restart on-failure:3 \
 keeper/automator
```

4. 証明書の更新

dockerコンテナ内にconfigフォルダを作成します。

```
docker exec -it Keeper-Automator mkdir /usr/mybin/config
```

[証明書ガイド](/sso-connect-cloud/jp/device-approvals/automator/custom-ssl-certificate.md#sslnoto)で作成した`ssl-certificate.pfx`ファイルをコンテナにコピーします。

```
docker cp ssl-certificate.pfx \
  Keeper-Automator:/usr/mybin/config/ssl-certificate.pfx
```

.pfxファイルがパスフレーズで保護されている場合は、`ssl-certificate-password.txt`という名前のファイルを作成します。

```
echo "my_pfx_password..." > ssl-certificate-password.txt
```

そのファイルをdockerコンテナに配置します。

<pre><code><strong>docker cp ssl-certificate-password.txt \
</strong> Keeper-Automator:/usr/mybin/config/ssl-certificate-password.txt
</code></pre>

コンテナ内の`keeper.properties`ファイルで、`ssl_mode`パラメータが`certificate`に設定されていることを確認してください。

{% code overflow="wrap" %}

```
docker exec -it Keeper-Automator sed -i 's/^ssl_mode=.*/ssl_mode=certificate/' settings/keeper.properties
```

{% endcode %}

5. SSL証明書を使用してコンテナを再起動

証明書がインストールされましたので、Dockerコンテナを再起動します。

```
docker restart "Keeper-Automator"
```

6. Keeperコマンダーをインストール

この時点でサービスは実行中ですが、Keeperとはまだ通信でない状態です。

ご利用のワークステーション、サーバー、コンピュータなどにKeeperコマンダーCLIをインストールします。バイナリインストーラーを含むインストール手順については[こちら](/keeperpam/jp/commander-cli/commander-installation-setup.md)をご覧ください。\
\
コマンダーをインストールした後、`keeper shell`と入力してセッションを開いてから`login`コマンドを使用してログインします。オートメーターをセットアップするには、Keeper管理者、またはSSOノードを管理できる管理者としてログインする必要があります。

```
$ keeper shell

My Vault> login admin@company.com
.
.
My Vault>
```

7. **コマンダーで初期化**

Keeperコマンダーにログインし、`automator create`で始まる一連のコマンドを使用してオートメーターを有効化します。

```
My Vault> automator create --name="My Automator" --node="Azure Cloud"
```

ノード名 (この場合はAzure Cloud) は、以下のように管理コンソールのUIに表示されます。

<figure><img src="https://1914737032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mfd2v-YT48Ljtykb8qm%2Fuploads%2FNdYz9XWKABSVqtIAV5Ff%2FScreen%20Shot%202021-09-10%20at%203.59.58%20PM.png?alt=media&#x26;token=3c897624-3ae2-465e-9749-c4357015dacc" alt=""><figcaption><p>Automator作成</p></figcaption></figure>

コマンドの出力には、IDプロバイダから取得したメタデータを含むオートメーターの設定が表示されます。

```
                    Automator ID:1477468749950
                            Name:My Automator
                             URL:
                         Enabled:No
                     Initialized:No
                          Skills:Device Approval
```

以下のようにautomator editコマンドを実行します。これによりURLとスキルが設定されます (`team`、 `team_for_user`、`device`）。

{% code overflow="wrap" %}

```
automator edit --url https://<application URL> --skill=team --skill=team_for_user --skill=device "My Automator"
```

{% endcode %}

次にキーを交換します。オートメーター公開キーで暗号化されたエンタープライズ秘密キーがオートメーターに提供されます。

```
automator setup "My Automator"
```

新しい設定でオートメーターを初期化します。

```
automator init "My Automator"
```

オートメーターサービスを有効にします。

```
automator enable "My Automator"
```

この時点で設定は完了となります。

自動ヘルスチェックには以下のURLをご使用になれます。

**https\://\<server>/health**

以下はその例です。

```
$ curl https://automator.lurey.com/health
OK
```

#### AD FSを使用した環境の場合

IDプロバイダとしてAD FSを使用してKeeperオートメーターを有効にする場合、以下の手順に従ってKeeper証明書を更新するまでログインできません。

* Keeper管理コンソールへログインします。
* **\[管理者]** > **SSOノード** > **\[プロビジョニング]**&#x306B;移動し、SSOクラウド設定を見ます。
* **\[SP証明書をエクスポート]**&#x3092;クリックします。
* AD FS管理コンソールで、KeeperクラウドSSO証明書利用者信頼プロパティを選択します。
* **\[暗号化]**&#x30BF;ブで、古い証明書をこの新しい証明書に置き換えます。
* **\[署名]**&#x30BF;ブで、新しいSP証明書をこの新しい証明書に置き換えます。

### サービスの確保

Keeperのサーバーおよびご利用のワークステーションからサービスへのネットワークアクセスを制限することを推奨します。許可するKeeper IPアドレスのリストについては、[イングレス要件](/sso-connect-cloud/jp/device-approvals/automator/ingress-requirements.md)をご参照ください。

## ユーザー体験のテスト

Keeperオートメーターがデプロイされましたので、エンドユーザー体験のテストが可能となります。ユーザーがSSO IDプロバイダで認証した後は、承認を求めるプロンプトは必要なくなります。

最も簡単なテスト方法は、ブラウザでシークレットモードのウィンドウを開いてKeeperウェブボルトへアクセスし、SSOクラウドでログインすることとなります。デバイスの承認を求めるプロンプトは表示されなくなります。

<figure><img src="https://1914737032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mfd2v-YT48Ljtykb8qm%2Fuploads%2FnAGBNvh99hgIOnNOuJdv%2FScreen%20Shot%202021-09-10%20at%205.17.42%20PM.png?alt=media&#x26;token=e8222ad6-49b4-4b22-9e5b-bde5fd35beb0" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1914737032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mfd2v-YT48Ljtykb8qm%2Fuploads%2FbqTOKRYMbSo5HTGpHTQX%2FScreen%20Shot%202021-09-10%20at%205.18.15%20PM.png?alt=media&#x26;token=73817b67-9c8b-4e42-b585-3e73d0a6b437" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1914737032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mfd2v-YT48Ljtykb8qm%2Fuploads%2F2ePvTbVgjp70enV5sTmc%2FScreen%20Shot%202021-09-10%20at%205.30.15%20PM.png?alt=media&#x26;token=ed4aff69-cdc9-494c-bcc3-29523f8cc65a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1914737032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mfd2v-YT48Ljtykb8qm%2Fuploads%2FhKfNZnzP0MelaFgtnj7s%2FScreen%20Shot%202021-09-10%20at%205.32.12%20PM.png?alt=media&#x26;token=7fb689ee-343e-4117-825b-beaeff2e9409" alt=""><figcaption></figcaption></figure>

## サービスの再起動

Keeperオートメーターサービスを停止/開始する際、Dockerサービスは自動的に状態を保持します。

```
docker restart "Keeper-Automator"
```

## コンテナの更新

Keeperオートメーターの新しいバージョンが利用できるようになった際には、上記の手順2〜7 繰り返すことでオートメーターサービスを更新できます。以下は例です。

```
docker pull keeper/automator
docker stop Keeper-Automator
docker rm Keeper-Automator

docker run -d -p443:443/tcp \
  --name "Keeper-Automator" \
 --restart on-failure:3 \
 keeper/automator

docker exec -it Keeper-Automator mkdir /usr/mybin/config

docker cp ssl-certificate.pfx \
  Keeper-Automator:/usr/mybin/config/ssl-certificate.pfx

docker cp ssl-certificate-password.txt \
 Keeper-Automator:/usr/mybin/config/ssl-certificate-password.txt

docker exec -it Keeper-Automator \
  sed -i 's/^ssl_mode=.*/ssl_mode=certificate/' settings/keeper.properties
  
docker restart "Keeper-Automator"
```

Keeperコマンダーのコマンドを実行します。

```
automator setup "My Automator"
automator init "My Automator"
automator enable "My Automator"
```

## トラブルシューティング

#### サービスが始まらない

Keeperオートメーターのログを確認してください。通常これで問題がわかります。Docker環境では、以下のコマンドを使用してログファイルを追跡できます。

```
docker logs -f "Keeper-Automator"
```

以下のコマンドを使用して、コンテナに接続してログファイルを確認できます。

```
docker exec -it "Keeper-Automator" /bin/sh
```


---

# 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/sso-connect-cloud/jp/device-approvals/automator/docker-on-linux.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.
