Airflow API authentication using Kerberos is not working from the version 2.8.0 #39683
Replies: 4 comments 5 replies
-
I stumbled upon the same issue, but I realized that it wasn't a Kerberos issue. I think it has to due with I'm running Airflow 2.10.2, and I was getting the same 403 response even when running un-authenticated. However, the following works (after having re-enabled API kerberos authentication): $ curl --negotiate -u: -s --service-name airflow https://airflow-test.xxxx.com/api/experimental/pools | jq .
[
{
"description": "Default pool",
"id": 1,
"include_deferred": false,
"pool": "default_pool",
"slots": 128
}
] However, with the same deployment, hitting
|
Beta Was this translation helpful? Give feedback.
-
I think I'd recommend you to upgrade to much newer version of airflow. Upgrading to 2.8.0 (or any .0) makes very little sense in general, because almost by definition it has bugs (All the bugs - and only bugs) that were fixed in 2.8.1, 2.8.2, 2.8.3 and 2.8.4 - and since there were some teething problems with migration to Auth Managers in 2.8.0, it's very likely you are hitting those bugs that were fixed in one of the later versions of 2.8.* So first thing first. Upgrade to latest patchlevel of newer version of airflow (ideally latest patchlevel of 2.10 - that's always my recommendation to upgrade to latest version). Then - I think you should open an issue if it does not work for you - there were some changes in how configuration of APIs are recommended, so I recommend to read the appropriate docs and check if your configuration is properly done. For example Kerberos auth is now part of the FAB provider and ideally you should update your documentation to follow that https://airflow.apache.org/docs/apache-airflow-providers-fab/stable/auth-manager/api-authentication.html This is all described in release notes - so you can also read those - between the version you started from and migrated to. Once you check it all and upgrade and update the configuration if you find things not working, open an issue please with some details - there shoud be some log indicating errors in case you see the authentication not working - and people who will look at the issue need to know all the details to be able to help you. BTW:
is an experimental API that is going to be removed in Airflow 3, so you should rather investigate the authentication issues you have with the REST API |
Beta Was this translation helpful? Give feedback.
-
Thanks for writing back @potiuk! I was reading the documentation last evening, and I realized I misunderstood something. I believe the issue to be a permission / ACL issue, as:
In my case, my user is Admin, so I need to figure out why it's getting a PermissionDenied error, but I believe this to be the root difference between the 2 cases. |
Beta Was this translation helpful? Give feedback.
-
Ok. so here's what I found. The default As it stands, it seems that Kerberos authentication cannot work with the stable API, as the So, what I've done to make the airflow stable API work with Kerberos authentication is define a custom auth manager: # custom_manager.py
from airflow.providers.fab.auth_manager.fab_auth_manager import FabAuthManager
from airflow.providers.fab.auth_manager.models import User
class CustomAuthManager(FabAuthManager):
"""An authentication manager supporting both session and Keberos authentication for the Airflow stable API."""
def get_user(self) -> User:
"""Attempt to find the current user in g.user, as defined by the kerberos authentication backend.
If no such user is found, return the `current_user` local proxy object, linked to the user session.
"""
from flask_login import current_user
from flask import g
# If a user has gone through the Kerberos dance, the kerberos authentication manager
# has linked it with a User model, stored in g.user, and not the session.
if (
current_user.is_anonymous
and getattr(g, "user", None) is not None
and not g.user.is_anonymous
):
return g.user
return super().get_user() and defined the following
And with that, I was able to query the stable API with a kerberos token:
|
Beta Was this translation helpful? Give feedback.
-
We have set up Airflow API authentication using Kerberos. It was working until version 2.7.3 of Airflow.
Recently, we upgraded to version 2.8.0. After the update, the API stopped working with the following error. There are no specific entries to identify the issue in the debug log. Can someone help me resolve this?
Beta Was this translation helpful? Give feedback.
All reactions