diff --git a/authentik/lib/connector.py b/authentik/lib/connector.py new file mode 100644 index 000000000..3ba0e25ca --- /dev/null +++ b/authentik/lib/connector.py @@ -0,0 +1,13 @@ +"""Fix dbbackup quoting the password""" +from dbbackup.db.postgresql import PgDumpConnector + + +class PgCustom(PgDumpConnector): + """Fix dbbackup quoting the password""" + + def run_command(self, *args, **kwargs): + if self.settings.get("PASSWORD"): + env = kwargs.get("env", {}) + env["PGPASSWORD"] = self.settings["PASSWORD"] + kwargs["env"] = env + return super(PgDumpConnector, self).run_command(*args, **kwargs) diff --git a/authentik/root/settings.py b/authentik/root/settings.py index 914c00daf..747aa9fb1 100644 --- a/authentik/root/settings.py +++ b/authentik/root/settings.py @@ -321,7 +321,8 @@ CELERY_RESULT_BACKEND = ( DBBACKUP_STORAGE = "django.core.files.storage.FileSystemStorage" DBBACKUP_STORAGE_OPTIONS = {"location": "./backups" if DEBUG else "/backups"} DBBACKUP_CONNECTOR_MAPPING = { - "django_prometheus.db.backends.postgresql": "dbbackup.db.postgresql.PgDumpConnector" + "django_prometheus.db.backends.postgresql": "authentik.lib.connector.PgCustom", + "django.db.backends.postgresql": "authentik.lib.connector.PgCustom", } if CONFIG.y("postgresql.s3_backup"): DBBACKUP_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" @@ -334,7 +335,7 @@ if CONFIG.y("postgresql.s3_backup"): "endpoint_url": CONFIG.y("postgresql.s3_backup.host"), } j_print( - "Database backup to S3 is configured.", + "Database backup to S3 is configured", host=CONFIG.y("postgresql.s3_backup.host"), ) @@ -356,7 +357,7 @@ if _ERROR_REPORTING: send_default_pii=CONFIG.y_bool("error_reporting.send_pii", False), ) j_print( - "Error reporting is enabled.", + "Error reporting is enabled", env=CONFIG.y("error_reporting.environment", "customer"), )