Skip to content

fix(install): run SeaweedFS KEK recovery container as root - #4612

Open
pcbeingused333 wants to merge 2 commits into
getsentry:masterfrom
pcbeingused333:fix/seaweedfs-kek-recovery-run-as-root
Open

pcbeingused333 wants to merge 2 commits into
getsentry:masterfrom
pcbeingused333:fix/seaweedfs-kek-recovery-run-as-root

Conversation

@pcbeingused333

Copy link
Copy Markdown

Fixes #4577

Cause

install/migrate-seaweedfs-kek.sh recovers a wrapped legacy filer KEK by running scripts/recover_seaweedfs_kek.py in sentry-self-hosted-local with --volumes-from the temporary SeaweedFS container. The script reads /data/.mini_kek_passphrase, which weed creates as root with mode 0600. Since the sentry image runs as a non-root user, the read fails with PermissionError and the install aborts (before the marker is written or Postgres is touched, so a re-run is safe). It only shows up when upgrading from before 26.8.0 and the stored KEK is wrapped; a plain-hex KEK skips this path.

Fix

Add --user 0 to that one-shot container, which only reads the volume and prints the key.

Test

New _unit-test/migrate-seaweedfs-kek-test.sh stubs the container engine and asserts that the recovery run is started with --user 0. It fails on main and passes with the change.


This PR was prepared with AI assistance (Claude Code) and the change reviewed against the issue's reproduction.

The recovery step reads /data/.mini_kek_passphrase through --volumes-from.
weed writes that file as root with mode 0600, and the sentry-self-hosted-local
image now runs as a non-root user, so the read fails with PermissionError when
upgrading from before 26.8.0 with a wrapped filer KEK.

Run the one-shot, read-only container with --user 0.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@aminvakil aminvakil left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this.

This does not need a unit test as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

install.sh 26.10.0: SeaweedFS KEK migration fails with PermissionError on /data/.mini_kek_passphrase (sentry image is non-root now)

2 participants