Skip to content

Commit

Permalink
docker: Only do setfacl if we issued the certificates
Browse files Browse the repository at this point in the history
Today, we do setfacl unconditionally; this can be a problem for
user-provided certificates because they may be located somewhere else.

This patch fixes the problem by only doing setfacl after renewing the
certificates.

Externally provided certificates will be untouched, and the user is
responsible for ensuring that chasquid can read them.

Thanks to Alex Ellwein (aellwein@github) for reporting this in
#29!
  • Loading branch information
albertito committed Aug 23, 2022
1 parent b779941 commit 567ad35
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ if [ "$AUTO_CERTS" != "" ]; then
# Note this requires you to restart every week or so, to make sure
# your certificate does not expire.
certbot renew

# Give chasquid access to the certificates.
# Dovecot does not need this as it reads them as root.
setfacl -R -m u:chasquid:rX /etc/letsencrypt/{live,archive}
fi

CERT_DOMAINS=""
Expand All @@ -66,10 +70,6 @@ if [ "$CERT_DOMAINS" == "" ]; then
exit 1
fi

# Give chasquid access to the certificates.
# Dovecot does not need this as it reads them as root.
setfacl -R -m u:chasquid:rX /etc/letsencrypt/{live,archive}

# Give chasquid access to the data directory.
mkdir -p /data/chasquid/data
chown -R chasquid /data/chasquid/
Expand Down

0 comments on commit 567ad35

Please sign in to comment.