From 932fa6906c5eb03563c787df2fac9cf67e3f74e2 Mon Sep 17 00:00:00 2001
From: dobli <dobler.alex@gmail.com>
Date: Fri, 18 Jan 2019 12:14:05 +0100
Subject: [PATCH] modified example to enable bcrypt in treafik and external
 users file

---
 README.md                     | 4 +++-
 configs/traefik/traefik.toml  | 3 ++-
 configs/traefik/traefik_users | 1 +
 docker-compose.yml            | 8 ++++++--
 4 files changed, 12 insertions(+), 4 deletions(-)
 create mode 100644 configs/traefik/traefik_users

diff --git a/README.md b/README.md
index 15bcf88..064f9f8 100644
--- a/README.md
+++ b/README.md
@@ -121,7 +121,9 @@ The openhab-pb stack consists of multiple configuration files that need to be av
 
 - *traefik.toml*: basic traefik configuration
   - copy from template folder 
-  - entryPoints.http.auth.basic contains users generated with htpasswd
+  - entryPoints.http.auth.basic contains usersFile that describes the path to a htpasswd file
+- *traefik_users*: htpasswd style file that contains users and hashed passwords
+  - generated
 
 **volumerize**
 
diff --git a/configs/traefik/traefik.toml b/configs/traefik/traefik.toml
index 54fcde0..16799a2 100644
--- a/configs/traefik/traefik.toml
+++ b/configs/traefik/traefik.toml
@@ -30,7 +30,8 @@ defaultEntryPoints = ["http"]
     [entryPoints.http]
     address = ":80"
     [entryPoints.http.auth.basic]
-    users = ["ohuser:$apr1$ffMQdoZd$1uEyKkwOKH3QS9ovOAzYj1"]
+    usersFile = "/etc/traefik/traefik_users"
+    #users = ["ohuser:$1$A0mm9w.i$2tr8KLucsPlN6rhhdVDpw0"]
 
 
 # [retry]
diff --git a/configs/traefik/traefik_users b/configs/traefik/traefik_users
new file mode 100644
index 0000000..e505b99
--- /dev/null
+++ b/configs/traefik/traefik_users
@@ -0,0 +1 @@
+ohuser:$2b$12$Y7Jz7kwlWZJ8gtX7lwP1ZeAuAgahYQARu3pKN3BRBj07rWkHKw5mK
diff --git a/docker-compose.yml b/docker-compose.yml
index 43c1fd0..95a9f12 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -30,8 +30,10 @@ configs:
         file: ./configs/ssh/id_rsa
     sftp_known_hosts:
         file: ./configs/ssh/known_hosts
-    traefik_proxy:
+    traefik_config:
         file: ./configs/traefik/traefik.toml
+    traefik_users:
+        file: ./configs/traefik/traefik_users
     nodered_settings:
         file: ./configs/nodered/nodered_settings.js
     nodered_package:
@@ -382,8 +384,10 @@ services:
         networks:
             - habnet
         configs:
-            - source: traefik_proxy
+            - source: traefik_config
               target: /etc/traefik/traefik.toml
+            - source: traefik_users
+              target: /etc/traefik/traefik_users
         deploy:
             mode: global
             placement:
-- 
GitLab