wip: rename to authentik (#361)

* root: initial rename

* web: rename custom element prefix

* root: rename external functions with pb_ prefix

* root: fix formatting

* root: replace domain with goauthentik.io

* proxy: update path

* root: rename remaining prefixes

* flows: rename file extension

* root: pbadmin -> akadmin

* docs: fix image filenames

* lifecycle: ignore migration files

* ci: copy default config from current source before loading last tagged

* *: new sentry dsn

* tests: fix missing python3.9-dev package

* root: add additional migrations for service accounts created by outposts

* core: mark system-created service accounts with attribute

* policies/expression: fix pb_ replacement not working

* web: fix last linting errors, add lit-analyse

* policies/expressions: fix lint errors

* web: fix sidebar display on screens where not all items fit

* proxy: attempt to fix proxy pipeline

* proxy: use go env GOPATH to get gopath

* lib: fix user_default naming inconsistency

* docs: add upgrade docs

* docs: update screenshots to use authentik

* admin: fix create button on empty-state of outpost

* web: fix modal submit not refreshing SiteShell and Table

* web: fix height of app-card and height of generic icon

* web: fix rendering of subtext

* admin: fix version check error not being caught

* web: fix worker count not being shown

* docs: update screenshots

* root: new icon

* web: fix lint error

* admin: fix linting error

* root: migrate coverage config to pyproject
This commit is contained in:
Jens L
2020-12-05 22:08:42 +01:00
committed by GitHub
parent 810a7ab50b
commit 1cfe1aff13
989 changed files with 6425 additions and 4412 deletions

View File

@ -2,9 +2,9 @@
python -m lifecycle.wait_for_db
printf '{"event": "Bootstrap completed", "level": "info", "logger": "bootstrap", "command": "%s"}\n' "$@" > /dev/stderr
if [[ "$1" == "server" ]]; then
gunicorn -c /lifecycle/gunicorn.conf.py passbook.root.asgi:application
gunicorn -c /lifecycle/gunicorn.conf.py authentik.root.asgi:application
elif [[ "$1" == "worker" ]]; then
celery -A passbook.root.celery worker --autoscale 3,1 -E -B -s /tmp/celerybeat-schedule -Q passbook,passbook_scheduled
celery -A authentik.root.celery worker --autoscale 3,1 -E -B -s /tmp/celerybeat-schedule -Q authentik,authentik_scheduled
elif [[ "$1" == "migrate" ]]; then
# Run system migrations first, run normal migrations after
python -m lifecycle.migrate

View File

@ -8,14 +8,14 @@ import structlog
bind = "0.0.0.0:8000"
user = "passbook"
group = "passbook"
user = "authentik"
group = "authentik"
worker_class = "uvicorn.workers.UvicornWorker"
# Docker containers don't have /tmp as tmpfs
worker_tmp_dir = "/dev/shm"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passbook.root.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "authentik.root.settings")
logconfig_dict = {
"version": 1,

View File

@ -8,7 +8,7 @@ from typing import Any
from psycopg2 import connect
from structlog import get_logger
from passbook.lib.config import CONFIG
from authentik.lib.config import CONFIG
LOGGER = get_logger()

View File

@ -1,34 +1,37 @@
# flake8: noqa
from os import system
from lifecycle.migrate import BaseMigration
SQL_STATEMENT = """delete from django_migrations where app = 'passbook_stages_prompt';
drop table passbook_stages_prompt_prompt cascade;
drop table passbook_stages_prompt_promptstage cascade;
drop table passbook_stages_prompt_promptstage_fields;
drop table corsheaders_corsmodel cascade;
drop table oauth2_provider_accesstoken cascade;
drop table oauth2_provider_grant cascade;
drop table oauth2_provider_refreshtoken cascade;
drop table oidc_provider_client cascade;
drop table oidc_provider_client_response_types cascade;
drop table oidc_provider_code cascade;
drop table oidc_provider_responsetype cascade;
drop table oidc_provider_rsakey cascade;
drop table oidc_provider_token cascade;
drop table oidc_provider_userconsent cascade;
drop table passbook_providers_app_gw_applicationgatewayprovider cascade;
delete from django_migrations where app = 'passbook_flows' and name = '0008_default_flows';
delete from django_migrations where app = 'passbook_flows' and name = '0009_source_flows';
delete from django_migrations where app = 'passbook_flows' and name = '0010_provider_flows';
delete from django_migrations where app = 'passbook_stages_password' and
name = '0002_passwordstage_change_flow';"""
SQL_STATEMENT = """
BEGIN TRANSACTION;
DELETE FROM django_migrations WHERE app = 'passbook_stages_prompt';
DROP TABLE passbook_stages_prompt_prompt cascade;
DROP TABLE passbook_stages_prompt_promptstage cascade;
DROP TABLE passbook_stages_prompt_promptstage_fields;
DROP TABLE corsheaders_corsmodel cascade;
DROP TABLE oauth2_provider_accesstoken cascade;
DROP TABLE oauth2_provider_grant cascade;
DROP TABLE oauth2_provider_refreshtoken cascade;
DROP TABLE oidc_provider_client cascade;
DROP TABLE oidc_provider_client_response_types cascade;
DROP TABLE oidc_provider_code cascade;
DROP TABLE oidc_provider_responsetype cascade;
DROP TABLE oidc_provider_rsakey cascade;
DROP TABLE oidc_provider_token cascade;
DROP TABLE oidc_provider_userconsent cascade;
DROP TABLE passbook_providers_app_gw_applicationgatewayprovider cascade;
DELETE FROM django_migrations WHERE app = 'passbook_flows' AND name = '0008_default_flows';
DELETE FROM django_migrations WHERE app = 'passbook_flows' AND name = '0009_source_flows';
DELETE FROM django_migrations WHERE app = 'passbook_flows' AND name = '0010_provider_flows';
DELETE FROM django_migrations WHERE app = 'passbook_stages_password' AND name = '0002_passwordstage_change_flow';
COMMIT;"""
class Migration(BaseMigration):
def needs_migration(self) -> bool:
self.cur.execute(
"select * from information_schema.tables where table_name='oidc_provider_client'"
"select * from information_schema.tables WHERE table_name='oidc_provider_client'"
)
return bool(self.cur.rowcount)

View File

@ -0,0 +1,102 @@
# flake8: noqa
from lifecycle.migrate import BaseMigration
SQL_STATEMENT = """BEGIN TRANSACTION;
ALTER TABLE passbook_audit_event RENAME TO authentik_audit_event;
ALTER TABLE passbook_core_application RENAME TO authentik_core_application;
ALTER TABLE passbook_core_group RENAME TO authentik_core_group;
ALTER TABLE passbook_core_propertymapping RENAME TO authentik_core_propertymapping;
ALTER TABLE passbook_core_provider RENAME TO authentik_core_provider;
ALTER TABLE passbook_core_provider_property_mappings RENAME TO authentik_core_provider_property_mappings;
ALTER TABLE passbook_core_source RENAME TO authentik_core_source;
ALTER TABLE passbook_core_source_property_mappings RENAME TO authentik_core_source_property_mappings;
ALTER TABLE passbook_core_token RENAME TO authentik_core_token;
ALTER TABLE passbook_core_user RENAME TO authentik_core_user;
ALTER TABLE passbook_core_user_groups RENAME TO authentik_core_user_groups;
ALTER TABLE passbook_core_user_pb_groups RENAME TO authentik_core_user_pb_groups;
ALTER TABLE passbook_core_user_user_permissions RENAME TO authentik_core_user_user_permissions;
ALTER TABLE passbook_core_usersourceconnection RENAME TO authentik_core_usersourceconnection;
ALTER TABLE passbook_crypto_certificatekeypair RENAME TO authentik_crypto_certificatekeypair;
ALTER TABLE passbook_flows_flow RENAME TO authentik_flows_flow;
ALTER TABLE passbook_flows_flowstagebinding RENAME TO authentik_flows_flowstagebinding;
ALTER TABLE passbook_flows_stage RENAME TO authentik_flows_stage;
ALTER TABLE passbook_outposts_outpost RENAME TO authentik_outposts_outpost;
ALTER TABLE passbook_outposts_outpost_providers RENAME TO authentik_outposts_outpost_providers;
ALTER TABLE passbook_policies_dummy_dummypolicy RENAME TO authentik_policies_dummy_dummypolicy;
ALTER TABLE passbook_policies_expiry_passwordexpirypolicy RENAME TO authentik_policies_expiry_passwordexpirypolicy;
ALTER TABLE passbook_policies_expression_expressionpolicy RENAME TO authentik_policies_expression_expressionpolicy;
ALTER TABLE passbook_policies_group_membership_groupmembershippolicy RENAME TO authentik_policies_group_membership_groupmembershippolicy;
ALTER TABLE passbook_policies_hibp_haveibeenpwendpolicy RENAME TO authentik_policies_hibp_haveibeenpwendpolicy;
ALTER TABLE passbook_policies_password_passwordpolicy RENAME TO authentik_policies_password_passwordpolicy;
ALTER TABLE passbook_policies_policy RENAME TO authentik_policies_policy;
ALTER TABLE passbook_policies_policybinding RENAME TO authentik_policies_policybinding;
ALTER TABLE passbook_policies_policybindingmodel RENAME TO authentik_policies_policybindingmodel;
ALTER TABLE passbook_policies_reputation_ipreputation RENAME TO authentik_policies_reputation_ipreputation;
ALTER TABLE passbook_policies_reputation_reputationpolicy RENAME TO authentik_policies_reputation_reputationpolicy;
ALTER TABLE passbook_policies_reputation_userreputation RENAME TO authentik_policies_reputation_userreputation;
ALTER TABLE passbook_providers_oauth2_authorizationcode RENAME TO authentik_providers_oauth2_authorizationcode;
ALTER TABLE passbook_providers_oauth2_oauth2provider RENAME TO authentik_providers_oauth2_oauth2provider;
ALTER TABLE passbook_providers_oauth2_refreshtoken RENAME TO authentik_providers_oauth2_refreshtoken;
ALTER TABLE passbook_providers_oauth2_scopemapping RENAME TO authentik_providers_oauth2_scopemapping;
ALTER TABLE passbook_providers_proxy_proxyprovider RENAME TO authentik_providers_proxy_proxyprovider;
ALTER TABLE passbook_providers_saml_samlpropertymapping RENAME TO authentik_providers_saml_samlpropertymapping;
ALTER TABLE passbook_providers_saml_samlprovider RENAME TO authentik_providers_saml_samlprovider;
ALTER TABLE passbook_sources_ldap_ldappropertymapping RENAME TO authentik_sources_ldap_ldappropertymapping;
ALTER TABLE passbook_sources_ldap_ldapsource RENAME TO authentik_sources_ldap_ldapsource;
ALTER TABLE passbook_sources_oauth_oauthsource RENAME TO authentik_sources_oauth_oauthsource;
ALTER TABLE passbook_sources_oauth_useroauthsourceconnection RENAME TO authentik_sources_oauth_useroauthsourceconnection;
ALTER TABLE passbook_sources_saml_samlsource RENAME TO authentik_sources_saml_samlsource;
ALTER TABLE passbook_stages_captcha_captchastage RENAME TO authentik_stages_captcha_captchastage;
ALTER TABLE passbook_stages_consent_consentstage RENAME TO authentik_stages_consent_consentstage;
ALTER TABLE passbook_stages_consent_userconsent RENAME TO authentik_stages_consent_userconsent;
ALTER TABLE passbook_stages_dummy_dummystage RENAME TO authentik_stages_dummy_dummystage;
ALTER TABLE passbook_stages_email_emailstage RENAME TO authentik_stages_email_emailstage;
ALTER TABLE passbook_stages_identification_identificationstage RENAME TO authentik_stages_identification_identificationstage;
ALTER TABLE passbook_stages_invitation_invitation RENAME TO authentik_stages_invitation_invitation;
ALTER TABLE passbook_stages_invitation_invitationstage RENAME TO authentik_stages_invitation_invitationstage;
ALTER TABLE passbook_stages_otp_static_otpstaticstage RENAME TO authentik_stages_otp_static_otpstaticstage;
ALTER TABLE passbook_stages_otp_time_otptimestage RENAME TO authentik_stages_otp_time_otptimestage;
ALTER TABLE passbook_stages_otp_validate_otpvalidatestage RENAME TO authentik_stages_otp_validate_otpvalidatestage;
ALTER TABLE passbook_stages_password_passwordstage RENAME TO authentik_stages_password_passwordstage;
ALTER TABLE passbook_stages_prompt_prompt RENAME TO authentik_stages_prompt_prompt;
ALTER TABLE passbook_stages_prompt_promptstage RENAME TO authentik_stages_prompt_promptstage;
ALTER TABLE passbook_stages_prompt_promptstage_fields RENAME TO authentik_stages_prompt_promptstage_fields;
ALTER TABLE passbook_stages_prompt_promptstage_validation_policies RENAME TO authentik_stages_prompt_promptstage_validation_policies;
ALTER TABLE passbook_stages_user_delete_userdeletestage RENAME TO authentik_stages_user_delete_userdeletestage;
ALTER TABLE passbook_stages_user_login_userloginstage RENAME TO authentik_stages_user_login_userloginstage;
ALTER TABLE passbook_stages_user_logout_userlogoutstage RENAME TO authentik_stages_user_logout_userlogoutstage;
ALTER TABLE passbook_stages_user_write_userwritestage RENAME TO authentik_stages_user_write_userwritestage;
ALTER SEQUENCE passbook_core_provider_id_seq RENAME TO authentik_core_provider_id_seq;
ALTER SEQUENCE passbook_core_provider_property_mappings_id_seq RENAME TO authentik_core_provider_property_mappings_id_seq;
ALTER SEQUENCE passbook_core_source_property_mappings_id_seq RENAME TO authentik_core_source_property_mappings_id_seq;
ALTER SEQUENCE passbook_core_user_groups_id_seq RENAME TO authentik_core_user_groups_id_seq;
ALTER SEQUENCE passbook_core_user_id_seq RENAME TO authentik_core_user_id_seq;
ALTER SEQUENCE passbook_core_user_pb_groups_id_seq RENAME TO authentik_core_user_pb_groups_id_seq;
ALTER SEQUENCE passbook_core_user_user_permissions_id_seq RENAME TO authentik_core_user_user_permissions_id_seq;
ALTER SEQUENCE passbook_core_usersourceconnection_id_seq RENAME TO authentik_core_usersourceconnection_id_seq;
ALTER SEQUENCE passbook_outposts_outpost_providers_id_seq RENAME TO authentik_outposts_outpost_providers_id_seq;
ALTER SEQUENCE passbook_policies_reputation_ipreputation_id_seq RENAME TO authentik_policies_reputation_ipreputation_id_seq;
ALTER SEQUENCE passbook_policies_reputation_userreputation_id_seq RENAME TO authentik_policies_reputation_userreputation_id_seq;
ALTER SEQUENCE passbook_providers_oauth2_authorizationcode_id_seq RENAME TO authentik_providers_oauth2_authorizationcode_id_seq;
ALTER SEQUENCE passbook_providers_oauth2_refreshtoken_id_seq RENAME TO authentik_providers_oauth2_refreshtoken_id_seq;
ALTER SEQUENCE passbook_stages_consent_userconsent_id_seq RENAME TO authentik_stages_consent_userconsent_id_seq;
ALTER SEQUENCE passbook_stages_prompt_promptstage_fields_id_seq RENAME TO authentik_stages_prompt_promptstage_fields_id_seq;
ALTER SEQUENCE passbook_stages_prompt_promptstage_validation_policies_id_seq RENAME TO authentik_stages_prompt_promptstage_validation_policies_id_seq;
UPDATE django_migrations SET app = replace(app, 'passbook', 'authentik');
UPDATE django_content_type SET app_label = replace(app_label, 'passbook', 'authentik');
END TRANSACTION;"""
class Migration(BaseMigration):
def needs_migration(self) -> bool:
self.cur.execute(
"select * from information_schema.tables where table_name = 'passbook_core_user';"
)
return bool(self.cur.rowcount)
def run(self):
self.cur.execute(SQL_STATEMENT)
self.con.commit()

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
"""This file needs to be run from the root of the project to correctly
import passbook. This is done by the dockerfile."""
import authentik. This is done by the dockerfile."""
from json import dumps
from sys import stderr
from time import sleep, time
@ -9,7 +9,7 @@ from psycopg2 import OperationalError, connect
from redis import Redis
from redis.exceptions import RedisError
from passbook.lib.config import CONFIG
from authentik.lib.config import CONFIG
def j_print(event: str, log_level: str = "info", **kwargs):