Deploying test hosts for Authelia MFA authentication
This started as a single page but became too large to manage, I've now split it up into these sections.
- Authelia for MFA on docker
- This page: Deploying test hosts for Authelia MFA authentication
- Configuring Nginx reverse proxy in front of Authelia
- Configuring Caddy reverse proxy in front of Authelia
- Logging in to Authelia
Following on from part one we now need to deploy two separate hosts to test Authelia MFA. If you already have a web site or application then you may not need to do this. I have chosen to included it, so all steps are covered from deploying / configuring and using Authelia for MFA.
In this example I'm just going to use two docker apache servers, each with just a single web page. These will then be used later to confirm the 1 and 2 factor authentication is working.
Create directories
We need to set up a couple of directories in our main docker directory.
cd ~/docker
mkdir 1-factor-website/www -p
mkdir 2-factor-website/www -p
Create two web pages
Next we can create two really simple web pages to demonstrate a successful authentication.
echo "<html><head><head><body><H1>1_factor_web_site</h1></body></html>" >>1-factor-website/www/index.html
echo "<html><head><head><body><H1>2_factor_web_site</h1></body></html>" >>2-factor-website/www/index.html
Create the docker-compose files
We need to docker compose files, on for each separate web app, or web page in this example.
cd ~/docker/1-factor-website/
The create a docker-compose.yaml file with the information below:
services:
apache:
image: httpd:latest
container_name: 1-factor-website
ports:
- '8001:80'
volumes:
- ./www:/usr/local/apache2/htdocs
Then the second docker-compose.yaml file:
cd ~/docker/2-factor-website/
Containing the following information:
services:
apache:
image: httpd:latest
container_name: 2-factor-website
ports:
- '8002:80'
volumes:
- ./www:/usr/local/apache2/htdocs
Deploy the two example web apps
Each of the two apache web servers can now be started:
cd ~/docker/1-factor-website/
docker compose up -d
cd ~/docker/2-factor-website/
docker compose up -d
The result should be two containers now running each serving a very basic web site.
Confirm that the Containers are running
If we do a docker ps command now we have the following output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6ba6ccf4dbab httpd:latest "httpd-foreground" 57 seconds ago Up 55 seconds 0.0.0.0:8002->80/tcp, :::8002->80/tcp 2-factor-website
b9bc5cf4ead4 httpd:latest "httpd-foreground" About a minute ago Up About a minute 0.0.0.0:8001->80/tcp, :::8001->80/tcp 1-factor-website
cbbea3df4065 authelia/authelia:latest "/app/entrypoint.sh" 23 hours ago Up 22 hours (healthy) 0.0.0.0:9091->9091/tcp, :::9091->9091/tcp authelia
b3ffd4b3d811 postgres:15 "docker-entrypoint.s…" 23 hours ago Up 22 hours 5432/tcp auth_database
1ea07c6a02e4 redis:7 "docker-entrypoint.s…" 23 hours ago Up 22 hours 6379/tcp auth_redis
Next Steps
Once we have these sites running, and assuming that Authelia for the MFA functionality has been configured, and is up and running we can go to the next step of this blog series.