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

incusd/certificates: Improve token handling when clustered #565

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

montag451
Copy link
Contributor

@montag451 montag451 commented Feb 29, 2024

Hi,

I have an Incus cluster which is reachable through a VIP managed by Keepalived. The core.https_address of each node is set to listen on the VIP (net.ipv4.ip_nonlocal_bind=1 on each node). To add a remote client I followed this procedure:

  1. From one of the node (not the one with the VIP), I created a token using incus config trust add <client_name>
  2. On the client I created a new remote using incus remote add <remote_name> <token>

But unfortunately it failed with a cryptic error message Error: Failed to create certificate: Bad certificate add operation data. If I create the token on the node with the VIP, everything is OK.

Digging through the code I discovered that the problem is due to the token operation retrieval. The code assume that the token operation is a local operation but in fact the operation can be a remote one : in my case, the token was created on one node, but the token processing was done on the node with the VIP. This PR fixes this issue.

Signed-off-by: montag451 <montag451@laposte.net>
@stgraber stgraber merged commit 16a7d30 into lxc:main Feb 29, 2024
25 checks passed
@stgraber
Copy link
Member

Confirmed that the code path is safe, thanks!

simondeziel pushed a commit to simondeziel/lxd that referenced this pull request Mar 7, 2024
From lxc/incus#565:
> I have an Incus cluster which is reachable through a VIP managed by
> Keepalived. The `core.https_address` of each node is set to listen on the VIP
> (`net.ipv4.ip_nonlocal_bind=1` on each node). To add a remote client I followed
> this procedure:
>
> From one of the node (not the one with the VIP), I created a token using:
> `incus config trust add <client_name>`
> On the client I created a new remote using:
> `incus remote add <remote_name> <token>`
>
> But unfortunately it failed with a cryptic error message `Error: Failed to
> create certificate: Bad certificate add operation data.`. If I create the token
> on the node with the VIP, everything is OK.
>
> Digging through the code I discovered that the problem is due to the token
> operation retrieval. The code assume that the token operation is a local
> operation but in fact the operation can be a remote one : in my case, the
> token was created on one node, but the token processing was done on the node
> with the VIP. This PR fixes this issue.

Signed-off-by: montag451 <montag451@laposte.net>
(cherry picked from commit e0de0664549cb6031088a88efde97261ef368d73)
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
License: Apache-2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants