2024-10-10 15:46:06 +02:00
|
|
|
# Traefik Authelia
|
2024-10-09 17:40:49 +02:00
|
|
|
|
2024-10-10 15:46:06 +02:00
|
|
|
## Introduction
|
|
|
|
|
|
|
|
This project sets up a Traefik reverse proxy with support for Authelia using Docker Compose. Traefik is a modern HTTP
|
|
|
|
reverse proxy and load balancer that makes deploying microservices and integrating them with your existing
|
|
|
|
infrastructure easy. Authelia is an open-source authentication and authorization server that provides 2FA (two-factor
|
|
|
|
authentication) and SSO (single sign-on) capabilities, adding an additional layer of security to your services.
|
|
|
|
|
|
|
|
## Table of Contents
|
|
|
|
|
|
|
|
- [Introduction](#introduction)
|
|
|
|
- [Prerequisites](#prerequisites)
|
|
|
|
- [Installation](#installation)
|
|
|
|
- [Usage](#usage)
|
|
|
|
- [Protecting Other Services](#protecting-other-services)
|
|
|
|
- [License](#license)
|
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
|
|
|
- Docker: Make sure Docker is installed and running on your system.
|
|
|
|
- Docker Compose: You also need Docker Compose to orchestrate the container setup.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
1. Clone the repository:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
git clone https://git.van-hemmen.com/GuillaumeHemmen-DockerCompose-Infra/traefik-authelia.git
|
|
|
|
cd traefik-authelia
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Copy the environment variable template:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cp .env.dist .env
|
|
|
|
```
|
|
|
|
|
|
|
|
3. Customize the `.env` file as necessary for your environment.
|
|
|
|
|
|
|
|
4. Copy the Authelia configuration template:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cp ./authelia/configuration.yml.dist ./authelia/configuration.yml
|
|
|
|
```
|
|
|
|
|
|
|
|
5. Customize the `./authelia/configuration.yml` file as necessary for your environment.
|
|
|
|
|
|
|
|
6. Copy the Authelia user database template:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cp ./authelia/users_database.yml.dist ./authelia/users_database.yml
|
|
|
|
```
|
|
|
|
|
|
|
|
7. Customize the `./authelia/users_database.yml` file as necessary for your environment. See
|
|
|
|
the [official documentation](https://www.authelia.com/reference/guides/passwords/) for more information.
|
|
|
|
|
|
|
|
8. Create the `acme.json` file and grant it the proper rights:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
touch ../acme.json && chmod 600 ../acme.json
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
1. Start the Traefik service with Docker Compose:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
docker compose up -d
|
|
|
|
```
|
|
|
|
|
|
|
|
2. You can now start adding your services and configure Traefik to reverse proxy to them.
|
|
|
|
|
|
|
|
## Protecting Other Services
|
|
|
|
|
|
|
|
To protect other services using this instance of Traefik and Authelia, simply add the following label to their
|
|
|
|
`docker-compose.yml` configuration:
|
|
|
|
|
|
|
|
```yml
|
|
|
|
- 'traefik.http.routers.<serviceName>.middlewares=authelia@docker'
|
|
|
|
```
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file for details.
|