Replies: 15 comments 6 replies
-
Thanks for opening your first issue here! Be sure to follow the issue template! |
Beta Was this translation helpful? Give feedback.
-
Not sure what changed this behaviour, but do you consider this a bug? I'd argue if you have LDAP enabled, you would want all your users to live in your LDAP directory and not be able to create any local users. |
Beta Was this translation helpful? Give feedback.
-
Yeah. @pawsok - were you atually ABLE to add new users in case of LDAP authentication before (and they Landed in LDAP)? Unless you have custom authentication module, I believe there is no code for that functionality in Airflow so I'd also be quite surprised. Maybe that was a bug and when you added the users they landed in Airflow DB instead? Can you please explain what was the behaviour you observed before and where the users landed (converting that into discussion) |
Beta Was this translation helpful? Give feedback.
-
@potiuk Yes, I'm still able to add LDAP users from Airflow 2.0.1. Here is an exemplary add user view: I have added many users in this way and they can log in Airflow, as: In Airflow webserver config file there are three variables set as the below:
EDIT: Maybe it's something related to a newer version of Flask AppBuilder? In Airflow 2.0.1 we have Flask-AppBuilder==3.1.1, now it's Flask-AppBuilder==3.3.2. |
Beta Was this translation helpful? Give feedback.
-
@pawsok Those users aren't stored in your LDAP directory are they (only in the Airflow DB)? |
Beta Was this translation helpful? Give feedback.
-
That's also my thinking - that they are just in the DB and you won't find them in your LDAP - can you please double-check that? |
Beta Was this translation helpful? Give feedback.
-
Users exist in Airlow DB and also in LDAP directory, otherwise I think that users are not able to log in to Airflow. |
Beta Was this translation helpful? Give feedback.
-
But did you actually check if they are in LDAP directory after you add them in Airflow manually (and whethere they were not there before)? Just add a new user in airflow and see if it appears in LDAP. As @BasPH mentioned - the LDAP syncrhronisation works in the way that LDAP users are synchronized from LDAP to Airflow DB (and this should be refreshed either periodically or at login). I highly doubt there is a way Airflow could create an LDAP user - it must have been in LDAP already when you added it. And in this case you should not "add" the users manually but you should run synchronisation to bring the LDAP users to Airflow. Eventually those users will end-up in Airflow DB but what @BasPH and myself are trying to say is that you should not need to add them manually - they should be automatically synchronized by Airflow. |
Beta Was this translation helpful? Give feedback.
-
I do not have access to check LDAP directory, but so far it has worked this way - if the user added doest not exist in LDAP it was just impossible to log in to Airflow. So I don't expect that when adding a user in Airflow, user will also be added to LDAP automatically. That was the way it worked flawlessly.
2.0.1: 2.1.0: can_add UserLDAPModelView As we can see here (and also in the source code) something has changed about LDAP settings. |
Beta Was this translation helpful? Give feedback.
-
Did some simple testing but haven't found the cause. Granted all possible permissions to the Admin role: -- Create all possible permissions for all views (added 389 rows)
insert into ab_permission_view (permission_id, view_menu_id)
(
select a.id, b.id
from ab_permission a
cross join
(select id from ab_view_menu) b
)
on conflict do nothing;
-- Add all permissions to Admin role (added 391 rows)
insert into ab_permission_view_role (permission_view_id, role_id)
(
select id, 1
from ab_permission_view
)
on conflict do nothing; But no button when logged in with Admin role. Between Airflow 2.0.1 and 2.1.3 the Flask-AppBuilder version changed from 3.1.1 to 3.3.2. There were some extensive changes to the LDAP authentication mechanism (PR), but I wasn't able to quickly pinpoint any potential changes with regards to falling back to local users. Regardless, I'd argue that this is the intended way it should work. If there is only one authentication mechanism (LDAP), then there shouldn't be a second place for users to live in. From a security perspective, having two places for user accounts to live in, increases the attack surface. You could ask your LDAP admin if it's possible for yourself/your team to create new accounts in your LDAP directory. Assuming you were using the local users for debugging purposes only, you might also want to look at account or password expiration options in your LDAP. |
Beta Was this translation helpful? Give feedback.
-
Hi, it turned out that this is a problem related to missing permissions in Airflow. Class CustomUserLDAPModelView inherits from MultiResourceUserMixin and I noticed there isn't can_create action, so what I did:
from:
to:
Everything was done on Airflow 2.1.3 version. |
Beta Was this translation helpful? Give feedback.
-
But will it work with sync without adding the user ? |
Beta Was this translation helpful? Give feedback.
-
@potiuk No, This works only if I add a new user directly from Airflow who is already in LDAP. Users existing in LDAP do not appear automatically in Airflow. This approach is right for me because it gives me an extra layer of authentication that I can manage myself. |
Beta Was this translation helpful? Give feedback.
-
I see - I created the issue back then #18545 and I understand where it came from - you simply do not want automated user registration with LDAP. That's fine and there are others with similar workflow. |
Beta Was this translation helpful? Give feedback.
-
Is there a similar fix for OAUTH? The register user button is not visible. |
Beta Was this translation helpful? Give feedback.
-
Apache Airflow version
2.1.3 (latest released)
Operating System
Amazon Linux AMI 2018.03
Versions of Apache Airflow Providers
No response
Deployment
Other Docker-based deployment
Deployment details
What happened
We upgraded Airflow from 2.0.1 to 2.1.3 and now when i log into Airflow (Admin role) using LDAP authentication and go to Security --> List Users i cannot see add button ("plus").
Airflow 2.0.1 (our current version):
Airflow 2.1.3:
What you expected to happen
Option to add a new user (using LDAP auth).
How to reproduce
Anything else
No response
Are you willing to submit PR?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions