Skip to content
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

/api/setup-keys List all Setup Keys does not return Setup Keys anymore #2923

Open
NightHammer1000 opened this issue Nov 21, 2024 · 4 comments

Comments

@NightHammer1000
Copy link

Describe the problem

We use the Netbird API in our Setup Routine for a custom Ubuntu Install to get a list of all the Setup Keys to choose which one to use for the Installation of the Netbird Client.

In the Past we got a list of the Full key like it is discribed here https://docs.netbird.io/api/resources/setup-keys

Now after Updating to 0.32.0 we do not get the whole API Key anymore. Just the Five first Digits. The Rest is masked out by Stars.

Are you using NetBird Cloud?

No This is a self hosted installation

Additional context

The Answer we get from the API Call:

[
...
  {
...
    "key": "0FE28****",
...
  }
]

Is this related to #2763 and #2775 ?
If yes, is there now an diffrent way to get the Setup Keys once they are already created?

@NightHammer1000
Copy link
Author

In addition to that, /api/setup-keys/{keyId} - Retrieve a Setup Key does also not work at all in our setup. No matter what ID i try to get we always get the Response

{"message":"setup key: cqaj8pd6m1gc7385f0a0 not found","code":404}

Its always the same. No matter what ID we throw at the API. I could input random Numbers and Letters and it will also return this exact response

@pascal-fischer
Copy link
Contributor

Hi @NightHammer1000,
the behaviour of the list setup-keys api is correct. From now on all setup-keys will be hashed in the database and only the 5 digit secret will be stored. As the keys are now hashed there is no way of retrieving existing keys after they have been created. This is done to improve security so even with access to the database no one will be able to get a hold of the key except the user creating it.

Regarding the /api/setup-keys/{keyId} always returning not found, for me it is the same. I will have a look into whats going wrong here. Thanks for reporting this!

@NightHammer1000
Copy link
Author

Okay. This is kinda bad for us. Thanks for the Info anyway!

As we Previously used the Setup Keys to place the Devices in their respective Groups Automatically to make use of the Policys.

I guess we can work around it in our Setup Script by first pulling a List of Groups from which our Install Engineer can choose the correct one from and then creating a one time use Key for that Group instead of pulling the Multi-Use Key from API.

Will Create Setup Key return the full key? Or also just the Hashed one?

Also. This change should definetly be reflected at https://docs.netbird.io/api/resources/setup-keys before more people waste their expensive time ^^

@pascal-fischer
Copy link
Contributor

Yes when creating a new setup key it will still return the full key for you to copy. The hashed one is only used in the database itself and for other GET calls we will return only the first 5 digits of the key for you to compare with your copy.

Sorry that you lost time on this, we missed the API docs update. The PR I created also includes an update for the openAPI specs so that the docs generation will be updated once the PR is merged.

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

No branches or pull requests

2 participants