sync: update from private repo (2336949a)
CI / build-and-test (push) Canceled after 0s

This commit is contained in:
oss-sync
2026-09-17 11:29:31 +00:00
parent 28f74c4e37
commit 57702b4f34
2139 changed files with 321270 additions and 17494 deletions
@@ -0,0 +1,4 @@
{
"AllowFileSelectionDialogs": false,
"IncognitoModeAvailability": 1
}
+77
View File
@@ -0,0 +1,77 @@
# MAESTRO を HTTPS で公開するための Caddy 設定
#
# Cloudflare の DNS-01 チャレンジでワイルドカード証明書を取り、TLS を Caddy 側で
# 終端して MAESTRO へ平文で中継する。MAESTRO 本体の TLS は切っておくこと
# (二重終端になる)。詳細は docs/operations/caddy-cloudflare-tls.html。
#
# 値は .env.caddy から環境変数として渡る。書式は {$NAME} が Caddy の設定読み込み
# 時の置換、{env.NAME} が実行時の参照。API トークンは設定ファイルに展開させない
# ため後者を使う。
# ワイルドカード証明書の対象。MAESTRO_BASE_DOMAIN=example.com なら
# *.example.com の証明書を 1 枚取り、その下のホスト名をここで捌く。
# maestro.home.example.com を使うなら MAESTRO_BASE_DOMAIN=home.example.com。
# (ワイルドカードが覆うのは 1 ラベル分だけ)
*.{$MAESTRO_BASE_DOMAIN} {
tls {
# Cloudflare の API トークン。必要な権限は対象ゾーンに絞った
# Zone.Zone:Read と Zone.DNS:Edit の 2 つ。
dns cloudflare {env.CLOUDFLARE_API_TOKEN}
# 発行時の TXT レコード確認に使う名前解決先。手元の DNS が
# 同じ名前を別の答えで返す構成 (split-horizon) だと、この指定が
# 無いと発行が通らないことがある。
resolvers 1.1.1.1 1.0.0.1
}
# --- MAESTRO 本体 -------------------------------------------------------
# コンテナ内の待ち受けは 9876 固定 (docker-compose.yml の environment で
# PORT=9876 を渡しているため、.env では変えられない)。
@maestro host {$MAESTRO_HOSTNAME}
handle @maestro {
reverse_proxy maestro:9876
}
# --- AAO ゲートウェイ (使っている人だけ) --------------------------------
# ゲートウェイは MAESTRO 本体とは別のポートで待ち受ける (既定 4000)。
# 同じプロセスで動かしていても口は別なので、通すならここも要る。
# GATEWAY_HOSTNAME を設定しない場合、この matcher は予約済みの .invalid
# ドメインに当たるので実際のリクエストとは一致しない = 無効のまま。
#
# 既定値つきの置換が効くのは「未設定のとき」だけ。.env.caddy に
# `GATEWAY_HOSTNAME=` と等号だけ書くと空文字が入り、Caddy は
# module value cannot be null で起動しない。同様に
# `GATEWAY_UPSTREAM_PORT=` は maestro:80 への中継になる (無警告)。
# 使わないキーは行ごとコメントアウトしたままにすること。
#
# GATEWAY_HOSTNAME は MAESTRO_BASE_DOMAIN の 1 つ下の階層にすること。
# 別ドメインや 2 階層下だと証明書もこの site block も覆わないので、
# そのホスト名は無反応になる (Caddy は何も言わない)。
@gateway host {$GATEWAY_HOSTNAME:gateway.invalid}
handle @gateway {
reverse_proxy maestro:{$GATEWAY_UPSTREAM_PORT:4000}
}
# --- 上のどれにも当たらないホスト名 -------------------------------------
# ワイルドカード証明書は同じ階層のホスト名すべてに当たるので、
# 明示していない名前は中に通さない。
handle {
abort
}
}
# 証明書の期限通知を受け取りたい場合は、このファイルの先頭 (site block より前)
# に次の global options block を足す:
#
# {
# email [email protected]
# }
#
# 空の値は書けない (引数なしと解釈されて起動に失敗する) ため、環境変数では
# なく直接書くか、使わないなら block ごと省くこと。
#
# 初回の試し撃ちには Let's Encrypt の検証用エンドポイントを使うとよい。
# 同じ global options block に次の 1 行を足すと、発行の失敗が本番の回数制限に
# 当たらなくなる (証明書はブラウザに信頼されないので、通ったら消して再起動):
#
# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
+25
View File
@@ -0,0 +1,25 @@
# Caddy + Cloudflare DNS プラグイン
#
# Caddy の公式配布イメージには DNS プロバイダのプラグインが入っていない。
# Cloudflare の DNS-01 チャレンジでワイルドカード証明書を取るには、プラグインを
# 組み込んだバイナリを自分でビルドする必要がある (xcaddy による 2 段ビルド)。
#
# ビルド:
# docker compose -f docker-compose.yml -f docker-compose.caddy.yml build caddy
#
# 手順書: docs/operations/caddy-cloudflare-tls.html
# --- stage 1: xcaddy でプラグイン入りバイナリをビルド -----------------------
FROM caddy:2-builder AS builder
RUN xcaddy build \
--with github.com/caddy-dns/cloudflare
# --- stage 2: 公式ランタイムイメージにバイナリだけ差し替え -------------------
FROM caddy:2
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
# 版を固定したい場合は上の 2 つのタグを揃えて具体的な版に置き換える
# (例: caddy:2.10-builder / caddy:2.10)。builder とランタイムで版が
# ずれると、差し替えたバイナリと同梱の設定ファイルが食い違うことがある。
+37
View File
@@ -0,0 +1,37 @@
# MAESTRO explicit forward-proxy policy template.
#
# This file deliberately starts with one RFC 6761 .invalid canary. Replace the
# host with an operator-approved exact hostname before enabling production
# traffic. Do not add a leading dot: `.example.com` also permits subdomains.
# Give each hostname+port pair its own two ACLs and one http_access line.
# Dedicated address reserved for this proxy. Do not bind another service here:
# systemd IPAddressAllow is address-based and cannot restrict the port.
http_port 127.0.0.2:3128
# Example exact pair: allowed.egress.invalid:443. This domain cannot resolve on
# the public DNS and therefore fails closed until the operator replaces it.
acl maestro_llm_host dstdomain -n allowed.egress.invalid
acl maestro_llm_port port 443
acl CONNECT method CONNECT
acl supported_methods method GET HEAD POST PUT PATCH DELETE OPTIONS CONNECT
# Reject unlisted methods, then allow only an exact hostname+port pair.
http_access deny !supported_methods
http_access allow maestro_llm_host maestro_llm_port
http_access deny all
# Forward only. Do not retain content or per-request access records.
cache deny all
cache_store_log none
access_log none
# Keep operational diagnostics from becoming a second request log.
debug_options ALL,0
# Optional short-lived metadata observation profile. It omits URL/path/query,
# request and response headers, bodies, and DNS names. Enabling it still records
# destination IP and timing, so review retention and file permissions first.
# logformat maestro_meta %ts.%03tu %rm %<A:%<p %Ss/%03>Hs %<st %tr
# access_log daemon:/var/log/squid/maestro-egress-metadata.log maestro_meta
@@ -0,0 +1,47 @@
# Template: copy to /etc/systemd/system/maestro-egress.service and replace
# /opt/maestro and /etc/maestro/maestro.env for the local installation.
#
# Address roles on Linux loopback:
# 127.0.0.2 dedicated Squid listener (outbound)
# 127.0.0.3 dedicated source address of an ingress reverse proxy
# 127.0.0.4 MAESTRO listener
#
# The ingress proxy must bind its MAESTRO-facing connection to 127.0.0.3.
# A direct client sourced from 127.0.0.1 is intentionally rejected. Never solve
# that by allowing 127.0.0.0/8: every IPAddressAllow also permits outbound use.
[Unit]
Description=MAESTRO staging egress-boundary template
After=network-online.target squid.service
Wants=network-online.target
Requires=squid.service
[Service]
Type=simple
User=maestro
Group=maestro
WorkingDirectory=/opt/maestro
EnvironmentFile=-/etc/maestro/maestro.env
ExecStartPre=/usr/bin/env -u NODE_OPTIONS /usr/bin/node /opt/maestro/dist/scripts/migrate-db.js
ExecStart=/usr/bin/env -u NODE_OPTIONS -u http_proxy -u https_proxy -u no_proxy -u ALL_PROXY -u all_proxy NODE_ENV=production AAO_MODE=worker HOST=127.0.0.4 HTTP_PROXY=http://127.0.0.2:3128 HTTPS_PROXY=http://127.0.0.2:3128 NO_PROXY= /usr/bin/node --use-env-proxy /opt/maestro/dist/main.js
Restart=on-failure
RestartSec=5s
UMask=0077
NoNewPrivileges=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
# Intended cgroup-BPF policy. This is a staging-only design example until a
# target host proves enforcement with independent canaries. The first address
# is the proxy endpoint; the second is the ingress source. Reserve both.
IPAddressDeny=any
IPAddressAllow=127.0.0.2/32
IPAddressAllow=127.0.0.3/32
IPAccounting=yes
# IPv6 remains fully denied. If a dedicated proxy/ingress pair is provisioned,
# add their individual /128 values. Do not allow ::1/128 as a convenience.
# IPAddressAllow=fd00:4d41:4553:5452::2/128
# IPAddressAllow=fd00:4d41:4553:5452::3/128
[Install]
WantedBy=multi-user.target