Skip to content

feat(minimal): add opt-in DB_SSL_ENABLED for RDS IAM-token auth - #151

Open
WolfangAukang wants to merge 1 commit into
masterfrom
feature/db-ssl-enabled
Open

feat(minimal): add opt-in DB_SSL_ENABLED for RDS IAM-token auth#151
WolfangAukang wants to merge 1 commit into
masterfrom
feature/db-ssl-enabled

Conversation

@WolfangAukang

Copy link
Copy Markdown
Contributor

What

Adds an opt-in DB_SSL_ENABLED env var to the simplerisk-minimal entrypoint. When set to exactly true, the privileged setup/delete MySQL client (db_setup() / delete_db()) appends --ssl-mode=REQUIRED --enable-cleartext-plugin.

Why

Required for the EKS per-account migration: the new CDK-provisioned RDS is IAM-auth-only (no master password). Deploy tooling will pass a short-lived RDS IAM auth token via DB_SETUP_PASS; MySQL only accepts a token when the client sends it via the cleartext plugin, which in turn mandates TLS.

Safety — default off, fail-closed

  • Only the exact string true enables the flags. Unset / false / any other value ⇒ unchanged plaintext-capable connection.
  • No behavior change for any existing consumer of the published image; only our EKS setup/delete Jobs will opt in.

Testing

Built the image from this branch and ran an integration test against a TLS-mandatory MySQL 8.4 (--require_secure_transport=ON). 7/7 passed:

  • Flags emitted only when DB_SSL_ENABLED=true (verified via bash xtrace of the real mysql line); absent when unset.
  • The server genuinely rejects a non-TLS connection, so the successful runs necessarily used TLS.
  • With DB_SSL_ENABLED=true: full setup over the TLS-required server — DB simplerisk and user simplerisk created, container exits 0.
  • No regression: with the var unset, setup still works against a plain MySQL.

🤖 Generated with Claude Code

The privileged setup/delete MySQL client in the simplerisk-minimal entrypoint now honors DB_SSL_ENABLED. Set to exactly "true", it appends --ssl-mode=REQUIRED --enable-cleartext-plugin to the db_setup()/delete_db() mysql calls — required for RDS to accept an IAM auth token passed via DB_SETUP_PASS. Defaults off (fail-closed): any other value or unset preserves today's plaintext-capable connection, so published images are unaffected for existing consumers. Documented in CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants