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

shared/cert: Set Not Before in self-signed cert to now-1minute #13606

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

simondeziel
Copy link
Member

In the following made up conditions:

  • a remote LXD server s has its time set to 13:42:00
  • a client foo has its time set to 13:42:15 (15s in advance of s)
  • a remote add token is created for foo
  • foo uses the token and since it's brand new, it creates its self-signed cert and save its current time in the Not Before field: 13:42:15
  • s inspect foo's cert and refuses it because it is in future

In the above situation, the fact that a token was used make it easier to trip on a time delta between the client and server because the cert is create on the spot before being sent to the server.

Having the client set a Not Before time slightly in the past should make it easier to interact with remote servers that are slightly "in the past".

Fixes #13388.

In the following made up conditions:

* a remote LXD server `s` has its time set to `13:42:00`
* a client `foo` has its time set to `13:42:15` (15s in advance of `s`)
* a remote add token is created for `foo`
* `foo` uses the token and since it's brand new, it creates
  its self-signed cert and save its current time in the Not Before field:
  13:42:15
* `s` inspect `foo`'s cert and refuses it because it is in future

In the above situation, the fact that a token was used make it easier to trip
on a time delta between the client and server because the cert is create on the
spot before being sent to the server.

Having the client set a Not Before time slightly in the past should make it
easier to interact with remote servers that are slightly "in the past".

Fixes canonical#13388.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
@simondeziel simondeziel self-assigned this Jun 14, 2024
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@simondeziel simondeziel marked this pull request as ready for review June 14, 2024 19:26
simondeziel added a commit to simondeziel/lxd-ci that referenced this pull request Jun 14, 2024
In theory, canonical/lxd#13606 should be a better way to fix this.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
@tomponline tomponline merged commit ab8259e into canonical:main Jun 14, 2024
29 checks passed
@simondeziel simondeziel deleted the not-before-time-desync branch October 10, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants