fix tor dir permissions

main
Ricard Illa 2021-02-18 10:21:14 +01:00
parent 75bc830def
commit d61e70e96d
2 changed files with 22 additions and 4 deletions

View File

@ -1,6 +1,9 @@
FROM alpine:3.13
RUN addgroup --gid 10001 tor && \
COPY entrypoint.sh /entrypoint
RUN chmod +x /entrypoint
addgroup --gid 10001 tor && \
adduser \
--uid 10000 \
--home /var/lib/tor \
@ -8,7 +11,7 @@ RUN addgroup --gid 10001 tor && \
--disabled-password \
--shell /sbin/nologin \
tor && \
apk add --no-cache tor
apk add --no-cache tor su-exec
USER tor
CMD tor
ENTRYPOINT ["/entrypoint"]
CMD ["tor"]

15
tor/entrypoint.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
set -xe
if [ -f /etc/tor/torrc ]
then
awk '{if ($1 == "HiddenServiceDir") print $2}' /etc/tor/torrc | while IFS= read -r dir
do
mkdir -p "${dir}"
chown tor "${dir}"
chmod 700 "${dir}"
done
fi
su-exec tor "$@"