Skip to content

Commit 5d44719

Browse files
cowwocjaydrogers
andauthored
Fixes #2: Restrict file/directory permissions (#10)
Co-authored-by: Jay Rogers <[email protected]>
1 parent bf75338 commit 5d44719

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ ENV CERTBOT_DOMAIN="" \
66
CLOUDFLARE_API_TOKEN="" \
77
RENEWAL_INTERVAL=43200
88

9-
COPY --chmod=755 entrypoint.sh /entrypoint.sh
9+
COPY --chmod=700 entrypoint.sh /entrypoint.sh
1010

1111
ENTRYPOINT ["/entrypoint.sh"]

src/entrypoint.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/sh
22

3+
# Permissions must be created after volumes have been mounted; otherwise, windows file system permissions will override
4+
# the permissions set within the container.
5+
mkdir -p /etc/letsencrypt/accounts /var/log/letsencrypt /var/lib/letsencrypt
6+
chmod 755 /etc/letsencrypt /var/lib/letsencrypt
7+
chmod 700 /etc/letsencrypt/accounts /var/log/letsencrypt
8+
39
cat << "EOF"
410
____________________
511
< Certbot, activate! >
@@ -43,7 +49,8 @@ run_certbot() {
4349
--key-type "$CERTBOT_KEY_TYPE" \
4450
--email "$CERTBOT_EMAIL" \
4551
--agree-tos \
46-
--non-interactive
52+
--non-interactive \
53+
--strict-permissions
4754
exit_code=$?
4855
if [ $exit_code -ne 0 ]; then
4956
echo "Error: certbot command failed with exit code $exit_code"

0 commit comments

Comments
 (0)