[GH-ISSUE #5063] Self-Hosted 0.62.0 breaking change: enforced encryption key length #10653

Open
opened 2026-08-05 01:26:47 -04:00 by saavagebueno · 4 comments
Owner

Originally created by @speijnik on GitHub (Jan 8, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5063

Describe the problem

After upgrading self-hosted NetBird to 0.62.0 the management server fails to start with an error when the
encryption key is not 32 bytes in length.
While the recommendation makes sense, this breaks older installations which are using
shorter AES keys with no simple way to migrate to a longer key.
The underlying crypto/aes allows 16, 24 and 32 byte keys, so even if this is a misconfiguration this has
not been a problem up until now.

The responsible line of code is 24df442198/util/crypt/crypt.go (L26) which is a change in behaviour compared to 0.61.2 (08b782d6ba/management/server/activity/store/crypt.go (L29))

To Reproduce

Steps to reproduce the behavior:

  1. Configure a 24 byte datastoreEncryptionKey
  2. Start netbird management

Expected behavior

Keys shorter than 32 bytes can be used, even if their use may be discouraged.
Ideally there would be a warning about such usage and a way to migrate to a new key.

Are you using NetBird Cloud?

Self-hosted NetBird control plane.

NetBird version

0.62.0

Is any other VPN software installed?

N/A

Debug output

N/A

Screenshots

N/A

Additional context

None.

Have you tried these troubleshooting steps?

  • Checked for newer NetBird versions
  • Searched for similar issues on GitHub (including closed ones)
Originally created by @speijnik on GitHub (Jan 8, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5063 **Describe the problem** After upgrading self-hosted NetBird to 0.62.0 the management server fails to start with an error when the encryption key is not 32 bytes in length. While the recommendation makes sense, this breaks older installations which are using shorter AES keys with no simple way to migrate to a longer key. The underlying `crypto/aes` allows 16, 24 and 32 byte keys, so even if this is a misconfiguration this has not been a problem up until now. The responsible line of code is https://github.com/netbirdio/netbird/blob/24df442198f179c8b24ce8eedefa828dec0f566f/util/crypt/crypt.go#L26 which is a change in behaviour compared to 0.61.2 (https://github.com/netbirdio/netbird/blob/08b782d6ba6b05da04923e95f6f0931fda51bb12/management/server/activity/store/crypt.go#L29) **To Reproduce** Steps to reproduce the behavior: 1. Configure a 24 byte datastoreEncryptionKey 2. Start netbird management **Expected behavior** Keys shorter than 32 bytes can be used, even if their use may be discouraged. Ideally there would be a warning about such usage and a way to migrate to a new key. **Are you using NetBird Cloud?** Self-hosted NetBird control plane. **NetBird version** 0.62.0 **Is any other VPN software installed?** N/A **Debug output** N/A **Screenshots** N/A **Additional context** None. **Have you tried these troubleshooting steps?** - [x] Checked for newer NetBird versions - [x] Searched for similar issues on GitHub (including closed ones)
saavagebueno added the triage-needed label 2026-08-05 01:26:47 -04:00
Author
Owner

@bornav commented on GitHub (Jan 11, 2026):

facing the same issue after updating to 0.62.1

<!-- gh-comment-id:3734605319 --> @bornav commented on GitHub (Jan 11, 2026): facing the same issue after updating to 0.62.1
Author
Owner

@mrlhansen commented on GitHub (Jan 13, 2026):

I am also experiencing this, but I am confused. In my deployment the encryption key is a string with 32 ASCII chars, but I am still being told that the key is 24 bytes. What I am overlooking?

Edit: Okay, so it assumes that the key is 32 bytes in base64 encoding, that explains the difference..

<!-- gh-comment-id:3743158924 --> @mrlhansen commented on GitHub (Jan 13, 2026): I am also experiencing this, but I am confused. In my deployment the encryption key is a string with 32 ASCII chars, but I am still being told that the key is 24 bytes. What I am overlooking? Edit: Okay, so it assumes that the key is 32 bytes in base64 encoding, that explains the difference..
Author
Owner

@Krull56 commented on GitHub (Jan 13, 2026):

Same issue for me.
@CodeAdminDe , can you explain how replace the key ? thanks

<!-- gh-comment-id:3743451597 --> @Krull56 commented on GitHub (Jan 13, 2026): Same issue for me. @CodeAdminDe , can you explain how replace the key ? thanks
Author
Owner

@scriptis commented on GitHub (Jun 16, 2026):

For anyone ending up here (NixOS 25=>26 here): as far as I've been able to find, there's no route for key migration. If you're using a 16-byte or 24-byte key, your options are to either roll the key migration yourself, wait for someone else to do it (unlikely), or patch the relevant lines to accept 16 or 24-byte keys. This is how it was before the change--aes.NewCipher works fine with 16/24 bytes. If AES-128 or AES-192 are acceptable for your use case, this is my recommendation.

<!-- gh-comment-id:4719743339 --> @scriptis commented on GitHub (Jun 16, 2026): For anyone ending up here (NixOS 25=>26 here): as far as I've been able to find, there's no route for key migration. If you're using a 16-byte or 24-byte key, your options are to either roll the key migration yourself, wait for someone else to do it (unlikely), _or_ [patch the relevant lines](https://github.com/netbirdio/netbird/blob/24df442198f179c8b24ce8eedefa828dec0f566f/util/crypt/crypt.go#L25-L27) to accept 16 or 24-byte keys. This is how it was before the change--`aes.NewCipher` works fine with 16/24 bytes. If AES-128 or AES-192 are acceptable for your use case, this is my recommendation.
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#10653