Go back

How to secure User Registration

This page describes how admin user can limit new user registration for specific domain. The domain can be any random domain as the app does not validate domain ownership, it uses it for whitelisting user registration from that specified domain.

Follow below steps for domain whitelisting:

  1. Open .env file located at /home/ubuntu/setup/danswer/deployment/docker_compose using
sudo vi /home/ubuntu/setup/danswer/deployment/docker_compose/.env

/img/aws/danswer/open-env.png

  1. Uncomment VALID_EMAIL_DOMAINS=xyz.com,example.org line. Provide the domain you want to whitelist. Save the changes using pressing escape and entering :wq.

/img/aws/danswer/uncomment-domain.png

  1. Once the file is saved, run below commands.
sudo docker ps |cut -d " " -f 1|xargs sudo docker stop
sudo docker ps -a|cut -d " " -f 1|xargs sudo docker rm

/img/aws/danswer/docker-stop.png

/img/aws/danswer/docker-remove.png

  1. Now navigate to docker-compose directory.
cd setup/danswer/deployment/docker_compose/

/img/aws/danswer/docker-compose.png

  1. Start the docker containers by running below command and wait for few seconds.
sudo docker compose -f /home/ubuntu/setup/danswer/deployment/docker_compose/docker-compose.prod-no-letsencrypt.yml -p danswer-stack up -d --force-recreate

/img/aws/danswer/docker-recreate.png

  1. Now you should be able to create a user with email id with the specified domain name. open the login page and click on Create an account option.

/img/aws/danswer/new-user.png

/img/aws/danswer/welcome-page.png

And it should restrict users from other domains.

/img/aws/danswer/restricted-domain.png

Go back