Replies: 1 comment 11 replies
-
|
I believe I've been able to resolve this by changing the update implementation to use BaseHook.get_connection().set_password() instead of using the SqlAlchemy sessions directly. However, the limitation is that it can only set the password. If at some point in the future the username changes, it will require manually changing it in Airflow along with updating the credentials in Vault. One could argue that a username is not a secret and doesn't warrant being stored in Vault, but I find it good practice to keep the credentials co-located. |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on integrating Airflow (version 1.10.14, python 3.7.9) with Hashicorp's Vault service in order to retrieve connection credentials that will be used to create connection objects in Airflow. Everything appears in order when I deploy out a fresh server and DB. I can see the connections in the Airflow UI and view the details of each. Where things go wrong is when I redeploy the webserver to an existing DB. If I attempt to view the connections where I've updated the username and password, I get the following:
I suspect what's happening is that the credentials are being updated, but the password is not being encrypted using the fernet_key. I update the connection information as part of my db_init python script using the SqlAlchemy Session object like so
The db_init script is run as part of my docker container's entrypoint script
Google has yielded some information, but I'm unclear as to if this is the correct approach for updating the connection credentials or if I need to fetch the fernet_key and encrypt the password before updating the record. I've seen mention of using a DAG to update the connection, though that does have some implications due to the lifetime of the tokens used to fetch the username and password.
Beta Was this translation helpful? Give feedback.
All reactions