> 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/keeperpam/jp/privileged-access-manager/getting-started/gateways/gateway-environment-configuration.md).

# ゲートウェイの環境構成

## 概要 <a href="#overview" id="overview"></a>

ゲートウェイエージェントはデフォルト設定で動作します。必要に応じて、内部機能の追加や削除のためにカスタマイズできます。このガイドでは、ゲートウェイのインストール方式に応じた設定変更の手順を取り扱います。

ゲートウェイへの設定適用や機能追加には、以下の2つの方法があります。

* 環境変数 (Docker、Windows、Linux)
* CLI引数 (Windows、Linux)

一部の機能は環境変数でのみ設定できます。いずれの方法で利用できる項目については、[ゲートウェイの環境変数](/keeperpam/jp/privileged-access-manager/getting-started/gateways/gateway-environment-variables.md)をご参照ください。

## 環境変数 <a href="#environment-variables" id="environment-variables"></a>

環境変数を設定すると、ゲートウェイの設定や機能を定義できます。Dockerインストールでは、環境変数がゲートウェイを構成する唯一の方法です。

### Dockerインストール <a href="#docker-installations" id="docker-installations"></a>

1. `docker-compose.yml` ファイルを更新します。

{% code overflow="wrap" %}

```bash
vi docker-compose.yml
```

{% endcode %}

2. ゲートウェイサービスの `environment` ブロックに環境変数を追加または削除します。

{% code overflow="wrap" %}

```yaml
services:
  keeper-gateway:
    platform: linux/amd64
    image: keeper/gateway:latest
    shm_size: 2g
    restart: unless-stopped
    security_opt:
      - seccomp:docker-seccomp.json
      - apparmor:gateway-apparmor-profile
    environment:
      ACCEPT_EULA: Y
      GATEWAY_CONFIG: ey...
      KEEPER_GATEWAY_...: true    # ← New variable
```

{% endcode %}

3. Dockerコンテナを再起動します。

{% code overflow="wrap" %}

```bash
docker compose up -d
```

{% endcode %}

### Linuxインストール <a href="#linux-installations" id="linux-installations"></a>

Linuxネイティブのゲートウェイは、`systemd` サービスとして動作します。

1. サービスファイルを更新します。

{% code overflow="wrap" %}

```bash
vi /etc/systemd/system/keeper-gateway.service
```

{% endcode %}

2. サービス構成に環境変数を追加または削除します。

{% code overflow="wrap" %}

```bash
[Unit]
...

[Service]
...
ExecStart=/bin/bash -c "/usr/local/bin/gateway start --service --config-file /etc/keeper-gateway/gateway-config.json --log-to-stdout"
User=keeper-gw
Group=keeper-gw
Environment=RECORDING_PATH=/opt/keeper/gateway/recordings
Environment=TYPE_SCRIPT_RECORDING_PATH=/opt/keeper/gateway/recordings
Environment=GUACD_RECORDING_PATH=/opt/keeper/gateway/recordings
Environment=GUACD_TYPE_SCRIPT_RECORDING_PATH=/opt/keeper/gateway/recordings
Environment=KEEPER_RBI_PROFILE_STORAGE_PATH=/opt/keeper/gateway/rbi-profiles
Environment=KEEPER_RDP_DRIVE_STORAGE_PATH=/opt/keeper/gateway/rdp-drives
Environment=KEEPER_GATEWAY_...=true    # ← New variable
...

[Install]
...
```

{% endcode %}

3. `systemd` デーモンを再読み込みします。

{% code overflow="wrap" %}

```bash
systemctl daemon-reload
```

{% endcode %}

4. Keeperゲートウェイを再起動します。

{% code overflow="wrap" %}

```bash
systemctl restart keeper-gateway.service
```

{% endcode %}

### Windowsインストール <a href="#windows-installations" id="windows-installations"></a>

Windowsネイティブのゲートウェイは、デフォルトでWindowsサービスとして動作します。マシン単位で環境変数を設定すると、サービスにも適用され、ユーザーセッションをまたいでも保持されます。

1. PowerShellで、Keeperゲートウェイの環境変数を定義します。

{% code overflow="wrap" %}

```powershell
[Environment]::SetEnvironmentVariable("KEEPER_GATEWAY_...", "true", "Machine")
```

{% endcode %}

2. Keeperゲートウェイサービスを再起動します。

<figure><img src="/files/FgrgZsUA0Zv69JGdKdd0" alt="Windowsゲートウェイサービスの再起動"><figcaption></figcaption></figure>

## CLI引数 <a href="#cli-arguments" id="cli-arguments"></a>

ゲートウェイは、サービスまたはコンテナの開始時に実行されるプログラムで、デフォルトではいくつかのCLI引数付きで起動します。追加の引数を指定すると、設定の変更や機能の追加ができます。

### Dockerインストール <a href="#docker-installations-1" id="docker-installations-1"></a>

Dockerコンテナは再作成されると状態が失われるため、CLIでゲートウェイ構成を更新しても、コンテナの再起動後に変更は保持されません。ただし、ゲートウェイのバージョン確認など、一時的なコマンドの実行にはCLIを使えます。

{% code overflow="wrap" %}

```bash
docker exec -it <gateway-process-id> /opt/keeper/gateway/keeper-gateway version
```

{% endcode %}

### Linuxインストール <a href="#linux-installations-1" id="linux-installations-1"></a>

Linuxネイティブのゲートウェイは `systemd` サービスとして動作し、サービス起動時に `gateway start` コマンドを実行します。以下の手順で、起動コマンドにCLI引数を追加できます。

1. サービスファイルを更新します。

{% code overflow="wrap" %}

```bash
vi /etc/systemd/system/keeper-gateway.service
```

{% endcode %}

2. サービス構成の起動コマンドにCLI引数を追加または削除します。

{% code overflow="wrap" %}

```bash
[Unit]
...

[Service]
...
ExecStart=/bin/bash -c "/usr/local/bin/gateway start --service --config-file /etc/keeper-gateway/gateway-config.json --log-to-stdout <CLI_ARGUMENT_HERE>"
...

[Install]
...
```

{% endcode %}

3. `systemd` デーモンを再読み込みします。

{% code overflow="wrap" %}

```bash
systemctl daemon-reload
```

{% endcode %}

4. Keeperゲートウェイを再起動します。

{% code overflow="wrap" %}

```bash
systemctl restart keeper-gateway.service
```

{% endcode %}

### Windowsインストール <a href="#windows-installations-1" id="windows-installations-1"></a>

Windowsネイティブのゲートウェイは、デフォルトでWindowsサービスとして動作し、サービス起動時に `gateway start` コマンドを実行します。以下の手順で、起動コマンドにCLI引数を追加できます。

1. Keeperゲートウェイサービスのプロパティ画面を開き、「開始パラメーター」の入力欄に引数を追加します (先にサービスを停止しておく必要があります)。

<figure><img src="/files/mJAR6yZOnfC4XpJjCbqd" alt=""><figcaption></figcaption></figure>

2. 必ずこの画面の **\[開始]** からサービスを開始してください (**\[OK]** は押さないでください)。**\[OK]** だけだと、新しい引数が反映されません。


---

# 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/keeperpam/jp/privileged-access-manager/getting-started/gateways/gateway-environment-configuration.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.
