Skip to main content

airflow filesystem secret backend using fernet

Project description

airflow-fernet-secrets

License: Apache-2.0 github action PyPI version python version

how to install

pip install airflow-fernet-secrets
# or
# pip install airflow-fernet-secrets[asyncio]

how to use

config

AIRFLOW__SECRETS__BACKEND=airflow.providers.fernet_secrets.secrets.secret_manager.FernetLocalSecretsBackend
# or
# AIRFLOW__SECRETS__BACKEND=airflow_fernet_secrets.secrets.server.ServerFernetLocalSecretsBackend
#
AIRFLOW__PROVIDERS_FERNET_SECRETS__SECRET_KEY=# some fernet key
# ex: 2eu7W6ULuYxnUB4Uz31IYddkdgboa5kLP24bYtegll0=
# or
# AIRFLOW__PROVIDERS_FERNET_SECRETS__SECRET_KEY_CMD=# some fernet key command
# ex: cat /dev/run/secret_key
# or
# AIRFLOW__PROVIDERS_FERNET_SECRETS__SECRET_KEY_SECRET=# some fernet key file
# ex: /dev/run/secret_key
AIRFLOW__PROVIDERS_FERNET_SECRETS__BACKEND_FILE=# some sqlite file path
# ex: /tmp/backend
# or
# AIRFLOW__PROVIDERS_FERNET_SECRETS__BACKEND_FILE_CMD=# some sqlite file path command
# ex: cat /tmp/where_is_backend
# or
# AIRFLOW__PROVIDERS_FERNET_SECRETS__BACKEND_FILE_SECRET=# some sqlite file path file
# ex: /tmp/where_is_backend

example dag

from __future__ import annotations

from typing import Any

from pendulum import datetime

from airflow.decorators import dag, task
from airflow.providers.fernet_secrets.operators.sync import DumpSecretsOperator


@dag(start_date=datetime(2024, 1, 1), catchup=False, schedule=None)
def dump_connection():
    @task.load_fernet()
    def load_connection() -> dict[str, Any]:
        return {"conn_ids": "some_conn_id"}

    dump = DumpSecretsOperator(task_id="dump", fernet_secrets_conn_ids="some_conn_id")
    load = load_connection()
    _ = dump >> load


dump_connection()

TODO

  • exceptions
  • mysql
  • mssql(pymssql)
  • more tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airflow_fernet_secrets-0.1.0.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

airflow_fernet_secrets-0.1.0-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file airflow_fernet_secrets-0.1.0.tar.gz.

File metadata

File hashes

Hashes for airflow_fernet_secrets-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e3bd934147fb9781052615a0962e8f48a5d8dba91f9a1c54753add1e44b48cf2
MD5 c17d072d0c1f04ea19dd7f41ce7f42b9
BLAKE2b-256 f54b01f83ff7a83d936c8c32e3e720d84e0d13dd2b1c077bd3f99bb2c54a9dd2

See more details on using hashes here.

File details

Details for the file airflow_fernet_secrets-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_fernet_secrets-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60134ec59f36fc4eaba8bc259adcb6e5449ec4b772ea950a7bda81d212a2baba
MD5 45e7f8450dd42471928a825bbb559f21
BLAKE2b-256 3372f22a4652c9deeca9a1847c17db9d88585c98b31b2b884439ecdefddc3a57

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page