From d3a1719d6c25c538cbf6b9db7b880c5025068842 Mon Sep 17 00:00:00 2001 From: "gitlab.com/pepa65" Date: Thu, 8 Sep 2022 17:14:03 +0700 Subject: [PATCH] Forward --- Caddyfile | 2 +- Dockerfile | 17 ++++++----------- _vars | 4 ++-- init | 4 +++- uploadpage/index.php | 2 +- uploadpage/streams/.gitkeep | 0 6 files changed, 13 insertions(+), 16 deletions(-) mode change 100644 => 100755 uploadpage/streams/.gitkeep diff --git a/Caddyfile b/Caddyfile index 4c1fdea..cc5bbdf 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,5 +1,5 @@ %interface% { - basicauth / { + basicauth * { %userpw% } log { output file /var/www/web.log diff --git a/Dockerfile b/Dockerfile index 036ab7a..8f4cce9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,17 +8,12 @@ # Destroy container and image: # docker rm stream --force && docker rmi streamupload -FROM debian:buster-slim as downloader -WORKDIR /root -ADD https://good4.eu/mailer mailer -ADD https://caddyserver.com/api/download?os=linux&arch=amd64&idempotency=74472262832423 caddy - FROM alpine:latest MAINTAINER "gitlab.com/pepa65 " -RUN apk update && apk add bash php php-fpm ffmpeg tzdata file -WORKDIR /usr/bin -COPY --from=downloader /root/caddy /usr/bin/caddy -COPY --from=downloader /root/mailer /usr/bin/mailer -COPY Caddyfile Dockerfile encode init stream vars /var/www/ +RUN apk update && apk add bash php php-fpm ffmpeg tzdata file && rm -rf /lib/apk/db +ADD https://good4.eu/mailer /usr/bin/mailer +ADD https://good4.eu/caddy /usr/bin/caddy +#ADD https://caddyserver.com/api/download?os=linux&arch=amd64&idempotency=74472262832423 /usr/bin/caddy WORKDIR /var/www -ENTRYPOINT /bin/bash init +COPY Caddyfile Dockerfile encode init stream vars ./ +ENTRYPOINT ./init diff --git a/_vars b/_vars index 3f2c8f8..4ad2093 100644 --- a/_vars +++ b/_vars @@ -8,8 +8,8 @@ interface='' # Timezone for local user tz='UTC' -# Username/password and Username/email (multiple users allowed) -# Defaults to none (no authentication required) +# Username/email/password (multiple users allowed) +# Must have at least one Username/password declare -A umail upw u='username' umail[$u]='email' upw[$u]='password' diff --git a/init b/init index 2d201c6..e50dff0 100755 --- a/init +++ b/init @@ -22,7 +22,9 @@ chmod +x /usr/bin/caddy /usr/bin/mailer up= shopt -s nullglob for u in "${!upw[@]}" -do up+="\t\t$u $(caddy hash-password --plaintext "${upw["$u"]}")#" +do hash=${uhash[$u]} + [[ $hash ]] || hash=$(caddy hash-password --plaintext "${upw["$u"]}") + up+="\t\t$u $hash#" done sed "s/%userpw%/$(echo -en "$up")/" Caddyfile |tr '#' '\n' >/srv/c mv /srv/c Caddyfile diff --git a/uploadpage/index.php b/uploadpage/index.php index 551b554..f21ce09 100644 --- a/uploadpage/index.php +++ b/uploadpage/index.php @@ -25,7 +25,7 @@ if($authuser!==''){ '); } -
'); + '); ?> Target: diff --git a/uploadpage/streams/.gitkeep b/uploadpage/streams/.gitkeep old mode 100644 new mode 100755