Airflow variable encryption not showing

93 views Asked by At

Using Airflow 2.7.2, I want to use the variable encryption function, as seen in the image below

enter image description here

I have install Airflow standalone, but is not giving the option.

enter image description here

After reading documentation, we need to install and use Fernet module for the encryption

Apache Airflow Fernet

# Install Cryptography
pip install apache-airflow[crypto,postgres,ssh,s3,log]
pip install cryptography

# Generate secret key, and store in /home/airflow/airflow.cfg
python3 -c "from cryptography.fernet import Fernet; print (Fernet.generate_key ().decode ())"
vi /home/airflow/airflow.cfg

After restarting the Airflow, still not working. What am I missing?

Thanks!

1

There are 1 answers

2
Pankaj Singh On

By default, airflow considers your variable secret if your variable name has a string like

  • access_token
  • api_key
  • apikey
  • authorization
  • passphrase
  • passwd
  • password
  • private_key
  • secret
  • token

You can set sensitive-var-conn-names in the configuration to mark your variable secret. for example, if set AIRFLOW__CORE__SENSITIVE_VAR_CONN_NAMES=test,example it would consider the variable as secret if the variable name has substring test or example

https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#sensitive-var-conn-names