[PR #1205] [CLOSED] Fix/events key handling #16327

Open
opened 2026-08-05 04:05:59 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1205
Author: @pappz
Created: 10/9/2023
Status: Closed

Base: mainHead: fix/events-key-handling


📝 Commits (3)

  • 672b4c0 Eliminate repeated error messages
  • d25f543 Handle idempotent way the encryption key
  • 56d82a9 Backup and restore encryption key

📊 Changes

7 files changed (+76 additions, -14 deletions)

View changed files

📝 infrastructure_files/configure.sh (+4 -0)
📝 infrastructure_files/management.json.tmpl (+1 -0)
📝 management/cmd/management.go (+11 -3)
📝 management/server/activity/sqlite/crypt.go (+31 -1)
📝 management/server/activity/sqlite/crypt_test.go (+12 -3)
📝 management/server/activity/sqlite/sqlite.go (+16 -6)
📝 management/server/activity/sqlite/sqlite_test.go (+1 -1)

📄 Description

Describe your changes

Because of we provide option to regenerate the config file the encryption key could be lost.

  • The configure.sh read the existing key and write it back during the config generation
  • If config file does not contains key then the service try to read the key from backup file
  • During the key generation the service write out the key into a file and after save it to config file
  • Refactor the logging logic in case the key is invalid for the encrypted data

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/1205 **Author:** [@pappz](https://github.com/pappz) **Created:** 10/9/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/events-key-handling` --- ### 📝 Commits (3) - [`672b4c0`](https://github.com/netbirdio/netbird/commit/672b4c04012d58a608f35c547b78361b9d9f4581) Eliminate repeated error messages - [`d25f543`](https://github.com/netbirdio/netbird/commit/d25f5439130a4e81b81425f567ba0bd06baab877) Handle idempotent way the encryption key - [`56d82a9`](https://github.com/netbirdio/netbird/commit/56d82a99e15b0e88f4b102725b859210136d0a40) Backup and restore encryption key ### 📊 Changes **7 files changed** (+76 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `infrastructure_files/configure.sh` (+4 -0) 📝 `infrastructure_files/management.json.tmpl` (+1 -0) 📝 `management/cmd/management.go` (+11 -3) 📝 `management/server/activity/sqlite/crypt.go` (+31 -1) 📝 `management/server/activity/sqlite/crypt_test.go` (+12 -3) 📝 `management/server/activity/sqlite/sqlite.go` (+16 -6) 📝 `management/server/activity/sqlite/sqlite_test.go` (+1 -1) </details> ### 📄 Description ## Describe your changes Because of we provide option to regenerate the config file the encryption key could be lost. - The configure.sh read the existing key and write it back during the config generation - If config file does not contains key then the service try to read the key from backup file - During the key generation the service write out the key into a file and after save it to config file - Refactor the logging logic in case the key is invalid for the encrypted data ## Issue ticket number and link ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 04:05:59 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#16327