Skip to content

feat(redshift): offer TLS on the SQL endpoint with a configured certificate - #18

Merged
simota merged 2 commits into
mainfrom
feat/redshift-tls
Nov 3, 2026
Merged

simota merged 2 commits into
mainfrom
feat/redshift-tls

Conversation

@simota

@simota simota commented Nov 3, 2026

Copy link
Copy Markdown
Owner

変更の目的

Redshift の SQL エンドポイント(pgwire)で TLS を使えるようにしました。pushone-csa の runner は DWH に sslmode=verify-full&sslrootcert=system で接続し、この設定は変えられません。これまでの devcloud は SSLRequest を拒否していたため、data_load は COPY の前の接続で失敗していました(signity-inc/pushone-csa#113)。

主な変更

  • 設定(.devcloud/config.yaml)
    services:
      redshift:
        tls:
          certFile: <PEM。サーバ証明書が先頭のチェーン>
          keyFile: <PEM の秘密鍵。PKCS#8 / PKCS#1 / SEC1>
          require: false   # true にすると平文の接続を 28000 で拒否する
    • 相対パスは、devcloud up を実行したディレクトリからの相対になります。
    • certFile と keyFile は片方だけだと起動エラーにします。require: true なのに証明書が無い場合も起動エラーです。
    • スタンドアロンの devcloud-redshift では、環境変数 DEVCLOUD_REDSHIFT_TLS_CERT_FILE / _KEY_FILE / _REQUIRE で同じ指定ができます。
  • 挙動
    • SSLRequest には 'S' を返し、TLS 1.2 / 1.3(rustls)で接続します。
    • TLS が設定されていなければ、これまでどおり 'N' を返します。GSSENCRequest には常に 'N' を返します。
    • 平文の接続(sslmode=disable)は、require: false なら受け付けたままです。
    • 接続したあとの処理(COPY を含む)は、TLS の有無で変わりません。

検証

検証 結果
cargo test --workspace 1632 件中 1631 件が通過。失敗した 1 件は以前から不安定な cloudrun のテストで、この変更とは関係ありません
services/redshift/tests/pgwire_tls.rs(新規) TLS での接続、平文の受け付け、require での拒否
コンテナから psql sslmode=verify-full(SAN devcloud、ローカル CA) select 1 が通った
pgx(sslmode=verify-full&sslrootcert=system、SSL_CERT_FILE) TLS で接続し、COPY FROM 's3://…' IAM_ROLE … FORMAT AS CSV で取り込めた
SAN が一致しない証明書 psql と pgx のどちらも検証エラーで接続に失敗した
require: true 平文は「requires TLS」で拒否され、TLS は通った
pushone-csa の実際の runner(compose.devcloud.yaml、Docker Desktop) data_load のジョブが success で終わり、assume → ssm → list → ssm → connect → stage → copy → apply を経て、CSV 3 行が表に入った

…ficate

Clients that send an SSLRequest get TLS 1.2/1.3 (rustls, ring) with the PEM
certificate chain and key from services.redshift.tls.certFile/keyFile, so
sslmode=verify-full works against a CA the client trusts. Plain connections
stay accepted unless services.redshift.tls.require is true. GSSENCRequest is
declined. The standalone binary reads DEVCLOUD_REDSHIFT_TLS_CERT_FILE,
DEVCLOUD_REDSHIFT_TLS_KEY_FILE and DEVCLOUD_REDSHIFT_TLS_REQUIRE.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T04:50:04.396468Z ac4b407 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@simota
simota merged commit 71c2d14 into main Nov 3, 2026
2 checks passed
@simota
simota deleted the feat/redshift-tls branch November 3, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant