Repository navigation
feat(email): move active credentials and recovery to infrastructure #5533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
26bb051
feat(email): use infrastructure credentials for operation and recovery
devantler 1a3bce9
Merge remote-tracking branch 'origin/main' into codex/email-canonical…
devantler d2110d0
fix(email): verify canonical custody against recent independent backups
devantler 962c00c
fix(email): prevent cache seeding during production recovery
devantler 12a5c0b
Merge remote-tracking branch 'origin/main' into codex/email-canonical…
devantler d433568
fix(email): split recovery patches by resource
devantler 01bee6e
Merge remote-tracking branch 'origin/main' into codex/email-canonical…
devantler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
k8s/providers/hetzner/apps/private-mail/patches/disable-admin-credential-seeding.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: external-secrets.io/v1alpha1 | ||
| kind: PushSecret | ||
| metadata: | ||
| name: private-mail-admin | ||
| namespace: private-mail | ||
| $patch: delete |
6 changes: 6 additions & 0 deletions
6
k8s/providers/hetzner/apps/private-mail/patches/disable-agent-credential-seeding.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: external-secrets.io/v1alpha1 | ||
| kind: PushSecret | ||
| metadata: | ||
| name: private-mail-agent | ||
| namespace: private-mail | ||
| $patch: delete |
6 changes: 6 additions & 0 deletions
6
k8s/providers/hetzner/apps/private-mail/patches/disable-maintainer-credential-seeding.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: external-secrets.io/v1alpha1 | ||
| kind: PushSecret | ||
| metadata: | ||
| name: private-mail-maintainer | ||
| namespace: private-mail | ||
| $patch: delete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
| ) | ||
|
|
||
| func TestCanonicalRecoveryUsesRecentIndependentBackupsAfterCustodyChanges(t *testing.T) { | ||
| previous := credentialPaths | ||
| t.Cleanup(func() { credentialPaths = previous }) | ||
| _, credentialPaths, _ = credentialMode("collect-email") | ||
| now := time.Now().UTC() | ||
| start, end, err := freshRecoveryWindow(nil, now) | ||
| if err != nil || !start.Equal(now.Add(-24*time.Hour)) || !end.Equal(now.Add(5*time.Minute)) { | ||
| t.Fatal("canonical recovery is still bound to the obsolete one-time copy snapshot") | ||
| } | ||
| if _, _, err := freshRecoveryWindow([]byte("undeclared-window"), now); err == nil { | ||
| t.Fatal("canonical recovery accepted an externally supplied evidence window") | ||
| } | ||
| if _, _, err := freshRecoveryWindow(nil, time.Time{}); err == nil { | ||
| t.Fatal("canonical recovery accepted an absent current clock") | ||
| } | ||
| _, credentialPaths, _ = credentialMode("collect") | ||
| if _, _, err := freshRecoveryWindow(nil, now); err == nil { | ||
| t.Fatal("legacy copy recovery lost its specific completed-job prerequisite") | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package main | ||
|
|
||
| import "slices" | ||
|
|
||
| // credentialMode selects only a declared credential set. Legacy modes remain | ||
| // available to the one-time copy workflow and retained-history recovery. | ||
| func credentialMode(requested string) (string, []string, bool) { | ||
| mode := map[string]string{ | ||
| "image": "image", "collect": "collect", "verify": "verify", "fixture": "fixture", | ||
| "collect-email": "collect", "verify-email": "verify", "fixture-email": "fixture", | ||
| }[requested] | ||
| if mode == "" { | ||
| return "", nil, false | ||
| } | ||
| if requested != mode { | ||
| return mode, []string{"infrastructure/email/admin", "infrastructure/email/maintainer", "infrastructure/email/agent"}, true | ||
| } | ||
| return mode, []string{"apps/private-mail/admin", "apps/private-mail/maintainer", "apps/private-mail/agent"}, true | ||
| } | ||
|
|
||
| func canonicalRecoverySet() bool { | ||
| _, paths, ok := credentialMode("collect-email") | ||
| return ok && slices.Equal(credentialPaths, paths) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "slices" | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestCredentialModesKeepCanonicalRecoverySeparateFromLegacyCopy(t *testing.T) { | ||
| legacy := []string{"apps/private-mail/admin", "apps/private-mail/maintainer", "apps/private-mail/agent"} | ||
| canonical := []string{"infrastructure/email/admin", "infrastructure/email/maintainer", "infrastructure/email/agent"} | ||
| for _, mode := range []string{"collect", "verify", "fixture"} { | ||
| for _, suffix := range []string{"", "-email"} { | ||
| t.Run(mode+suffix, func(t *testing.T) { | ||
| base, paths, ok := credentialMode(mode + suffix) | ||
| want := legacy | ||
| if suffix != "" { | ||
| want = canonical | ||
| } | ||
| if !ok || base != mode || !slices.Equal(paths, want) { | ||
| t.Fatal("recovery mode selected the wrong fixed credential set") | ||
| } | ||
| }) | ||
| } | ||
| } | ||
| for _, mode := range []string{"", "image-email", "verify-email-email", "collect-other", "verify/email", "../collect", "fixture-email\n"} { | ||
| if _, _, ok := credentialMode(mode); ok { | ||
| t.Fatal("unsupported recovery mode was accepted") | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.