Compare commits

...

12 Commits

21 changed files with 65 additions and 42 deletions

View File

@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 2021.1.1-rc1 current_version = 2021.1.1-stable
tag = True tag = True
commit = True commit = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\-(?P<release>.*) parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\-(?P<release>.*)

View File

@ -18,11 +18,11 @@ jobs:
- name: Building Docker Image - name: Building Docker Image
run: docker build run: docker build
--no-cache --no-cache
-t beryju/authentik:2021.1.1-rc1 -t beryju/authentik:2021.1.1-stable
-t beryju/authentik:latest -t beryju/authentik:latest
-f Dockerfile . -f Dockerfile .
- name: Push Docker Container to Registry (versioned) - name: Push Docker Container to Registry (versioned)
run: docker push beryju/authentik:2021.1.1-rc1 run: docker push beryju/authentik:2021.1.1-stable
- name: Push Docker Container to Registry (latest) - name: Push Docker Container to Registry (latest)
run: docker push beryju/authentik:latest run: docker push beryju/authentik:latest
build-proxy: build-proxy:
@ -34,7 +34,7 @@ jobs:
go-version: "^1.15" go-version: "^1.15"
- name: prepare go api client - name: prepare go api client
run: | run: |
cd proxy cd outpost
go get -u github.com/go-swagger/go-swagger/cmd/swagger go get -u github.com/go-swagger/go-swagger/cmd/swagger
swagger generate client -f ../swagger.yaml -A authentik -t pkg/ swagger generate client -f ../swagger.yaml -A authentik -t pkg/
go build -v . go build -v .
@ -45,14 +45,14 @@ jobs:
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- name: Building Docker Image - name: Building Docker Image
run: | run: |
cd proxy/ cd outpost/
docker build \ docker build \
--no-cache \ --no-cache \
-t beryju/authentik-proxy:2021.1.1-rc1 \ -t beryju/authentik-proxy:2021.1.1-stable \
-t beryju/authentik-proxy:latest \ -t beryju/authentik-proxy:latest \
-f Dockerfile . -f proxy.Dockerfile .
- name: Push Docker Container to Registry (versioned) - name: Push Docker Container to Registry (versioned)
run: docker push beryju/authentik-proxy:2021.1.1-rc1 run: docker push beryju/authentik-proxy:2021.1.1-stable
- name: Push Docker Container to Registry (latest) - name: Push Docker Container to Registry (latest)
run: docker push beryju/authentik-proxy:latest run: docker push beryju/authentik-proxy:latest
build-static: build-static:
@ -69,11 +69,11 @@ jobs:
cd web/ cd web/
docker build \ docker build \
--no-cache \ --no-cache \
-t beryju/authentik-static:2021.1.1-rc1 \ -t beryju/authentik-static:2021.1.1-stable \
-t beryju/authentik-static:latest \ -t beryju/authentik-static:latest \
-f Dockerfile . -f Dockerfile .
- name: Push Docker Container to Registry (versioned) - name: Push Docker Container to Registry (versioned)
run: docker push beryju/authentik-static:2021.1.1-rc1 run: docker push beryju/authentik-static:2021.1.1-stable
- name: Push Docker Container to Registry (latest) - name: Push Docker Container to Registry (latest)
run: docker push beryju/authentik-static:latest run: docker push beryju/authentik-static:latest
test-release: test-release:
@ -107,5 +107,5 @@ jobs:
SENTRY_PROJECT: authentik SENTRY_PROJECT: authentik
SENTRY_URL: https://sentry.beryju.org SENTRY_URL: https://sentry.beryju.org
with: with:
tagName: 2021.1.1-rc1 tagName: 2021.1.1-stable
environment: beryjuorg-prod environment: beryjuorg-prod

View File

@ -1,2 +1,2 @@
"""authentik""" """authentik"""
__version__ = "2021.1.1-rc1" __version__ = "2021.1.1-stable"

View File

@ -50,7 +50,8 @@ class TestAdminTasks(TestCase):
self.assertEqual(cache.get(VERSION_CACHE_KEY), "99999999.9999999") self.assertEqual(cache.get(VERSION_CACHE_KEY), "99999999.9999999")
self.assertTrue( self.assertTrue(
Event.objects.filter( Event.objects.filter(
action=EventAction.UPDATE_AVAILABLE, context__new_version="99999999.9999999" action=EventAction.UPDATE_AVAILABLE,
context__new_version="99999999.9999999",
).exists() ).exists()
) )
# test that a consecutive check doesn't create a duplicate event # test that a consecutive check doesn't create a duplicate event
@ -58,7 +59,8 @@ class TestAdminTasks(TestCase):
self.assertEqual( self.assertEqual(
len( len(
Event.objects.filter( Event.objects.filter(
action=EventAction.UPDATE_AVAILABLE, context__new_version="99999999.9999999" action=EventAction.UPDATE_AVAILABLE,
context__new_version="99999999.9999999",
) )
), ),
1, 1,

View File

@ -86,7 +86,11 @@ class ApplicationViewSet(ModelViewSet):
engine.build() engine.build()
if engine.passing: if engine.passing:
allowed_applications.append(application) allowed_applications.append(application)
cache.set(user_app_cache_key(self.request.user.pk), allowed_applications) cache.set(
user_app_cache_key(self.request.user.pk),
allowed_applications,
timeout=86400,
)
serializer = self.get_serializer(allowed_applications, many=True) serializer = self.get_serializer(allowed_applications, many=True)
return self.get_paginated_response(serializer.data) return self.get_paginated_response(serializer.data)

View File

@ -49,9 +49,15 @@ def outpost_service_connection_state(connection_pk: Any):
@CELERY_APP.task(bind=True, base=MonitoredTask) @CELERY_APP.task(bind=True, base=MonitoredTask)
def outpost_service_connection_monitor(self: MonitoredTask): def outpost_service_connection_monitor(self: MonitoredTask):
"""Regularly check the state of Outpost Service Connections""" """Regularly check the state of Outpost Service Connections"""
for connection in OutpostServiceConnection.objects.all(): connections = OutpostServiceConnection.objects.all()
for connection in connections.iterator():
outpost_service_connection_state.delay(connection.pk) outpost_service_connection_state.delay(connection.pk)
self.set_status(TaskResult(TaskResultStatus.SUCCESSFUL)) self.set_status(
TaskResult(
TaskResultStatus.SUCCESSFUL,
[f"Successfully updated {len(connections)} connections."],
)
)
@CELERY_APP.task(bind=True, base=MonitoredTask) @CELERY_APP.task(bind=True, base=MonitoredTask)

View File

@ -1,6 +1,6 @@
"""authentik policy engine""" """authentik policy engine"""
from enum import Enum from enum import Enum
from multiprocessing import Pipe, set_start_method from multiprocessing import Pipe, current_process
from multiprocessing.connection import Connection from multiprocessing.connection import Connection
from typing import Iterator, List, Optional from typing import Iterator, List, Optional
@ -16,9 +16,7 @@ from authentik.policies.process import PolicyProcess, cache_key
from authentik.policies.types import PolicyRequest, PolicyResult from authentik.policies.types import PolicyRequest, PolicyResult
LOGGER = get_logger() LOGGER = get_logger()
# This is only really needed for macOS, because Python 3.8 changed the default to spawn CURRENT_PROCESS = current_process()
# spawn causes issues with objects that aren't picklable, and also the django setup
set_start_method("fork")
class PolicyProcessInfo: class PolicyProcessInfo:
@ -117,14 +115,19 @@ class PolicyEngine:
LOGGER.debug("P_ENG: Evaluating policy", policy=binding.policy) LOGGER.debug("P_ENG: Evaluating policy", policy=binding.policy)
our_end, task_end = Pipe(False) our_end, task_end = Pipe(False)
task = PolicyProcess(binding, self.request, task_end) task = PolicyProcess(binding, self.request, task_end)
task.daemon = False
LOGGER.debug("P_ENG: Starting Process", policy=binding.policy) LOGGER.debug("P_ENG: Starting Process", policy=binding.policy)
task.start() if CURRENT_PROCESS._config.get("daemon"):
task.run()
else:
task.start()
self.__processes.append( self.__processes.append(
PolicyProcessInfo(process=task, connection=our_end, binding=binding) PolicyProcessInfo(process=task, connection=our_end, binding=binding)
) )
# If all policies are cached, we have an empty list here. # If all policies are cached, we have an empty list here.
for proc_info in self.__processes: for proc_info in self.__processes:
proc_info.process.join(proc_info.binding.timeout) if proc_info.process.is_alive():
proc_info.process.join(proc_info.binding.timeout)
# Only call .recv() if no result is saved, otherwise we just deadlock here # Only call .recv() if no result is saved, otherwise we just deadlock here
if not proc_info.result: if not proc_info.result:
proc_info.result = proc_info.connection.recv() proc_info.result = proc_info.connection.recv()

View File

@ -1,5 +1,5 @@
"""authentik policy task""" """authentik policy task"""
from multiprocessing import Process from multiprocessing import get_context
from multiprocessing.connection import Connection from multiprocessing.connection import Connection
from traceback import format_tb from traceback import format_tb
from typing import Optional from typing import Optional
@ -28,7 +28,11 @@ def cache_key(binding: PolicyBinding, request: PolicyRequest) -> str:
return prefix return prefix
class PolicyProcess(Process): FORK_CTX = get_context("fork")
PROCESS_CLASS = FORK_CTX.Process
class PolicyProcess(PROCESS_CLASS):
"""Evaluate a single policy within a seprate process""" """Evaluate a single policy within a seprate process"""
connection: Connection connection: Connection

View File

@ -31,7 +31,11 @@ def authenticate(
Customized version of django's authenticate, which accepts a list of backends""" Customized version of django's authenticate, which accepts a list of backends"""
for backend_path in backends: for backend_path in backends:
backend: BaseBackend = path_to_class(backend_path)() try:
backend: BaseBackend = path_to_class(backend_path)()
except ImportError:
LOGGER.warning("Failed to import backend", path=backend_path)
continue
LOGGER.debug("Attempting authentication...", backend=backend) LOGGER.debug("Attempting authentication...", backend=backend)
user = backend.authenticate(request, **credentials) user = backend.authenticate(request, **credentials)
if user is None: if user is None:

View File

@ -19,7 +19,7 @@ services:
networks: networks:
- internal - internal
server: server:
image: beryju/authentik:${AUTHENTIK_TAG:-2021.1.1-rc1} image: beryju/authentik:${AUTHENTIK_TAG:-2021.1.1-stable}
command: server command: server
environment: environment:
AUTHENTIK_REDIS__HOST: redis AUTHENTIK_REDIS__HOST: redis
@ -45,7 +45,7 @@ services:
env_file: env_file:
- .env - .env
worker: worker:
image: beryju/authentik:${AUTHENTIK_TAG:-2021.1.1-rc1} image: beryju/authentik:${AUTHENTIK_TAG:-2021.1.1-stable}
command: worker command: worker
networks: networks:
- internal - internal
@ -62,7 +62,7 @@ services:
env_file: env_file:
- .env - .env
static: static:
image: beryju/authentik-static:${AUTHENTIK_TAG:-2021.1.1-rc1} image: beryju/authentik-static:${AUTHENTIK_TAG:-2021.1.1-stable}
networks: networks:
- internal - internal
labels: labels:

View File

@ -4,7 +4,7 @@ name: authentik
home: https://goauthentik.io home: https://goauthentik.io
sources: sources:
- https://github.com/BeryJu/authentik - https://github.com/BeryJu/authentik
version: "2021.1.1-rc1" version: "2021.1.1-stable"
icon: https://raw.githubusercontent.com/BeryJu/authentik/master/web/icons/icon.svg icon: https://raw.githubusercontent.com/BeryJu/authentik/master/web/icons/icon.svg
dependencies: dependencies:
- name: postgresql - name: postgresql

View File

@ -4,7 +4,7 @@
|-----------------------------------|-------------------------|-------------| |-----------------------------------|-------------------------|-------------|
| image.name | beryju/authentik | Image used to run the authentik server and worker | | image.name | beryju/authentik | Image used to run the authentik server and worker |
| image.name_static | beryju/authentik-static | Image used to run the authentik static server (CSS and JS Files) | | image.name_static | beryju/authentik-static | Image used to run the authentik static server (CSS and JS Files) |
| image.tag | 2021.1.1-rc1 | Image tag | | image.tag | 2021.1.1-stable | Image tag |
| image.pullPolicy | IfNotPresent | Image Pull Policy used for all deployments | | image.pullPolicy | IfNotPresent | Image Pull Policy used for all deployments |
| serverReplicas | 1 | Replicas for the Server deployment | | serverReplicas | 1 | Replicas for the Server deployment |
| workerReplicas | 1 | Replicas for the Worker deployment | | workerReplicas | 1 | Replicas for the Worker deployment |

View File

@ -20,7 +20,7 @@ data:
OUTPOSTS__DOCKER_IMAGE_BASE: "{{ .Values.image.name_outposts }}" OUTPOSTS__DOCKER_IMAGE_BASE: "{{ .Values.image.name_outposts }}"
EMAIL__HOST: "{{ .Values.config.email.host }}" EMAIL__HOST: "{{ .Values.config.email.host }}"
EMAIL__PORT: "{{ .Values.config.email.port }}" EMAIL__PORT: "{{ .Values.config.email.port }}"
EMAIL__USERNAM: "{{ .Values.config.email.username }}" EMAIL__USERNAME: "{{ .Values.config.email.username }}"
EMAIL__USE_TLS: "{{ .Values.config.email.use_tls }}" EMAIL__USE_TLS: "{{ .Values.config.email.use_tls }}"
EMAIL__USE_SSL: "{{ .Values.config.email.use_ssl }}" EMAIL__USE_SSL: "{{ .Values.config.email.use_ssl }}"
EMAIL__TIMEOUT: "{{ .Values.config.email.timeout }}" EMAIL__TIMEOUT: "{{ .Values.config.email.timeout }}"

View File

@ -6,11 +6,11 @@ metadata:
data: data:
monitoring_username: bW9uaXRvcg== # monitor in base64 monitoring_username: bW9uaXRvcg== # monitor in base64
{{- if .Values.config.secretKey }} {{- if .Values.config.secretKey }}
SECRET_KEY: {{ .Values.config.secretKey | b64enc | quote }} secret_key: {{ .Values.config.secretKey | b64enc | quote }}
{{- else }} {{- else }}
SECRET_KEY: {{ randAlphaNum 50 | b64enc | quote}} secret_key: {{ randAlphaNum 50 | b64enc | quote}}
{{- end }} {{- end }}
{{- if .Values.backup }} {{- if .Values.backup }}
POSTGRESQL__S3_BACKUP__SECRET_KEY: "{{ .Values.backup.secretKey }}" POSTGRESQL__S3_BACKUP__SECRET_KEY: "{{ .Values.backup.secretKey }}"
{{- end}} {{- end}}
EMAIL__PASSWOR: "{{ .Values.config.email.password }}" EMAIL__PASSWORD: "{{ .Values.config.email.password }}"

View File

@ -117,7 +117,7 @@ spec:
memory: 300M memory: 300M
limits: limits:
cpu: 300m cpu: 300m
memory: 600MiB memory: 600M
volumes: volumes:
- name: authentik-uploads - name: authentik-uploads
persistentVolumeClaim: persistentVolumeClaim:

View File

@ -5,7 +5,7 @@ image:
name: beryju/authentik name: beryju/authentik
name_static: beryju/authentik-static name_static: beryju/authentik-static
name_outposts: beryju/authentik # Prefix used for Outpost deployments, Outpost type and version is appended name_outposts: beryju/authentik # Prefix used for Outpost deployments, Outpost type and version is appended
tag: 2021.1.1-rc1 tag: 2021.1.1-stable
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
serverReplicas: 1 serverReplicas: 1

View File

@ -1,3 +1,3 @@
package pkg package pkg
const VERSION = "2021.1.1-rc1" const VERSION = "2021.1.1-stable"

View File

@ -81,7 +81,7 @@ select[multiple] {
font-size: var(--pf-global--FontSize--sm); font-size: var(--pf-global--FontSize--sm);
} }
.pf-c-page__main { .pf-c-page__main, .pf-c-drawer__content, .pf-c-page__drawer {
z-index: auto !important; z-index: auto !important;
} }

View File

@ -28,4 +28,4 @@ export const ColorStyles = css`
background-color: var(--pf-global--danger-color--100); background-color: var(--pf-global--danger-color--100);
} }
`; `;
export const VERSION = "2021.1.1-rc1"; export const VERSION = "2021.1.1-stable";

View File

@ -15,7 +15,7 @@ Download the latest `docker-compose.yml` from [here](https://raw.githubuserconte
To optionally enable error-reporting, run `echo AUTHENTIK_ERROR_REPORTING__ENABLED=true >> .env` To optionally enable error-reporting, run `echo AUTHENTIK_ERROR_REPORTING__ENABLED=true >> .env`
To optionally deploy a different version run `echo AUTHENTIK_TAG=2021.1.1-rc1 >> .env` To optionally deploy a different version run `echo AUTHENTIK_TAG=2021.1.1-stable >> .env`
If this is a fresh authentik install run the following commands to generate a password: If this is a fresh authentik install run the following commands to generate a password:

View File

@ -24,7 +24,7 @@ image:
name: beryju/authentik name: beryju/authentik
name_static: beryju/authentik-static name_static: beryju/authentik-static
name_outposts: beryju/authentik # Prefix used for Outpost deployments, Outpost type and version is appended name_outposts: beryju/authentik # Prefix used for Outpost deployments, Outpost type and version is appended
tag: 2021.1.1-rc1 tag: 2021.1.1-stable
serverReplicas: 1 serverReplicas: 1
workerReplicas: 1 workerReplicas: 1