TKWS239 / mlflow-ldap

MLflow ldap and audit log integration
Apache License 2.0
6 stars 0 forks source link

MLFlow Basic Authentication and Server Setup

This README provides guidance on setting up basic authentication for MLFlow using LDAP and starting the MLFlow server with the necessary configurations.

Configuration File: basic_auth.ini

This file configures the basic authentication for MLFlow. The settings include:

Requirement:

basic_auth.ini example:

[mlflow]
default_permission = READ
database_uri = sqlite:///basic_auth.db
admin_username = admin
admin_password = password
authorization_function = mlflow.ldap:authenticate_request

Server Startup Instructions

Step 0: Git clone and replace the files to your local directory.

Step 1: install MLFlow

Install the offical MLFlow (2.14.2 as example):

pip install mlflow==2.14.2
pip install ldap3

Step 2: Set Environment Variables Configure the environment variables for LDAP and logging:

# Replace the file to the source code
mv /server/__init__.py  /usr/local/lib/python3.10/site-packages/mlflow/server/__init__.py && \
mv /utils/logging_utils.py /usr/local/lib/python3.10/site-packages/mlflow/utils/logging_utils.py && \
mv /mlflow/ldap_auth.py /usr/local/lib/python3.10/site-packages/mlflow/ldap_auth.py
export MLFLOW_AUTH_CONFIG_PATH=$BASE_DIR/basic_auth.ini
export LDAP_SERVER=your_ldap_server_address
export LDAP_DOMAIN=your_ad_domain
export USER_AD_GROUP=your_normal_user_role_adgroup
export ADMIN_AD_GROUP=your_admin_user_role_adgroup
export BASE_DN=your_ad_dn

Replace the variable appliable with your ad server

Step 3: Start MLFlow Server

Use the following command to start the MLFlow server:

mlflow server --dev --serve-artifacts --app-name basic-auth --host 0.0.0.0 --port 8000 --artifacts-destination <URI>

Replace with your artifacts destination URI.