Airflow 中文文档:保护连接

默认情况下,Airflow将在元数据数据库中以纯文本格式保存连接的密码。 在安装过程中强烈建议使用crypto包。 crypto包确实要求您的操作系统安装了libffi-dev。

如果最初未安装crypto软件包,您仍可以通过以下步骤为连接启用加密:

  1. 安装crypto包pip install apache-airflow[crypto]
  2. 使用下面的代码片段生成fernet_key。 fernet_key必须是base64编码的32字节密钥。
 from cryptography.fernet import Fernet
fernet_key = Fernet . generate_key ()
print ( fernet_key . decode ()) # your fernet_key, keep it in secured place!

3.将airflow.cfg fernet_key值替换为步骤2中的值。或者,可以将fernet_key存储在OS环境变量中。 在这种情况下,您不需要更改airflow.cfg ,因为Airflow将使用环境变量而不是airflow.cfg中的值:

 # Note the double underscores
EXPORT AIRFLOW__CORE__FERNET_KEY = your_fernet_key

阅读全文/改进本文

猜你喜欢

转载自blog.csdn.net/wizardforcel/article/details/84591581