Skip to content

hotfix: 6977 fix ca config loss#6980

Merged
vitormattos merged 8 commits intomainfrom
hotfix/6977-fix-ca-config-loss
Feb 20, 2026
Merged

hotfix: 6977 fix ca config loss#6980
vitormattos merged 8 commits intomainfrom
hotfix/6977-fix-ca-config-loss

Conversation

@vitormattos
Copy link
Member

No description provided.

The pki directory should not be deleted as it contains the new PKI
structure with CA certificates organized by instance and generation.

Related to #6977

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Fixed critical bugs in the migration that could cause CA certificate loss:

1. Replaced buggy empty(glob()) check with file_exists() for essential
   CA files (ca.pem and ca-key.pem) before copying
2. Only delete source directory after verifying both CA files exist
   in destination
3. Removed redundant addConfigPathToOpenSsl() from preSchemaChange
4. Removed unnecessary ca_id generation that incremented counter twice
5. Added warning logging when migration cannot verify files

The glob() function could return ['.', '..'] on some filesystems,
making empty() return false even for truly empty directories. This
caused the migration to skip copying files and then delete the source,
resulting in complete CA certificate loss.

Fixes #6977

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…ate20260221000000)

Add repair migration to recover CA files for users already affected
by the Version13000Date20251031165700 bug.

Conservative approach:
- Only runs if config_path is empty or doesn't contain CA files
- Searches ONLY in old structure (openssl_config/cfssl_config)
- Never touches existing pki/ directories
- Moves files to correct location based on ca_id
- Updates metadata (ca_id, config_path, ca_generation_counter)
- Cleanup only removes empty old structure directories

This migration safely recovers CA certificates for affected users
without interfering with systems that migrated successfully.

Related to #6977

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos
Copy link
Member Author

/backport to stable33

@vitormattos
Copy link
Member Author

/backport to stable32

This comment was marked as resolved.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos force-pushed the hotfix/6977-fix-ca-config-loss branch from 1522989 to f8fb7ec Compare February 20, 2026 21:22
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos force-pushed the hotfix/6977-fix-ca-config-loss branch from f8fb7ec to 5cec074 Compare February 20, 2026 21:23
@vitormattos
Copy link
Member Author

/backport to stable33

@vitormattos
Copy link
Member Author

/backport to stable32

@vitormattos vitormattos merged commit 4d7ec53 into main Feb 20, 2026
41 checks passed
@vitormattos vitormattos deleted the hotfix/6977-fix-ca-config-loss branch February 20, 2026 21:24
@github-project-automation github-project-automation bot moved this from 0. Needs triage to 4. to release in Roadmap Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

2 participants