etesync / etesync-dav

This is a CalDAV and CardDAV adapter for EteSync
https://www.etesync.com
GNU General Public License v3.0
290 stars 47 forks source link

Traefik 2 Etesync Permission Denied htpaswd #185

Closed BradNut closed 3 years ago

BradNut commented 3 years ago

Hello. I am trying to run the etesync-dav docker image using Traefik 2 on a Synology device. I am unsure if the error given is related to either or both Traefik/Synology. I have set up Traefik following guidelines presented here which seem to be working for a few apps I have.

I try to manage add before running my Traefik setup and this is the error I have:

sudo docker run -it --rm -v /volume1/docker/etesync-dav:/data etesync/etesync-dav manage add USER_EMAIL
Traceback (most recent call last):
  File "/usr/local/bin/etesync-dav", line 84, in <module>
    manage(sys.argv[2:])
  File "/usr/local/bin/etesync-dav", line 21, in manage
    manager = Manager()
  File "/usr/local/lib/python3.8/site-packages/etesync_dav/manage.py", line 77, in __init__
    self.htpasswd.save()
  File "/usr/local/lib/python3.8/site-packages/etesync_dav/manage.py", line 42, in save
    with open(self.filename, "w") as f:
PermissionError: [Errno 13] Permission denied: '/data/htpaswd'

My docker config for etesync is as follows:

etesync:
    container_name: etesync
    image: etesync/etesync-dav
    restart: unless-stopped
    environment:
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ
    volumes:
      - $DOCKERDIR/etesync-dav:/data
    networks:
      - t2_proxy
    ports:
      - $ETESYNC_PORT:37358
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.etesync-rtr.entrypoints=https"
      - "traefik.http.routers.etesync-rtr.rule=HostHeader(`etesync.$DOMAINNAME`)"
      ## Middlewares
      - "traefik.http.routers.portainer-rtr.middlewares=chain-no-auth@file"
      ## HTTP Services
      - "traefik.http.routers.etesync-rtr.service=etesync-svc"
      - "traefik.http.services.etesync-svc.loadbalancer.server.port=80"

I already have an .htpasswd file defined for Traefik 2 for any auth my apps need but would not set it for the etesync image.

tasn commented 3 years ago

The problem is that the docker etesync user doesn't have write access to $DOCKERDIR/etesync-dav. You need to make sure any user can write to that dir, or at the very least, the docker user can.

BradNut commented 3 years ago

@tasn The user I am ssh'd in has admin permissions with full access to $DOCKERDIR as well as $DOCKERDIR/etesync-dav.

When I run the manage add commands as well as the docker compose file to start up Traefik I am doing so with this user and inpuing my admin password which results in the same error.

ls shows the following when checking folder permisssions drwxrwxrwx+ 1 LOGGED_IN_USER users 0 Nov 17 12:10 etesync-dav

tasn commented 3 years ago

Docker works differently. In Docker you have a different user inside of the docker container. I'm not sure what your problem is, but it sounds like a docker thing. You will probably get more help from the docker devs.