Set up TLS with Basic Auth

This commit is contained in:
Colin Hebert
2022-12-31 16:45:29 +01:00
parent b001874c95
commit e43c8f9b91
4 changed files with 26 additions and 4 deletions

View File

@@ -26,6 +26,10 @@ services:
configs: configs:
- source: traefik_config - source: traefik_config
target: /etc/traefik/traefik.yml target: /etc/traefik/traefik.yml
secrets:
- traefik_password
- traefik_tls_cert
- traefik_tls_key
depends_on: depends_on:
- docker - docker
restart: unless-stopped restart: unless-stopped
@@ -92,5 +96,11 @@ configs:
file: ${SERVICES_DIR?}/traefik/configs/traefik.yml file: ${SERVICES_DIR?}/traefik/configs/traefik.yml
secrets: secrets:
traefik_password:
file: ${SERVICES_DIR?}/traefik/secrets/htpasswd
traefik_tls_cert:
file: ${SERVICES_DIR?}/traefik/secrets/traefik.cert
traefik_tls_key:
file: ${SERVICES_DIR?}/traefik/secrets/traefik.key
portainer_password: portainer_password:
file: ${SERVICES_DIR?}/portainer/secrets/portainer_password file: ${SERVICES_DIR?}/portainer/secrets/portainer_password

View File

@@ -17,10 +17,10 @@ entryPoints:
web: web:
address: :80 address: :80
http: http:
# redirections: redirections:
# entryPoint: entryPoint:
# to: websecure to: websecure
# scheme: https scheme: https
websecure: websecure:
address: :443 address: :443
http: http:

View File

@@ -0,0 +1,6 @@
tls:
stores:
default:
defaultCertificate:
certFile: /run/secrets/traefik.cert
keyFile: /run/secrets/traefik.key

View File

@@ -3,3 +3,9 @@ http:
traefik: traefik:
rule: Host(`traefik.dev.dedicated.contact`) rule: Host(`traefik.dev.dedicated.contact`)
service: api@internal service: api@internal
middlewares: {}
#- traefik-auth
middlewares:
traefik-auth:
basicAuth:
usersFile: /run/secrets/htpasswd