From 06f1e2910f7d680491dd5e7b6000286eae10c99e Mon Sep 17 00:00:00 2001 From: Simon C Date: Wed, 5 Jul 2023 14:57:00 +0200 Subject: [PATCH] feat(LLDAP): Add new service --- README.md | 1 + lldap/.env | 50 +++++++++++++++++++++++++++++++ lldap/README.md | 27 +++++++++++++++++ lldap/docker-compose.local.yml | 13 ++++++++ lldap/docker-compose.postgres.yml | 8 +++++ lldap/docker-compose.smtp.yml | 16 ++++++++++ lldap/docker-compose.traefik.yml | 23 ++++++++++++++ lldap/docker-compose.yml | 26 ++++++++++++++++ 8 files changed, 164 insertions(+) create mode 100644 lldap/.env create mode 100644 lldap/README.md create mode 100644 lldap/docker-compose.local.yml create mode 100644 lldap/docker-compose.postgres.yml create mode 100644 lldap/docker-compose.smtp.yml create mode 100644 lldap/docker-compose.traefik.yml create mode 100644 lldap/docker-compose.yml diff --git a/README.md b/README.md index b9ac8fd..5995101 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Vous trouverez dans ce dépôt l'ensemble des services Open Source que RésiLien - [GeoIP Update](./geoipupdate) : Permet de télécharger la base de données GeoIP2 permettant de localiser les IPs - [Gitea](./gitea) : Un service Git très simple à installer et à utiliser. Il est similaire à GitHub, Bitbucket ou Gitlab. - [Grafana](./grafana) : Un outil de supervision simple et élégant +- [LLDAP](./lldap): Implémentation légère de LDAP pour l'authentification - [PostgreSQL](./postgres) : PostgreSQL est un système de gestion de base de données relationnelle et objet. - [Prometheus](./prometheus) : Un logiciel de surveillance informatique - [Redis](./redis) : Système de gestion de base de données clé-valeur extensible, très hautes performances diff --git a/lldap/.env b/lldap/.env new file mode 100644 index 0000000..d254f6c --- /dev/null +++ b/lldap/.env @@ -0,0 +1,50 @@ +######## +# DOCKER + +SERVICES_DIR=.. +COMPOSE_FILE=${SERVICES_DIR}/lldap/docker-compose.yml:${SERVICES_DIR}/lldap/docker-compose.local.yml:${SERVICES_DIR}/postgres/docker-compose.yml +#COMPOSE_PROJECT_NAME= + +####### +# LLDAP + +LLDAP_DOMAIN=lldap.cool.life +LLDAP_VOLUME_NAME=lldap_cool_life +LLDAP_CONTAINER_NAME=lldap_cool_life +LLDAP_IMAGE=nitnelave/lldap:v0.4.3 + +LLDAP_JWT_SECRET="6IeP8UUbEkQXrkUNbnu1sGpcZOu29wUTWh3uiEgMorI=" +LLDAP_VERBOSE=true + +LLDAP_LDAP_BASE_DN="dc=cool,dc=life" +LLDAP_LDAP_USER_DN="myuser" +LLDAP_LDAP_USER_EMAIL="admin@cool.life" +LLDAP_LDAP_USER_PASS="mon-mot-de-passe" + +# LLDAP_TEST_EMAIL_TO= +# LLDAP_SMTP_OPTIONS__ENABLE_PASSWORD_RESET= +# LLDAP_SMTP_OPTIONS__SERVER= +# LLDAP_SMTP_OPTIONS__PORT= +# LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION= +# LLDAP_SMTP_OPTIONS__USER= +# LLDAP_SMTP_OPTIONS__PASSWORD= +# LLDAP_SMTP_OPTIONS__FROM= +# LLDAP_SMTP_OPTIONS__REPLY_TO= + + +########## +# POSTGRES + +POSTGRES_USER=user-example +POSTGRES_PASSWORD=password-example +POSTGRES_DB=postgres-database-name-example +POSTGRES_CONTAINER_NAME=lldap-postgres +POSTGRES_VOLUME_NAME=lldap-postgres +#POSTGRES_IMAGE= + +######### +# TRAEFIK + +#TRAEFIK_NETWORK_NAME= +#TRAEFIK_ROUTER_NAME= # Don't use char '.' +#TRAEFIK_ENTRYPOINTS= diff --git a/lldap/README.md b/lldap/README.md new file mode 100644 index 0000000..edefb1e --- /dev/null +++ b/lldap/README.md @@ -0,0 +1,27 @@ +# LLDAP + +> Implémentation légère de LDAP pour l'authentification : +> Ce projet est un serveur d'authentification léger (écrit en rust) qui fournit une interface LDAP simplifiée pour l'authentification. Il s'intègre avec de nombreux backends, de KeyCloak à [Authelia](https://github.com/lldap/lldap/blob/main/example_configs/authelia_config.yml) en passant par Nextcloud et plus encore ! + +## Documentation + +- Le fichier [`lldap_config.docker_template.toml`](https://github.com/lldap/lldap/blob/main/lldap_config.docker_template.toml) contient toute la configuration possible de l'outil. +- De base le projet utilise SQLite, mais on peut utiliser Postgres voir le fichier [`docker-compose.postgres.yml`](./docker-compose.postgres.yml) +- Le projet n'est pas [traduit](https://github.com/lldap/lldap/issues/20) actuellement +- Lors du lancement du service une clé est généré aléatoirement dans le fichier `private_key` du dossier `/data` du container, ce fichier est important il faut donc le sauvegarder puisque les mots de passe sont chiffrés en base avec. + +## Configuration + +La configuration a été séparée en 5 fichiers : + +- [`docker-compose.yml`](./docker-compose.yml) contient la configuration de base +- [`docker-compose.local.yml`](./docker-compose.local.yml) permettant de tester le service sans Traefik +- [`docker-compose.smtp.yml`](./docker-compose.smtp.yml) correspondant à la configuration du service SMTP +- [`docker-compose.postgres.yml`](./docker-compose.postgres.yml) pour configurer le service Postgres +- [`docker-compose.traefik.yml`](./docker-compose.traefik.yml) pour configurer automatiquement Traefik + +## Liens + +- [Code source](https://github.com/lldap/lldap) +- [Docker Hub](https://hub.docker.com/r/nitnelave/lldap) +- [Documentation](https://github.com/lldap/lldap/blob/main/lldap_config.docker_template.toml) diff --git a/lldap/docker-compose.local.yml b/lldap/docker-compose.local.yml new file mode 100644 index 0000000..b18217b --- /dev/null +++ b/lldap/docker-compose.local.yml @@ -0,0 +1,13 @@ +--- + +version: "3.8" + +services: + lldap: + ports: + # For LDAP + - "3890:3890" + # For LDAPS (LDAP Over SSL), enable port if LLDAP_LDAPS_OPTIONS__ENABLED set true, look env below + - "6360:6360" + # For the web front-end + - "17170:17170" diff --git a/lldap/docker-compose.postgres.yml b/lldap/docker-compose.postgres.yml new file mode 100644 index 0000000..cb017f8 --- /dev/null +++ b/lldap/docker-compose.postgres.yml @@ -0,0 +1,8 @@ +--- + +version: "3.8" + +services: + lldap: + environment: + - LLDAP_DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_CONTAINER_NAME}/${POSTGRES_DB} diff --git a/lldap/docker-compose.smtp.yml b/lldap/docker-compose.smtp.yml new file mode 100644 index 0000000..23024ae --- /dev/null +++ b/lldap/docker-compose.smtp.yml @@ -0,0 +1,16 @@ +--- + +version: "3.8" + +services: + lldap: + environment: + - LLDAP_TEST_EMAIL_TO=${LLDAP_TEST_EMAIL_TO} + - LLDAP_SMTP_OPTIONS__ENABLE_PASSWORD_RESET=${LLDAP_SMTP_OPTIONS__ENABLE_PASSWORD_RESET} + - LLDAP_SMTP_OPTIONS__SERVER=${LLDAP_SMTP_OPTIONS__SERVER} + - LLDAP_SMTP_OPTIONS__PORT=${LLDAP_SMTP_OPTIONS__PORT} + - LLDAP_SMTP_OPTIONS__SMTP_ENCRYPTION=${LLDAP_SMTP_OPTIONS__ENCRYPTION} + - LLDAP_SMTP_OPTIONS__USER=${LLDAP_SMTP_OPTIONS__USER} + - LLDAP_SMTP_OPTIONS__PASSWORD=${LLDAP_SMTP_OPTIONS__PASSWORD} + - LLDAP_SMTP_OPTIONS__FROM=${LLDAP_SMTP_OPTIONS__FROM} + - LLDAP_SMTP_OPTIONS__REPLY_TO=${LLDAP_SMTP_OPTIONS__TO} diff --git a/lldap/docker-compose.traefik.yml b/lldap/docker-compose.traefik.yml new file mode 100644 index 0000000..2ad1790 --- /dev/null +++ b/lldap/docker-compose.traefik.yml @@ -0,0 +1,23 @@ +--- + +version: "3.8" + +networks: + default: + name: ${TRAEFIK_NETWORK_NAME:-traefik} + +services: + lldap: + labels: + - traefik.enable=true + - traefik.docker.network=${TRAEFIK_NETWORK_NAME:-traefik} + - traefik.http.routers.${TRAEFIK_ROUTER_NAME:-lldap}.rule=Host(`${LLDAP_DOMAIN:?err}`) + - traefik.http.routers.${TRAEFIK_ROUTER_NAME:-lldap}.entrypoints=${TRAEFIK_ENTRYPOINTS:-web} + # - traefik.http.routers.${TRAEFIK_ROUTER_NAME:-lldap}.tls.certResolver=letsencrypt + - traefik.http.services.${TRAEFIK_ROUTER_NAME:-lldap}.loadbalancer.server.port=17170 + - traefik.http.services.${TRAEFIK_ROUTER_NAME:-lldap}.loadbalancer.server.scheme=http + + # https://github.com/lldap/lldap/issues/247#issuecomment-1489962511 + # - traefik.tcp.routers.${TRAEFIK_ROUTER_NAME:-lldap}.rule=HostSNI(`${LLDAP_DOMAIN:?err}`) + # - traefik.tcp.routers.${TRAEFIK_ROUTER_NAME:-lldap}.entrypoints=${TRAEFIK_ENTRYPOINTS:-web} + # - traefik.tcp.services.${TRAEFIK_ROUTER_NAME:-lldap}.loadbalancer.server.port=3890 diff --git a/lldap/docker-compose.yml b/lldap/docker-compose.yml new file mode 100644 index 0000000..31d7a44 --- /dev/null +++ b/lldap/docker-compose.yml @@ -0,0 +1,26 @@ +--- + +version: "3.8" + +volumes: + lldap: + name: ${LLDAP_VOLUME_NAME:-lldap} + +services: + lldap: + container_name: ${LLDAP_CONTAINER_NAME:-lldap} + image: ${LLDAP_IMAGE:-nitnelave/lldap:v0.4.3} + restart: always + volumes: + - "lldap:/data" + environment: + - TZ=${TIMEZONE:-Europe/Paris} + - LLDAP_VERBOSE=${LLDAP_VERBOSE:-false} + + - LLDAP_JWT_SECRET=${LLDAP_JWT_SECRET:?err} + - LLDAP_HTTP_URL=https://${LLDAP_DOMAIN:?err} + + - LLDAP_LDAP_BASE_DN=${LLDAP_LDAP_BASE_DN:?err} + - LLDAP_LDAP_USER_DN=${LLDAP_LDAP_USER_DN:?err} + - LLDAP_LDAP_USER_EMAIL=${LLDAP_LDAP_USER_EMAIL:?err} + - LLDAP_LDAP_USER_PASS=${LLDAP_LDAP_USER_PASS:?err}