Local Authentication Example¶
This section describes how to enable local authentication in Driverless AI.
Enabling Local Auth in Docker Images¶
To enable authentication in Docker images, specify the authentication environment variable that you want to use. Each variable must be prepended with DRIVERLESS_AI_. Replace TAG below with the image tag. The example below starts Driverless AI with environment variables the enable the following:
- Local authentication when starting Driverless AI
- S3 and HDFS access (without authentication)
nvidia-docker run \
--pid=host \
--init \
--rm \
--shm-size=256m \
-p 12345:12345 \
-u `id -u`:`id -g` \
-e DRIVERLESS_AI_ENABLED_FILE_SYSTEMS="file,s3,hdfs" \
-e DRIVERLESS_AI_AUTHENTICATION_METHOD="local" \
-e DRIVERLESS_AI_LOCAL_HTPASSWD_FILE="<htpasswd_file_location>" \
-v `pwd`/data:/data \
-v `pwd`/log:/log \
-v `pwd`/license:/license \
-v `pwd`/tmp:/tmp \
h2oai/dai-centos7-x86_64:TAG
Enabling Local Auth in the config.toml File for Native Installs¶
Native installs include DEBs, RPMs, and TAR SH installs. The example below shows the environment variables in the config.toml file to set when enabling the following:
- Local authentication when starting Driverless AI
- S3 and HDFS access (without authentication)
- Export the Driverless AI config.toml file or add it to ~/.bashrc. For example:
# DEB and RPM export DRIVERLESS_AI_CONFIG_FILE="/etc/dai/config.toml" # TAR SH export DRIVERLESS_AI_CONFIG_FILE="/path/to/your/unpacked/dai/directory/config.toml"
- Open the config.toml file and edit the authentication variables. The config.toml file is available in the etc/dai folder after the RPM or DEB is installed.
# File System Support # file : local file system/server file system # hdfs : Hadoop file system, remember to configure the hadoop coresite and keytab below # s3 : Amazon S3, optionally configure secret and access key below # gcs : Google Cloud Storage, remember to configure gcs_path_to_service_account_json below # gbq : Google Big Query, remember to configure gcs_path_to_service_account_json below enabled_file_systems = "file,s3,hdfs" # authentication_method # unvalidated : Accepts user id and password, does not validate password # none : Does not ask for user id or password, authenticated as admin # pam : Accepts user id and password, Validates user with operating system # ldap : Accepts user id and password, Validates against an ldap server, look # local: Accepts a user id and password, Validated against a htpasswd file provided in local_htpasswd_file # for additional settings under LDAP settings authentication_method = "local" # Local password file # Generating a htpasswd file: see syntax below # htpasswd -B "<location_to_place_htpasswd_file>" "<username>" # note: -B forces use of brcypt, a secure encryption method local_htpasswd_file = "<htpasswd_file_location>"
- Start (or restart) Driverless AI. Note that the command used to start Driverless AI varies depending on your install type.
# Linux RPM or DEB with systemd sudo systemctl start dai # Linux RPM or DEB without systemd sudo -H -u dai /opt/h2oai/dai/run-dai.sh # Linux TAR SH ./run-dai.sh