> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/sonono/private-registries/on-premise-transparent-proxy.md).

# オンプレミスレジストリプロキシ

## 概要

Aikido On-Prem Registry Proxy は、 **透過的なパッケージファイアウォール**としてデプロイできます。

クライアントを private registry URL や特別なプロキシパスを使うよう設定する代わりに、組織は corporate DNS を使用して、対応する公開パッケージレジストリを Aikido Registry Proxy に転送します。開発者はデフォルトのパッケージマネージャー設定を使い続け、プロキシは公開レジストリからコンテンツを取得する前にリクエストを透過的に評価します。

## アーキテクチャ

<figure><img src="/files/7cd54068595772a99f8d00484205539ea7401324" alt=""><figcaption></figcaption></figure>

## プロキシの起動

```bash
docker run -p 8080:8080 -e DEPLOYMENT_MODE=onprem public.ecr.aws/aikido-security/aikido-registry-proxy:latest
```

プロキシはポート `8080` で実行され、TLS は ingress レイヤーで終端されることを想定しています。Ingress は元の `Host` ヘッダーを転送するか、 `X-Forwarded-Host`を設定して、プロキシがエコシステムを識別できるようにします。

ヘルスエンドポイントは `GET /health` で利用できます（認証不要）。Kubernetes の liveness/readiness プローブに適しています。

## 設定

<table data-search="false"><thead><tr><th>変数</th><th>デフォルト</th><th>説明</th></tr></thead><tbody><tr><td><code>DEPLOYMENT_MODE</code></td><td>デフォルトを上書きし、以下に設定する必要があります <code>onprem</code></td><td>DNS プロキシを設定するために必要です</td></tr><tr><td><code>UPSTREAM_DNS</code></td><td><code>1.1.1.1</code></td><td>プロキシ自身の外向き通信に使用する公開 DNS リゾルバーです。インターセプトする社内 DNS ではなく、実際の公開リゾルバーを指す必要があります。複数のリゾルバーはカンマ区切りで指定できます。</td></tr><tr><td><code>MINIMUM_PACKAGE_AGE_HOURS</code></td><td><code>48</code></td><td>このしきい値よりも新しく公開されたパッケージをブロックします。</td></tr><tr><td><code>NPM_UPSTREAM_URL</code></td><td><code>https://registry.npmjs.org</code></td><td>社内の npm ミラーを指すように上書きします。</td></tr><tr><td><code>PYPI_UPSTREAM_URL</code></td><td><code>https://pypi.org</code></td><td>社内の PyPI ミラーを指すように上書きします。</td></tr><tr><td><code>PYPI_FILES_UPSTREAM_URL</code></td><td><code>https://files.pythonhosted.org</code></td><td>社内の PyPI ファイルミラーを指すように上書きします。</td></tr><tr><td><code>MAVEN_UPSTREAM_URL</code></td><td><code>https://repo1.maven.org/maven2</code></td><td>社内の Maven ミラーを指すように上書きします。</td></tr></tbody></table>

## 対応ホストのマッピング

Registry Proxy は、受信する HTTP Host ヘッダーに基づいて、適切なエコシステムへリクエストをルーティングします。

| 公開ホスト名                 | エコシステム        |
| ---------------------- | ------------- |
| registry.npmjs.org     | npm           |
| pypi.org               | PyPI          |
| files.pythonhosted.org | PyPI          |
| repo1.maven.org        | Maven Central |

## レジストリ互換性

メタデータ応答では URL をプロキシパスに書き換えません。クライアントは元の公開レジストリ形式の URL を受け取り、インターセプトされないホストにリダイレクトされることはありません。

### npm

* Packument 応答は次と互換性を保ちます `registry.npmjs.org`.
* Tarball のダウンロードは標準の npm ワークフローを使用します。

### PyPI

* メタデータリクエストは次から提供されます `pypi.org`.
* パッケージのダウンロードは次から提供されます `files.pythonhosted.org`.

### Maven

* Maven Central へのリクエストは標準の `/maven2/...` パスを使用します。

## 送信元 IP とレート制限

すべてのプロキシ通信が単一の IP（または 2 つのレプリカの場合は 2 つの IP）から外向きに出るため、Maven Central や他の公開レジストリは、その IP から発生したリクエストをレート制限またはブロックする場合があります。これは透過型プロキシモデルの既知の制限です。

これを軽減するには、送信トラフィックを複数の IP を持つ NAT ゲートウェイ経由にするか、上流 URL の上書きを公開レジストリのレート制限を受けない社内ミラーに向けることを検討してください。

## 上流ルーティングループの防止

プロキシは自身のすべての外向き呼び出しを `UPSTREAM_DNS` リゾルバーを使用して解決します（デフォルトは `1.1.1.1`）、コンテナのシステム DNS を完全にバイパスします。つまり、Pod がインターセプトする社内 DNS を継承していても、プロキシの上流フェッチは常に実際の公開レジストリに到達し、ループバックすることはありません。

プロキシホスト自体に split-horizon DNS の設定は不要です。追加の保護として、Kubernetes を介して Pod の DNS リゾルバーを明示的に設定できます `dnsConfig`.

## リクエストフロー

1. 開発者または CI システムが標準のパッケージマネージャーを使用してパッケージをインストールします。
2. 社内 DNS が公開レジストリのホスト名を内部の Registry Proxy に解決します。
3. Registry Proxy は元の HTTP Host ヘッダーを使ってリクエストを受け取ります。
4. プロキシは要求されたホスト名に基づいて対象のエコシステムを判定します。
5. マルウェア検知と最小パッケージ経過時間ポリシーが評価されます。
6. リクエストが許可された場合、プロキシは対応する公開レジストリからパッケージまたはメタデータを取得します。
7. 応答は透過的にクライアントへ返されます。


---

# 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://help.aikido.dev/docs/docs-ja/sonono/private-registries/on-premise-transparent-proxy.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.
