Skip to content

events: fix SystemTask timestamps and scheduling - #8435

Merged
BeryJu merged 11 commits into
mainfrom
events/fix-system-tasks
Feb 7, 2024
Merged

BeryJu merged 11 commits into
mainfrom
events/fix-system-tasks

Conversation

@BeryJu

@BeryJu BeryJu commented Feb 6, 2024 •

Copy link
Copy Markdown
Member

Details

Turns out default_timer does indeed not return a timestamp but a more relative time, so we use a real timestamp for start/end but still track the duration with default_timer

This also fixes a couple issues with prefilling, and also system tasks on schedules sometimes not running depending on when instances of authentik start/stop


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

Signed-off-by: Jens Langhammer <[email protected]>
@BeryJu
BeryJu requested review from a team as code owners February 6, 2024 18:07
@netlify

netlify Bot commented Feb 6, 2024 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook canceled.

Name Link
🔨 Latest commit d93cc1e
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/65c3a50e1714500008a110aa

@github-actions

github-actions Bot commented Feb 6, 2024

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-events-fix-system-tasks-1707244810-07a269d
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

For arm64, use these values:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-events-fix-system-tasks-1707244810-07a269d-arm64
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
image:
    repository: ghcr.io/goauthentik/dev-server
    tag: gh-events-fix-system-tasks-1707244810-07a269d

For arm64, use these values:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
image:
    repository: ghcr.io/goauthentik/dev-server
    tag: gh-events-fix-system-tasks-1707244810-07a269d-arm64

Afterwards, run the upgrade commands from the latest release notes.

@netlify

netlify Bot commented Feb 7, 2024

Copy link
Copy Markdown

✅ Deploy Preview for authentik ready!

Name Link
🔨 Latest commit 1a38c4a
🔍 Latest deploy log https://app.netlify.com/sites/authentik/deploys/65c3a313af42960008032dc7
😎 Deploy Preview https://deploy-preview-8435--authentik.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: Jens Langhammer <[email protected]>
Signed-off-by: Jens Langhammer <[email protected]>
Comment thread authentik/events/models.py Resolved
Signed-off-by: Jens Langhammer <[email protected]>
@BeryJu BeryJu changed the title events: fix SystemTask timestamps events: fix SystemTask timestamps and scheduling Feb 7, 2024
@BeryJu
BeryJu enabled auto-merge (squash) February 7, 2024 15:47
@BeryJu
BeryJu merged commit 84fdd4d into main Feb 7, 2024
@BeryJu
BeryJu deleted the events/fix-system-tasks branch February 7, 2024 15:58
BeryJu added a commit that referenced this pull request Feb 8, 2024
BeryJu added a commit that referenced this pull request Feb 8, 2024
* *: deduplicate boilerplate for importing related models

Signed-off-by: Jens Langhammer <[email protected]>

* also auto-import .checks

Signed-off-by: Jens Langhammer <[email protected]>

* fix error during prometheus metrics from #8435

Signed-off-by: Jens Langhammer <[email protected]>

---------

Signed-off-by: Jens Langhammer <[email protected]>
@jejbq

jejbq commented Mar 7, 2024 •

Copy link
Copy Markdown

Hello,

Is it possible that the following modification to authentik/crypto/apps.py will generate a JWT exception in Eclipse Che?

Is it possible that there has been a typing error and that one of the not_valid_after_utc should be in fact not_valid_before_utc?

authentik/crypto/apps.py

-            now < cert.certificate.not_valid_before or now > cert.certificate.not_valid_after
+            now < cert.certificate.not_valid_after_utc or now > cert.certificate.not_valid_after_utc

Related to events: fix SystemTask timestamps and scheduling (https://github.com/goauthentik/authentik/pull/8435)

Eclipse Che Java exceptions after moving from 2023.10.7 to 2024.2.2

HTTP Status 500 – Internal Server Error

Type Exception Report

Message JWT expired at 2024-03-07T12:37:30Z. Current time: 2024-03-07T12:48:34Z, a difference of 661493 milliseconds. Allowed clock skew: 3000 milliseconds.

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

io.jsonwebtoken.ExpiredJwtException: JWT expired at 2024-03-07T12:37:30Z. Current time: 2024-03-07T12:48:34Z, a difference of 661493 milliseconds.  Allowed clock skew: 3000 milliseconds.
	io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:448)
	io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:550)
	io.jsonwebtoken.impl.DefaultJwtParser.parseClaimsJws(DefaultJwtParser.java:610)
	io.jsonwebtoken.impl.ImmutableJwtParser.parseClaimsJws(ImmutableJwtParser.java:173)
	org.eclipse.che.multiuser.oidc.filter.OidcTokenInitializationFilter.processToken(OidcTokenInitializationFilter.java:80)
	org.eclipse.che.multiuser.api.authentication.commons.filter.MultiUserEnvironmentInitializationFilter.doFilter(MultiUserEnvironmentInitializationFilter.java:127)
	org.eclipse.che.commons.logback.filter.RequestIdLoggerFilter.doFilter(RequestIdLoggerFilter.java:50)
	com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
	com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)

Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/10.1.6

I can create an dedicated issue if needed.

Thanks.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants