From bfd3f09c1f6930060e4d929161cc120ea2a01966 Mon Sep 17 00:00:00 2001 From: Juergen Key Date: Thu, 26 Sep 2019 02:21:25 +0000 Subject: [PATCH 1/7] see BytemarkHosting/docker-webdav#6 and BytemarkHosting/docker-webdav#8 --- .gitignore | 2 ++ 2.4/.gitignore | 1 + 2.4/Dockerfile | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 2.4/.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f4aaf00 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +data +user.passwd \ No newline at end of file diff --git a/2.4/.gitignore b/2.4/.gitignore new file mode 100644 index 0000000..e4e5f6c --- /dev/null +++ b/2.4/.gitignore @@ -0,0 +1 @@ +*~ \ No newline at end of file diff --git a/2.4/Dockerfile b/2.4/Dockerfile index 6083e29..e0a0981 100644 --- a/2.4/Dockerfile +++ b/2.4/Dockerfile @@ -1,4 +1,4 @@ -FROM httpd:alpine +FROM httpd:2.4.35-alpine # These variables are inherited from the httpd:alpine image: # ENV HTTPD_PREFIX /usr/local/apache2 From 47020ba128017e949c5bd2f6456d0383afd7aa2a Mon Sep 17 00:00:00 2001 From: Juergen Key Date: Thu, 26 Sep 2019 04:56:52 +0000 Subject: [PATCH 2/7] the server reacts on user.passwd now with the creation of a private home dir for each user and one additional transfer dir where every user has write privileges --- .gitignore | 5 ++- 2.4/conf/conf-available/.gitignore | 3 ++ 2.4/conf/conf-available/dav.conf_multi_user | 31 +++++++++++++++++++ .../{dav.conf => dav.conf_single_user} | 0 2.4/conf/conf-available/dav.conf_user_block | 18 +++++++++++ 2.4/docker-entrypoint.sh | 30 +++++++++++++++--- docker-compose.yml | 31 +++++++++++++++++++ 7 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 2.4/conf/conf-available/.gitignore create mode 100644 2.4/conf/conf-available/dav.conf_multi_user rename 2.4/conf/conf-available/{dav.conf => dav.conf_single_user} (100%) create mode 100644 2.4/conf/conf-available/dav.conf_user_block create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index f4aaf00..3a6d91b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ data -user.passwd \ No newline at end of file +user.passwd +*~ +docker-compose.yml_off +docker-compose.yml_priv \ No newline at end of file diff --git a/2.4/conf/conf-available/.gitignore b/2.4/conf/conf-available/.gitignore new file mode 100644 index 0000000..f3e73ab --- /dev/null +++ b/2.4/conf/conf-available/.gitignore @@ -0,0 +1,3 @@ +dav.conf_test +dav.conf_user_block_ +test.sh diff --git a/2.4/conf/conf-available/dav.conf_multi_user b/2.4/conf/conf-available/dav.conf_multi_user new file mode 100644 index 0000000..68f56de --- /dev/null +++ b/2.4/conf/conf-available/dav.conf_multi_user @@ -0,0 +1,31 @@ +DavLockDB "/var/lib/dav/DavLock" +# transfer + Alias /transfer "/var/lib/dav/data/transfer/" + + + Dav On + AuthType Basic + AuthName "WebDAV" + AuthUserFile "/user.passwd" + + Require valid-user + + + + + Require valid-user + + +#placeholder_for_user_block + +# These disable redirects on non-GET requests for directories that +# don't include the trailing slash (for misbehaving clients). +BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully +BrowserMatch "MS FrontPage" redirect-carefully +BrowserMatch "^WebDrive" redirect-carefully +BrowserMatch "^WebDAVFS/1.[01234]" redirect-carefully +BrowserMatch "^gnome-vfs/1.0" redirect-carefully +BrowserMatch "^XML Spy" redirect-carefully +BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully +BrowserMatch " Konqueror/4" redirect-carefully +BrowserMatch "^gvfs" redirect-carefully diff --git a/2.4/conf/conf-available/dav.conf b/2.4/conf/conf-available/dav.conf_single_user similarity index 100% rename from 2.4/conf/conf-available/dav.conf rename to 2.4/conf/conf-available/dav.conf_single_user diff --git a/2.4/conf/conf-available/dav.conf_user_block b/2.4/conf/conf-available/dav.conf_user_block new file mode 100644 index 0000000..4ac7846 --- /dev/null +++ b/2.4/conf/conf-available/dav.conf_user_block @@ -0,0 +1,18 @@ +# $user \ + Alias $Location$user "/var/lib/dav/data/$user/"\ + \ + \ + Dav On\ + AuthType Basic\ + AuthName "WebDAV"\ + AuthUserFile "/user.passwd"\ + \ + Require valid-user \ + \ + \ +\ + \ + Require user $user\ + \ +\ +\ \ No newline at end of file diff --git a/2.4/docker-entrypoint.sh b/2.4/docker-entrypoint.sh index 3ee4575..f5410d0 100755 --- a/2.4/docker-entrypoint.sh +++ b/2.4/docker-entrypoint.sh @@ -14,6 +14,31 @@ set -e # Just in case this environment variable has gone missing. HTTPD_PREFIX="${HTTPD_PREFIX:-/usr/local/apache2}" +# decide between single user mode (no separate home directories) and +# multi user mode (separate dedicated home directories and one shared transfer folder) + +if [ ! -e "/user.passwd" ]; then + cp "$HTTPD_PREFIX/conf/conf-available/dav.conf_single_user" "$HTTPD_PREFIX/conf/conf-available/dav.conf" +# Configure dav.conf +if [ "x$LOCATION" != "x" ]; then + sed -e "s|Alias .*|Alias $LOCATION /var/lib/dav/data/|" \ + -i "$HTTPD_PREFIX/conf/conf-available/dav.conf" +fi +else + cp "$HTTPD_PREFIX/conf/conf-available/dav.conf_multi_user" "$HTTPD_PREFIX/conf/conf-available/dav.conf" +cat /user.passwd | while read line +do + user=$(echo -n $line|cut -d ":" -f 1) + mkdir -p "/var/lib/dav/data/$user" + user_block=$(cat $HTTPD_PREFIX/conf/conf-available/dav.conf_user_block) + user_block=$(echo "$user_block"|sed -e 's/\$user/'"$user"'/g') + sed 's!#placeholder_for_user_block!'"$user_block"'#placeholder_for_user_block!g' -i $HTTPD_PREFIX/conf/conf-available/dav.conf +done +sed -e 's|$Location|'"${LOCATION:-/}"'|g' \ + -i "$HTTPD_PREFIX/conf/conf-available/dav.conf" + +fi + # Configure vhosts. if [ "x$SERVER_NAMES" != "x" ]; then # Use first domain as Apache ServerName. @@ -27,11 +52,6 @@ if [ "x$SERVER_NAMES" != "x" ]; then -i "$HTTPD_PREFIX"/conf/sites-available/default*.conf fi -# Configure dav.conf -if [ "x$LOCATION" != "x" ]; then - sed -e "s|Alias .*|Alias $LOCATION /var/lib/dav/data/|" \ - -i "$HTTPD_PREFIX/conf/conf-available/dav.conf" -fi if [ "x$REALM" != "x" ]; then sed -e "s|AuthName .*|AuthName \"$REALM\"|" \ -i "$HTTPD_PREFIX/conf/conf-available/dav.conf" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6fe741a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,31 @@ +version: '3' +services: + webdav: + build: + context: ./2.4/ + container_name: webdav + restart: always + ports: + - "80:80" + environment: + AUTH_TYPE: Digest + SERVER_NAMES: webdav.docker.lab +# USERNAME: alice +# PASSWORD: secret1234 + volumes: + - ./data:/var/lib/dav + - ./user.passwd:/user.passwd +# labels: +# - "traefik.backend=webdav" +# - "traefik.enable=true" +# - "traefik.frontend.rule=Host:webdav.docker.lab" +# - "traefik.port=80" +# - "traefik.docker.network=traefik_proxy" +# networks: +# - traefik_proxy +# +#networks: +# traefik_proxy: +# external: +# name: traefik_proxy + \ No newline at end of file From 77defff64ace50594f6a5011442949187506ee81 Mon Sep 17 00:00:00 2001 From: Juergen Key Date: Thu, 7 Nov 2019 07:39:13 +0100 Subject: [PATCH 3/7] housekeeoing --- docker-compose.yml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6fe741a..7aae95c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,10 +3,11 @@ services: webdav: build: context: ./2.4/ +# image: bytemark/webdav container_name: webdav restart: always - ports: - - "80:80" +# ports: +# - "80:80" environment: AUTH_TYPE: Digest SERVER_NAMES: webdav.docker.lab @@ -15,17 +16,17 @@ services: volumes: - ./data:/var/lib/dav - ./user.passwd:/user.passwd -# labels: -# - "traefik.backend=webdav" -# - "traefik.enable=true" -# - "traefik.frontend.rule=Host:webdav.docker.lab" -# - "traefik.port=80" -# - "traefik.docker.network=traefik_proxy" -# networks: -# - traefik_proxy -# -#networks: -# traefik_proxy: -# external: -# name: traefik_proxy + labels: + - "traefik.backend=webdav" + - "traefik.enable=true" + - "traefik.frontend.rule=Host:webdav.docker.lab" + - "traefik.port=80" + - "traefik.docker.network=traefik_proxy" + networks: + - traefik_proxy + +networks: + traefik_proxy: + external: + name: traefik_proxy \ No newline at end of file From d2ee9bb7f7549ee0c233add8391ec9a0c7d003ac Mon Sep 17 00:00:00 2001 From: Juergen Key Date: Tue, 21 Jan 2020 17:25:11 +0100 Subject: [PATCH 4/7] migration to traefik v2.0 --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7aae95c..a87889e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,5 @@ version: '3' + services: webdav: build: @@ -17,10 +18,9 @@ services: - ./data:/var/lib/dav - ./user.passwd:/user.passwd labels: - - "traefik.backend=webdav" - "traefik.enable=true" - - "traefik.frontend.rule=Host:webdav.docker.lab" - - "traefik.port=80" + - "traefik.http.routers.webdav.rule=Host(`webdav.docker.lab`)" + - "traefik.http.services.webdav.loadbalancer.server.port=80" - "traefik.docker.network=traefik_proxy" networks: - traefik_proxy From 7ad0710c9d22dcf23e972c4669c3830c217b6f53 Mon Sep 17 00:00:00 2001 From: Juergen Key Date: Thu, 14 May 2020 15:44:31 +0200 Subject: [PATCH 5/7] housekeeping --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a87889e..b53401f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: context: ./2.4/ # image: bytemark/webdav container_name: webdav - restart: always + restart: unless-stopped # ports: # - "80:80" environment: From d5eb7c5a03e54c47178a01f50a01fcfdacc4dc1c Mon Sep 17 00:00:00 2001 From: Mario Cardiel Date: Thu, 9 Jun 2022 20:53:08 -0500 Subject: [PATCH 6/7] Removed dav.conf, it will be created by the docker-entry.sh depending on the usage Removed docker-compose.yml, is not required dav.conf* files improvements --- conf/conf-available/dav.conf | 54 ------------------------- conf/conf-available/dav.conf_multi_user | 16 +++++++- conf/conf-available/dav.conf_user_block | 14 ++++++- docker-compose.yml | 32 --------------- docker-entrypoint.sh | 2 + 5 files changed, 30 insertions(+), 88 deletions(-) delete mode 100644 conf/conf-available/dav.conf delete mode 100644 docker-compose.yml diff --git a/conf/conf-available/dav.conf b/conf/conf-available/dav.conf deleted file mode 100644 index 80b437c..0000000 --- a/conf/conf-available/dav.conf +++ /dev/null @@ -1,54 +0,0 @@ -DavLockDB "/var/lib/dav/DavLock" -Alias / "/var/lib/dav/data/" - - - ### General configuration - # Enable WebDAV - Dav On - # Ensure mod_autoindex is used - Options +Indexes - # Use UTF-8 every time - IndexOptions Charset=UTF-8 - # Ensure mod_dir does not take precedence over mod_autoindex - DirectoryIndex disabled - - ### Table configuration - # Display table headers - IndexOptions FancyIndexing - # Use the html - IndexOptions HTMLTable - # Remove the description column - IndexOptions SuppressDescription - # Remove the
- IndexOptions SuppressRules - # Do not cut the names - IndexOptions NameWidth=* - - ### Sorting options - IndexOrderDefault Ascending Name - IndexOptions IgnoreCase - IndexOptions FoldersFirst - IndexOptions VersionSort - - ## Auth - AuthType Basic - AuthName "WebDAV" - AuthUserFile "/user.passwd" - - Require valid-user - - - -# These disable redirects on non-GET requests for directories that -# don't include the trailing slash (for misbehaving clients). -BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully -BrowserMatch "^Microsoft-WebDAV-MiniRedir" redirect-carefully -BrowserMatch "MS FrontPage" redirect-carefully -BrowserMatch "^WebDrive" redirect-carefully -BrowserMatch "^WebDAVFS/1.[01234]" redirect-carefully -BrowserMatch "^gnome-vfs/1.0" redirect-carefully -BrowserMatch "^XML Spy" redirect-carefully -BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully -BrowserMatch " Konqueror/4" redirect-carefully -BrowserMatch "^gvfs" redirect-carefully -BrowserMatch "^Jakarta-Commons-VFS" redirect-carefully diff --git a/conf/conf-available/dav.conf_multi_user b/conf/conf-available/dav.conf_multi_user index 68f56de..87b377a 100644 --- a/conf/conf-available/dav.conf_multi_user +++ b/conf/conf-available/dav.conf_multi_user @@ -1,9 +1,21 @@ DavLockDB "/var/lib/dav/DavLock" # transfer - Alias /transfer "/var/lib/dav/data/transfer/" + Alias $Location/transfer "/var/lib/dav/data/transfer/" Dav On + Options Indexes FollowSymLinks + IndexOptions Charset=UTF-8 + DirectoryIndex disabled + IndexOptions FancyIndexing + IndexOptions HTMLTable + IndexOptions SuppressDescription + IndexOptions SuppressRules + IndexOptions NameWidth=* + IndexOrderDefault Ascending Name + IndexOptions IgnoreCase + IndexOptions FoldersFirst + IndexOptions VersionSort AuthType Basic AuthName "WebDAV" AuthUserFile "/user.passwd" @@ -21,6 +33,7 @@ DavLockDB "/var/lib/dav/DavLock" # These disable redirects on non-GET requests for directories that # don't include the trailing slash (for misbehaving clients). BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully +BrowserMatch "^Microsoft-WebDAV-MiniRedir" redirect-carefully BrowserMatch "MS FrontPage" redirect-carefully BrowserMatch "^WebDrive" redirect-carefully BrowserMatch "^WebDAVFS/1.[01234]" redirect-carefully @@ -29,3 +42,4 @@ BrowserMatch "^XML Spy" redirect-carefully BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully BrowserMatch " Konqueror/4" redirect-carefully BrowserMatch "^gvfs" redirect-carefully +BrowserMatch "^Jakarta-Commons-VFS" redirect-carefully \ No newline at end of file diff --git a/conf/conf-available/dav.conf_user_block b/conf/conf-available/dav.conf_user_block index 4ac7846..3e5a04e 100644 --- a/conf/conf-available/dav.conf_user_block +++ b/conf/conf-available/dav.conf_user_block @@ -1,8 +1,20 @@ # $user \ - Alias $Location$user "/var/lib/dav/data/$user/"\ + Alias $Location/$user "/var/lib/dav/data/$user/"\ \ \ Dav On\ + Options Indexes FollowSymLinks\ + IndexOptions Charset=UTF-8\ + DirectoryIndex disabled\ + IndexOptions FancyIndexing\ + IndexOptions HTMLTable\ + IndexOptions SuppressDescription\ + IndexOptions SuppressRules\ + IndexOptions NameWidth=*\ + IndexOrderDefault Ascending Name\ + IndexOptions IgnoreCase\ + IndexOptions FoldersFirst\ + IndexOptions VersionSort\ AuthType Basic\ AuthName "WebDAV"\ AuthUserFile "/user.passwd"\ diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index b53401f..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,32 +0,0 @@ -version: '3' - -services: - webdav: - build: - context: ./2.4/ -# image: bytemark/webdav - container_name: webdav - restart: unless-stopped -# ports: -# - "80:80" - environment: - AUTH_TYPE: Digest - SERVER_NAMES: webdav.docker.lab -# USERNAME: alice -# PASSWORD: secret1234 - volumes: - - ./data:/var/lib/dav - - ./user.passwd:/user.passwd - labels: - - "traefik.enable=true" - - "traefik.http.routers.webdav.rule=Host(`webdav.docker.lab`)" - - "traefik.http.services.webdav.loadbalancer.server.port=80" - - "traefik.docker.network=traefik_proxy" - networks: - - traefik_proxy - -networks: - traefik_proxy: - external: - name: traefik_proxy - \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 97abc49..4dbd582 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -133,8 +133,10 @@ sed -i -e "s|^Group .*|Group #$PGID|" "$HTTPD_PREFIX/conf/httpd.conf"; # Create directories for Dav data and lock database. [ ! -d "/var/lib/dav/data" ] && mkdir -p "/var/lib/dav/data" +[ ! -d "/var/lib/dav/data/transfer" ] && mkdir -p "/var/lib/dav/data/transfer" [ ! -e "/var/lib/dav/DavLock" ] && touch "/var/lib/dav/DavLock" chown $PUID:$PGID "/var/lib/dav/data" +chown $PUID:$PGID "/var/lib/dav/data/transfer" chown $PUID:$PGID "/var/lib/dav/DavLock" # Set umask From 3019d3fe2155ade7d765e1e1b89415c661512a60 Mon Sep 17 00:00:00 2001 From: Mario Cardiel Date: Fri, 10 Jun 2022 21:50:16 -0500 Subject: [PATCH 7/7] Fix for the multi-user access --- conf/conf-available/dav.conf_multi_user | 2 +- conf/conf-available/dav.conf_user_block | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/conf-available/dav.conf_multi_user b/conf/conf-available/dav.conf_multi_user index 87b377a..39cc065 100644 --- a/conf/conf-available/dav.conf_multi_user +++ b/conf/conf-available/dav.conf_multi_user @@ -24,7 +24,7 @@ DavLockDB "/var/lib/dav/DavLock" - + Require valid-user diff --git a/conf/conf-available/dav.conf_user_block b/conf/conf-available/dav.conf_user_block index 3e5a04e..37f2237 100644 --- a/conf/conf-available/dav.conf_user_block +++ b/conf/conf-available/dav.conf_user_block @@ -23,7 +23,7 @@ \ \ \ - \ + \ Require user $user\ \ \