19

I have a fork of apache airflow which I want to run behind a proxy server. All the authentication will be already handled outside airflow, thus I don't want the customers to login with another set of credentials again. Is there any way to completely remove/disable the authentication from airflow.

Basically, I want to get rid of this initial login screen and allow anyone who reaches airflow to have user (not admin) access. [Worst case admin access is also ok.]

enter image description here

Ankit Basarkar
  • 1,239
  • 3
  • 12
  • 13

5 Answers5

9

If anyone is using docker, this worked for me(airflow 2.0.1):

  1. Add a copy of webserver_config.py somewhere in your project.
  2. Uncomment AUTH_ROLE_PUBLIC and set 'Admin' as the value.
AUTH_ROLE_PUBLIC = 'Admin'
  1. Add these settings to your .cfg file.
[webserver]
rbac = False
authenticate = False
  1. In your Dockerfile, add the command to copy the webserver_config.py into the /home/airflow directory. e.g:
ADD airflow/webserver_config.py /home/airflow

Once you spin up the pod, config file should be appended to the directory disabling the authentication.

Rolando Ardon
  • 109
  • 1
  • 3
  • Thanks for this, I'm starting to think Airflow 2.0.1 (or the docker container) has rbac enabled always. Without the webserver_config file you can't control it at all. – Hitobat Apr 27 '21 at 16:56
  • 3
    I managed to find some official docs about it [here](https://airflow.apache.org/docs/apache-airflow/stable/upgrading-to-2.html#step-5-upgrade-airflow-dags). It's the very last point, just before step 6. rbac is the only auth now, so settings from step 3 are completely removed/disabled. – Hitobat Apr 27 '21 at 17:48
  • were you able to see the flask UI? – shruti bidada Sep 27 '21 at 22:31
  • The `rbac` and `authenticate` option no longer exist or no longer documented in [Airflow 2.5.3 config reference](https://airflow.apache.org/docs/apache-airflow/2.5.3/configurations-ref.html#webserver) for – Keto Apr 20 '23 at 17:25
4

Change the authenticate value to false in airflow config file (airflow.cfg) and restart the airflow,

# Set to true to turn on authentication:
# https://airflow.apache.org/security.html#web-authentication
authenticate = False

RBAC,

rbac = False
Anup
  • 250
  • 1
  • 6
4

For airflow 2.0.1 and later:

In file: $AIRFLOW_HOME/webserver_config.py

add/edit this line (note that by default it says = 'Public' and you need to change it!)

AUTH_ROLE_PUBLIC = 'Admin'

Documentation about this argument: https://airflow.apache.org/docs/apache-airflow/stable/security/webserver.html#web-authentication

The feature was added in this PR/change: https://github.com/apache/airflow/pull/13191 which was merged into airflow 2.0.1

Geobio Boo
  • 1,284
  • 1
  • 10
  • 12
0

I created a new user "Admin" with "Admin" role using the following command, and it works for me:

$ airflow users create \
      --username Admin \
      --firstname FIRST_NAME \
      --lastname LAST_NAME \
      --role Admin \
      --email admin@example.org
YNR
  • 867
  • 2
  • 13
  • 28
0

One way is to disable the RBAC via an environment variable. Make sure you set the following before starting the webserver:

export AIRFLOW__WEBSERVER__RBAC=False

See here for more details. The other answers here will all work as well!