Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEC: Traefik should run as non-root #1992

Open
westurner opened this issue Mar 25, 2019 · 0 comments · May be fixed by #2854
Open

SEC: Traefik should run as non-root #1992

westurner opened this issue Mar 25, 2019 · 0 comments · May be fixed by #2854

Comments

@westurner
Copy link
Contributor

Traefik should not run as root. When traefik runs as nonroot, it cannot bind to 80 or 443; but you can map 80 and 443 to e.g. 8080 and 8443 with Docker (e.g. in the docker-compose.yml production.yml).

In order to run Traefik as non-root on other ports, I had to write a redirect rule in my traefik.toml; "You should not run as root" containous/traefik-library-image#38 (comment)

You can specify the user as user: uid:gid in the docker-compose.yml; or in the Dockerfile. AFAIU, the user does not have to be added first.
https://forums.docker.com/t/how-can-we-add-uid-and-gid-in-stack-file-or-compose-file/68261/3

# ...
   user: 1005:1005

https://github.com/pydanny/cookiecutter-django/blob/master/%7B%7Bcookiecutter.project_slug%7D%7D/compose/production/traefik/Dockerfile

EXPOSE 8080/tcp 8443/tcp
USER 1005:1005  # or:  user: uid:gid
[entryPoints]
  [entryPoints.http]
  address = ":8080"
    [entryPoints.http.redirect]
    #entryPoint = "https"
    regex = "^http://(.*):8080/(.*)"
    replacement = "https://$1/$2"

  [entryPoints.https]
  address = ":8443"
    [entryPoints.https.tls]
      #[[entryPoints.https.tls.certificates]]
      #certFile = "/certs/website.crt"
      #keyFile  = "/certs/website.key"

Without these default certs, when you access traefik by IP (instead of by the configured hostname); there's a default traefik cert that says 'traefik' in teh CN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants