Support rotating db credentials without restart (e.g. Aurora DSQL IAM auth)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
調査の方向性
Start by locating SQLPage's PostgreSQL connection and startup error-handling paths, then review how database credentials are loaded and refreshed. Compare that flow with the documented Aurora DSQL requirements: SigV4 IAM token generation, the explicit admin username, and 15-minute token expiry. Done means a supported rotation strategy is implemented and documented, with the repeated connection failure covered by tests.
索引モデルが issue の本文から書いたものです。
説明
Summary/Intro:
SQLPage has no built-in way to mint/refresh the needed AWS IAM token to authenticate with the DSQL database (because that requires AWS SigV4 signing via AWS SDK/CLI).
I’m trying to run SQLPage against Amazon Aurora DSQL (PostgreSQL-compatible, IAM-authenticated) from an AWS Lightsail Ubuntu 22.04 instance (but the same problem would also happen from the SQLPage Lambda runtime).
DSQL uses short-lived IAM auth tokens (SigV4-style) as the PostgreSQL password. Manual psql works only when I provide an IAM token and use the correct username mapping.
SQLPage cannot connect and repeatedly logs:
Failed to connect to the database: error returned from database: invalid password packet size- Then exits / restarts under systemd, causing upstream 502s in my setup.
Environment
- SQLPage version:
0.40.0 - OS: Ubuntu 22.04 (Lightsail)
- Target DB: Aurora DSQL in
us-west-2 - Connection style: TLS required (
sslmode=require) - SQLPage launched via systemd as a non-login user (e.g.,
sqlpage)
What works (manual)
Using the DSQL console “Connect with token”, I can connect from the same machine:
export PGPASSWORD='<DSQL token (presigned URL format, expires ~15m)>'
psql "host=<cluster>.dsql.us-west-2.on.aws port=5432 dbname=postgres user=admin sslmode=require" -c "select now();"
This succeeds. If I omit user=admin, DSQL returns:
Wrong user to action mapping. user: ubuntu, action: DbConnectAdmin
So DSQL requires both:
- an IAM token password
- a correct username/action mapping (e.g.
adminforDbConnectAdmin)
What fails (SQLPage)
SQLPage has no visible options/help for AWS/IAM/DSQL token generation and appears to attempt a normal Postgres password auth. With database_url like:
{
"database_url": "postgresql://@<cluster>.dsql.us-west-2.on.aws:5432/postgres?sslmode=require",
"database_driver": "postgres"
}
SQLPage repeatedly fails with:
invalid password packet size
Even when AWS credentials are available in the environment, SQLPage does not appear to generate/use a DSQL IAM token.
Expected behavior
It would be great if SQLPage could support Aurora DSQL IAM authentication, e.g.:
- ability to generate the required IAM auth token automatically (SigV4) when connecting
- ability to set/override the PostgreSQL username explicitly (DSQL requires a specific mapping, e.g.
admin) - docs/examples for Aurora DSQL
Workaround (in the meantime)
Because DSQL requires a rotating IAM token (~15 minutes), and SQLPage doesn’t generate tokens, you need a local component that does.
Practical workaround
Run a local PostgreSQL pooler/proxy on the server (PgBouncer or similar):
- SQLPage connects to the local proxy on
127.0.0.1with a static password - The proxy connects to DSQL using the IAM token as its upstream password
- A small timer/job refreshes the token periodically (e.g., every 10 minutes) and reloads/restarts the proxy
This keeps SQLPage stable without restarting it every 15 minutes.
Notes:
- Manual
psqlconfirms DSQL connectivity is fine when using token + correct username (e.g.admin). - On Lightsail there’s no instance role, so the token refresh process uses a dedicated IAM “machine user” (access keys) stored securely and restricted to DSQL permissions.
Reproduction steps
1. Create an Aurora DSQL cluster
- Region: any (tested in
us-west-2) - No special configuration required
2. Obtain a DSQL IAM auth token from the AWS Console
-
Open the DSQL cluster in the AWS Console
-
Click “Connect” → “Connect with token”
-
Choose:
- User / Action: Admin (
DbConnectAdmin)
- User / Action: Admin (
-
Copy the generated token (a long presigned URL–style string)
This token expires after ~15 minutes.
3. Verify connectivity using psql (works)
On a Linux machine with network access to the cluster:
export PGPASSWORD='<PASTE TOKEN FROM CONSOLE HERE>'
psql "host=<cluster-id>.dsql.<region>.on.aws \
port=5432 \
dbname=postgres \
user=admin \
sslmode=require" \
-c "select now();"
Result:
Connection succeeds and returns the current timestamp.
Notes:
- Omitting
user=admincauses DSQL to fail with
Wrong user to action mapping - Using any non-token password fails
4. Attempt the same connection using SQLPage (fails)
Using SQLPage 0.40.0, configure sqlpage.json:
{
"database_url": "postgresql://admin@<cluster-id>.dsql.<region>.on.aws:5432/postgres?sslmode=require",
"database_driver": "postgres"
}
Start SQLPage (e.g. via systemd).
Observed behavior:
- SQLPage repeatedly logs:
Failed to connect to the database: error returned from database: invalid password packet size
- SQLPage exits or restarts
- The server never binds to its HTTP port
Providing valid AWS credentials in the environment does not change the outcome.
5. Expected behavior
Since:
psqlsucceeds with the same endpoint using an IAM auth token- SQLPage targets PostgreSQL-compatible databases
SQLPage would need to either:
- Generate and use an IAM auth token for Aurora DSQL, or
- Provide a documented/first-class way to integrate with token-based PostgreSQL authentication (e.g., via hooks or helpers)
- 主要言語
- Rust
- スター
- 2.6k
- フォーク
- 175
- 平均マージ
- 14時間 16分
- マージ済み PR(30日)
- 43
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sqlpage/SQLPage のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
sqlpage/SQLPage#1218 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
There is no convenient way to reproduce issues対応中かも @81reap が 26 日前に担当しました。 オープンenhancement
sqlpage/SQLPage#1566 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Confusing sort interface対応中かも @lovasoa が 73 日前に担当しました。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
sqlpage/SQLPage#1442 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Mutation Testing Results :: Dead Code + Missing Tests再び着手できるかも @81reap が 61 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
sqlpage/SQLPage#1396 · コメント 5 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
sqlpage/SQLPage の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
symposium-dev/symposium#530 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
topgrade-rs/topgrade#2540 ·
メンテナーはふだん 1 日以内に返信
-
Invalid JSON options for ngram and edge_ngram silently use defaults対応中かも @Tilendlesa が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
noemaforge/vimanam#153 ·
メンテナーはふだん 1 日以内に返信