headplane icon indicating copy to clipboard operation
headplane copied to clipboard

Pre-auth keys cannot be expired in some scenarios

Open losthorizon84 opened this issue 1 year ago • 5 comments

Description

Internal Server Error when I try to expire a reusable key.

Headplane Version

v0.5.10

Headscale Version

v0.25.1

losthorizon84 avatar Apr 06 '25 14:04 losthorizon84

I need debug logs, or anything that may indicate the cause.

tale avatar Apr 06 '25 15:04 tale

Sorry, I forgot paste it:

ResponseError: Response Error (500): {"code":2, "message":"preauth key does not belong to user", "details":[]}
    at ApiClient.post (file:///app/build/server/assets/index-CD2MsUX2.js:234791:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async action (file:///app/build/server/assets/server-build.js:60777:5)
    at async callRouteHandler (file:///app/build/server/assets/index-CD2MsUX2.js:10343:16)
    at async file:///app/build/server/assets/index-CD2MsUX2.js:7108:19
    at async callLoaderOrAction (file:///app/build/server/assets/index-CD2MsUX2.js:7158:16)
    at async Promise.all (index 0)
    at async defaultDataStrategy (file:///app/build/server/assets/index-CD2MsUX2.js:6943:17)
    at async callDataStrategyImpl (file:///app/build/server/assets/index-CD2MsUX2.js:7068:17)
    at async callDataStrategy (file:///app/build/server/assets/index-CD2MsUX2.js:6805:19) {
  status: 500,
  response: '{"code":2, "message":"preauth key does not belong to user", "details":[]}',
  responseObject: {
    code: 2,
    message: 'preauth key does not belong to user',
    details: []
  }
}

I can understand the error, but my user has owner role, so I think that I its enough. However, in this case, user matches.

losthorizon84 avatar Apr 06 '25 15:04 losthorizon84

Oh yes, this is actually unrelated to permissions, Headscale's API expects a pre-auth key to be bound to a user so when you make the request it wants both fields. Either way, this doesn't seem like a complicated fix.

tale avatar Apr 06 '25 16:04 tale

@losthorizon84 Please test with the ghcr.io/tale/headplane:next image.

Interested in beta testing? Subscribe to the Pre-release Testing discussion to be notified about future testing release. As always, pre-release versions are accessible on Docker via ghcr.io/tale/headplane:next or the next tag on Git.

tale avatar Apr 06 '25 19:04 tale

It’s working now with next tag. Thank you!

losthorizon84 avatar Apr 06 '25 20:04 losthorizon84