airflow-ldap-auth-manager 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airflow_ldap_auth_manager-0.1.0/LICENSE +201 -0
- airflow_ldap_auth_manager-0.1.0/PKG-INFO +333 -0
- airflow_ldap_auth_manager-0.1.0/README.md +311 -0
- airflow_ldap_auth_manager-0.1.0/pyproject.toml +44 -0
- airflow_ldap_auth_manager-0.1.0/setup.cfg +4 -0
- airflow_ldap_auth_manager-0.1.0/src/airflow_ldap_auth_manager/__init__.py +5 -0
- airflow_ldap_auth_manager-0.1.0/src/airflow_ldap_auth_manager/ldap_auth_manager.py +733 -0
- airflow_ldap_auth_manager-0.1.0/src/airflow_ldap_auth_manager/static/airflow.svg +13 -0
- airflow_ldap_auth_manager-0.1.0/src/airflow_ldap_auth_manager/static/style.css +138 -0
- airflow_ldap_auth_manager-0.1.0/src/airflow_ldap_auth_manager/templates/ldap_login.html +41 -0
- airflow_ldap_auth_manager-0.1.0/src/airflow_ldap_auth_manager.egg-info/PKG-INFO +333 -0
- airflow_ldap_auth_manager-0.1.0/src/airflow_ldap_auth_manager.egg-info/SOURCES.txt +13 -0
- airflow_ldap_auth_manager-0.1.0/src/airflow_ldap_auth_manager.egg-info/dependency_links.txt +1 -0
- airflow_ldap_auth_manager-0.1.0/src/airflow_ldap_auth_manager.egg-info/requires.txt +4 -0
- airflow_ldap_auth_manager-0.1.0/src/airflow_ldap_auth_manager.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: airflow-ldap-auth-manager
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LDAP-based AuthManager for Apache Airflow 3.x
|
|
5
|
+
Author-email: Emre Can <emredjan@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/emredjan/airflow-ldap-auth-manager
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Framework :: Apache Airflow
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: apache-airflow>=3.1.0
|
|
18
|
+
Requires-Dist: ldap3>=2.9
|
|
19
|
+
Requires-Dist: fastapi>=0.110
|
|
20
|
+
Requires-Dist: jinja2>=3.1
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
> [!NOTE]
|
|
24
|
+
> The code in this repository is written with the help of AI (specifically, ChatGPT 5), including this README (lazy, I know). Although I tried my best to streamline and validate most of it, there may still be some intricacies that need to be sorted out.
|
|
25
|
+
|
|
26
|
+
# Airflow LDAP Auth Manager
|
|
27
|
+
|
|
28
|
+
A drop-in **Auth Manager** for **Apache Airflow 3.x** that authenticates users against **LDAP/Active Directory** and maps LDAP groups to Airflow roles (**admin / editor / viewer**). It supports redundant LDAP servers, secure transport (LDAPS or StartTLS), and secret indirection for bind credentials via Airflow’s **Secrets Backend** (Variables).
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- **LDAP/AD authentication** using [`ldap3`](https://ldap3.readthedocs.io/)
|
|
33
|
+
- **Group → role mapping** (admin > editor > viewer)
|
|
34
|
+
- **Redundancy & failover** via `ldap3.ServerPool` (ROUND_ROBIN by default)
|
|
35
|
+
- **TLS: LDAPS or StartTLS** (with certificate verification)
|
|
36
|
+
- **Secrets-friendly config:** `bind_dn_secret` and `bind_password_secret` read from Airflow Variables (resolved through your configured secrets backend)
|
|
37
|
+
- **Clean Airflow 3 API:** uses the Airflow SDK (`airflow.sdk.*`)
|
|
38
|
+
- **Simple login UI** with configurable instance name and login tip
|
|
39
|
+
- **Helpful logging:** logs which LDAP server the connection bound to
|
|
40
|
+
|
|
41
|
+
## To-do
|
|
42
|
+
|
|
43
|
+
- [x] Extend the user & group search base config items to allow multiple entries (or LDAP `OR` syntax)
|
|
44
|
+
- [x] Package this and upload to pypi
|
|
45
|
+
|
|
46
|
+
## Requirements
|
|
47
|
+
|
|
48
|
+
- **Python:** 3.12+
|
|
49
|
+
- **Airflow:** 3.1+ (Auth Manager interface & SDK)
|
|
50
|
+
- **Libraries:** `ldap3`, `fastapi`, `jinja2` (`fastapi` & `jinja2` is likely installed already as Airflow dependencies)
|
|
51
|
+
- **Optional (recommended):** a Secrets Backend (Vault, AWS Secrets Manager, GCP SM, Azure KV) configured for Airflow Variables
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
Install from PyPi into the environment where Airflow is installed:
|
|
56
|
+
|
|
57
|
+
```shell
|
|
58
|
+
pip install airflow-ldap-auth-manager
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Or install after cloning the project:
|
|
63
|
+
|
|
64
|
+
```shell
|
|
65
|
+
git clone <repo url>
|
|
66
|
+
cd airflow-ldap-auth-manager
|
|
67
|
+
pip install .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Configure Airflow
|
|
71
|
+
|
|
72
|
+
Changes needed in `airflow.cfg`:
|
|
73
|
+
|
|
74
|
+
### Enable the Auth Manager
|
|
75
|
+
|
|
76
|
+
```ini
|
|
77
|
+
[core]
|
|
78
|
+
# Fully qualified path to the auth manager class in this repo
|
|
79
|
+
auth_manager = airflow_ldap_auth_manager.LDAPAuthManager
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Make sure JWT settings are configured correctly
|
|
84
|
+
|
|
85
|
+
```ini
|
|
86
|
+
[api_auth]
|
|
87
|
+
jwt_secret = # Needs to be set
|
|
88
|
+
jwt_algorithm = # Either leave empty, or make sure consistent across all machines
|
|
89
|
+
jwt_audience = # Either leave empty, or make sure consistent across all machines
|
|
90
|
+
jwt_issuer = # Either leave empty, or make sure consistent across all machines
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### LDAP settings
|
|
94
|
+
|
|
95
|
+
Add a section for the LDAP auth manager (adjust to your environment):
|
|
96
|
+
|
|
97
|
+
```ini
|
|
98
|
+
[ldap_auth_manager]
|
|
99
|
+
server_uri = ldaps://ldap1.example.com:636,ldaps://ldap2.example.com:636
|
|
100
|
+
bind_dn =
|
|
101
|
+
bind_password =
|
|
102
|
+
bind_dn_secret = secret/path/to/airflow/variable/for/bind_dn
|
|
103
|
+
bind_password_secret = path/to/airflow/variable/for/bind_password
|
|
104
|
+
user_search_base = OU=Users,DC=company_name
|
|
105
|
+
user_search_filter = (|(uid={username})(sAMAccountName={username})(mail={username}))
|
|
106
|
+
group_search_base = OU=Groups,DC=company_name
|
|
107
|
+
group_member_attr = member
|
|
108
|
+
admin_groups = airflow-admins
|
|
109
|
+
editor_groups = airflow-editors
|
|
110
|
+
viewer_groups = airflow-viewers,airflow-auditors
|
|
111
|
+
username_attr = uid
|
|
112
|
+
email_attr = mail
|
|
113
|
+
start_tls = false
|
|
114
|
+
verify_ssl = true
|
|
115
|
+
post_login_redirect = /
|
|
116
|
+
logout_redirect = /
|
|
117
|
+
debug_logging = false
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Environment variable overrides are supported in the standard Airflow fashion, e.g.:`
|
|
121
|
+
|
|
122
|
+
`AIRFLOW__LDAP_AUTH_MANAGER__BIND_DN_SECRET=api_server/ldap_auth_manager/bind_dn`
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Branding & login hint (optional)
|
|
126
|
+
|
|
127
|
+
```ini
|
|
128
|
+
[api]
|
|
129
|
+
# Human-friendly name for titles/headers on the login page
|
|
130
|
+
instance_name = Company Airflow
|
|
131
|
+
|
|
132
|
+
[ldap_auth_manager]
|
|
133
|
+
# Optional helper text shown under "Sign in"
|
|
134
|
+
login_tip = Using your Company credentials
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Restart the api-server after changes.
|
|
138
|
+
|
|
139
|
+
## Configuration reference
|
|
140
|
+
|
|
141
|
+
``` ini
|
|
142
|
+
[ldap_auth_manager]
|
|
143
|
+
# LDAP authentication/authorization settings for LDAPAuthManager.
|
|
144
|
+
# This section supports multiple redundant servers, secure transport (LDAPS or StartTLS),
|
|
145
|
+
# and secret indirection for bind credentials via Airflow’s Secrets Backend.
|
|
146
|
+
|
|
147
|
+
# Comma-separated list of LDAP server URIs.
|
|
148
|
+
# - Supports ldap:// and ldaps:// schemes.
|
|
149
|
+
# - When multiple URIs are provided, the manager builds an ldap3 ServerPool with ROUND_ROBIN
|
|
150
|
+
# strategy for load distribution and failover.
|
|
151
|
+
# - For ldaps://, TLS is implicit from connect; for ldap:// + start_tls=true, StartTLS is
|
|
152
|
+
# negotiated before bind.
|
|
153
|
+
# - Mixing ldaps:// with start_tls=true is not meaningful; prefer one approach.
|
|
154
|
+
#
|
|
155
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__SERVER_URI
|
|
156
|
+
#
|
|
157
|
+
server_uri = ldaps://ldap1.example.com:636,ldaps://ldap2.example.com:636
|
|
158
|
+
|
|
159
|
+
# Name of the Airflow Variable that contains the LDAP bind DN (service account).
|
|
160
|
+
# The Variable is resolved through the configured Secrets Backend (e.g. Vault, AWS SM, etc.).
|
|
161
|
+
# If set, any plaintext `bind_dn` value is ignored. Leave empty to attempt anonymous bind.
|
|
162
|
+
# Remember: This needs to be set in the "Airflow/Variables" section in your secret manager,
|
|
163
|
+
# NOT "Airflow/Config"!
|
|
164
|
+
#
|
|
165
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__BIND_DN_SECRET
|
|
166
|
+
#
|
|
167
|
+
bind_dn_secret = secret/path/to/airflow/variable/for/bind_dn
|
|
168
|
+
bind_dn =
|
|
169
|
+
|
|
170
|
+
# Name of the Airflow Variable that contains the LDAP bind password (service account).
|
|
171
|
+
# The Variable is resolved through the configured Secrets Backend.
|
|
172
|
+
# If set, any plaintext `bind_password` value is ignored.
|
|
173
|
+
# Remember: This needs to be set in the "Airflow/Variables" section in your secret manager,
|
|
174
|
+
# NOT "Airflow/Config"!
|
|
175
|
+
#
|
|
176
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__BIND_PASSWORD_SECRET
|
|
177
|
+
#
|
|
178
|
+
bind_password_secret = path/to/airflow/variable/for/bind_password
|
|
179
|
+
bind_password =
|
|
180
|
+
|
|
181
|
+
# Base DN under which user entries are searched.
|
|
182
|
+
# Example (Active Directory): OU=Users,OU=Country,DC=example,DC=com
|
|
183
|
+
# Supports multiple base DNs, separated by newlines, semicolons, or as a JSON array.
|
|
184
|
+
#
|
|
185
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__USER_SEARCH_BASE
|
|
186
|
+
#
|
|
187
|
+
user_search_base = OU=Users,DC=company_name
|
|
188
|
+
|
|
189
|
+
# LDAP filter template to locate the authenticating user.
|
|
190
|
+
# The literal "{username}" placeholder is replaced with the submitted login identifier.
|
|
191
|
+
# Must be a valid RFC 4515 filter. The username value is safely escaped before substitution.
|
|
192
|
+
# Example: (|(uid={username})(sAMAccountName={username})(mail={username}))
|
|
193
|
+
#
|
|
194
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__USER_SEARCH_FILTER
|
|
195
|
+
#
|
|
196
|
+
user_search_filter = (|(uid={username})(sAMAccountName={username})(mail={username}))
|
|
197
|
+
|
|
198
|
+
# Base DN under which group entries are searched for authorization.
|
|
199
|
+
#
|
|
200
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__GROUP_SEARCH_BASE
|
|
201
|
+
#
|
|
202
|
+
group_search_base = OU=Groups,DC=company_name
|
|
203
|
+
|
|
204
|
+
# The group attribute that lists membership (DNs of user entries).
|
|
205
|
+
# Common values:
|
|
206
|
+
# - Active Directory: member
|
|
207
|
+
# - RFC2307/posix groups: memberUid (then matching is by username instead of DN)
|
|
208
|
+
#
|
|
209
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__GROUP_MEMBER_ATTR
|
|
210
|
+
#
|
|
211
|
+
group_member_attr = member
|
|
212
|
+
|
|
213
|
+
# Comma-separated list of groups that grant the Airflow "admin" role.
|
|
214
|
+
# Values can be group CNs or full DNs under group_search_base (matching is case-insensitive).
|
|
215
|
+
#
|
|
216
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__ADMIN_GROUPS
|
|
217
|
+
#
|
|
218
|
+
admin_groups = airflow-admins
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
# Comma-separated list of groups that grant the Airflow "editor" role.
|
|
222
|
+
# Leave empty to disable this mapping.
|
|
223
|
+
#
|
|
224
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__EDITOR_GROUPS
|
|
225
|
+
#
|
|
226
|
+
editor_groups = airflow-editors
|
|
227
|
+
|
|
228
|
+
# Comma-separated list of groups that grant the Airflow "viewer" role.
|
|
229
|
+
# Users are mapped to the highest role matched (admin > editor > viewer).
|
|
230
|
+
#
|
|
231
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__VIEWER_GROUPS
|
|
232
|
+
#
|
|
233
|
+
viewer_groups = airflow-viewers,airflow-auditors
|
|
234
|
+
|
|
235
|
+
# Attribute on the user entry to use as the Airflow username.
|
|
236
|
+
# Typical values: uid, sAMAccountName, userPrincipalName
|
|
237
|
+
#
|
|
238
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__USERNAME_ATTR
|
|
239
|
+
#
|
|
240
|
+
username_attr = uid
|
|
241
|
+
|
|
242
|
+
# Attribute on the user entry that contains the email address.
|
|
243
|
+
# Typical values: mail, userPrincipalName
|
|
244
|
+
#
|
|
245
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__EMAIL_ATTR
|
|
246
|
+
#
|
|
247
|
+
email_attr = mail
|
|
248
|
+
|
|
249
|
+
# Whether to perform StartTLS on ldap:// connections before bind.
|
|
250
|
+
# - true : Use StartTLS (only applies to ldap:// URIs).
|
|
251
|
+
# - false : Do not use StartTLS. For ldaps:// URIs, TLS is already implicit.
|
|
252
|
+
#
|
|
253
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__START_TLS
|
|
254
|
+
#
|
|
255
|
+
start_tls = false
|
|
256
|
+
|
|
257
|
+
# Whether to verify the server certificate for TLS (ldaps or StartTLS).
|
|
258
|
+
# Set to true in production with a valid trust store. Set to false only for testing.
|
|
259
|
+
#
|
|
260
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__VERIFY_SSL
|
|
261
|
+
#
|
|
262
|
+
verify_ssl = true
|
|
263
|
+
|
|
264
|
+
# Path (relative to the Airflow web root) to redirect a user after successful login.
|
|
265
|
+
# Example: "/" or "/home"
|
|
266
|
+
#
|
|
267
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__POST_LOGIN_REDIRECT
|
|
268
|
+
#
|
|
269
|
+
post_login_redirect = /
|
|
270
|
+
|
|
271
|
+
# Path (relative to the Airflow web root) to redirect a user after logout.
|
|
272
|
+
# Example: "/" or "/login"
|
|
273
|
+
#
|
|
274
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__LOGOUT_REDIRECT
|
|
275
|
+
#
|
|
276
|
+
logout_redirect = /
|
|
277
|
+
|
|
278
|
+
# Enable debug logging for LDAP operations.
|
|
279
|
+
# This can be useful to troubleshoot LDAP issues, but beware that it may log
|
|
280
|
+
# sensitive information such as usernames and group names.
|
|
281
|
+
#
|
|
282
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__DEBUG_LOGGING
|
|
283
|
+
#
|
|
284
|
+
debug_logging = false
|
|
285
|
+
|
|
286
|
+
# Optional login hint shown under "Sign in". Leave empty to hide.
|
|
287
|
+
#
|
|
288
|
+
# Variable: AIRFLOW__LDAP_AUTH_MANAGER__LOGIN_TIP
|
|
289
|
+
#
|
|
290
|
+
login_tip = Using your Company credentials
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## UI & templates
|
|
295
|
+
|
|
296
|
+
- Login template: `ldap_login.html`
|
|
297
|
+
- Static assets are served under `/auth/static/` (e.g. `/auth/static/style.css`, `/auth/static/airflow.svg`)
|
|
298
|
+
- Form posts to `/auth/token`
|
|
299
|
+
|
|
300
|
+
If you see 404 Not Found for `/auth/static/...`, ensure the StaticFiles mount path in your FastAPI router matches the URLs used in the template.
|
|
301
|
+
|
|
302
|
+
## Logging & diagnostics
|
|
303
|
+
|
|
304
|
+
If `debug_logging = true` in config:
|
|
305
|
+
|
|
306
|
+
After successful bind, the manager logs which LDAP server was selected from the pool, e.g.:
|
|
307
|
+
|
|
308
|
+
```log
|
|
309
|
+
LDAP bound to ldaps://ldap2.example.com:636 (pool_strategy=ROUND_ROBIN, start_tls=False)
|
|
310
|
+
```
|
|
311
|
+
Optionally, it can log the authenticated identity via the LDAP `whoami` extended operation.
|
|
312
|
+
|
|
313
|
+
## Security notes
|
|
314
|
+
|
|
315
|
+
- **Choose one TLS mode:** either `ldaps://...` or `ldap://` with `start_tls=true`. Mixing them is discouraged.
|
|
316
|
+
- Keep `verify_ssl = true` in production and ensure your trust store contains the issuing CA(s).
|
|
317
|
+
- Bind credentials should preferrably be supplied via `*_secret` indirection (Variables → Secrets Backend), not plaintext.
|
|
318
|
+
|
|
319
|
+
## Troubleshooting
|
|
320
|
+
|
|
321
|
+
- **Can’t bind / invalid credentials:** test with `ldapsearch` using the same DN/password and base/filter.
|
|
322
|
+
- **User not found:** verify `user_search_base` and `user_search_filter` (remember `{username}` substitution).
|
|
323
|
+
- **Group mapping not applied:** confirm `group_search_base`, `group_member_attr`, and that your groups are in the configured bases.
|
|
324
|
+
- **TLS errors:** verify certificates and CA chain; ensure the hostname matches the server certificate CN/SAN.
|
|
325
|
+
- **Static assets 404:** check the FastAPI `StaticFiles` mount matches `/auth/static`.
|
|
326
|
+
|
|
327
|
+
## Contributing
|
|
328
|
+
|
|
329
|
+
Issues and PRs are welcome. Please include:
|
|
330
|
+
|
|
331
|
+
- A clear description of the problem or feature
|
|
332
|
+
- Repro steps or tests when possible
|
|
333
|
+
- Your Airflow, Python, and LDAP server versions
|