Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make apache container read-only #2874

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Containers/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ RUN set -ex; \
\
mkdir -p /mnt/data; \
chown -R www-data:www-data /mnt/data; \
mkdir /caddy; \
chown 777 /caddy; \
\
apk add --no-cache \
bash \
Expand Down Expand Up @@ -59,9 +61,13 @@ RUN set -ex; \
mkdir /var/run/supervisord; \
chown www-data:www-data /var/run/supervisord; \
chown www-data:www-data /var/log/supervisord; \
chmod 777 /var/run/supervisord; \
chmod 777 /var/log/supervisord; \
\
chown -R www-data:www-data /usr/local/apache2; \
chmod +r -R /usr/local/apache2; \
mkdir -p /usr/local/apache2/logs; \
chmod 777 -R /usr/local/apache2/logs; \
\
echo "root:$(openssl rand -base64 12)" | chpasswd

Expand Down
10 changes: 5 additions & 5 deletions Containers/apache/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ if [ "$APACHE_PORT" != '443' ]; then
else
CADDYFILE="$(sed 's|auto_https.*|auto_https disable_redirects|' /Caddyfile)"
fi
echo "$CADDYFILE" > /Caddyfile
echo "$CADDYFILE" > /caddy/Caddyfile

# Change the trusted_proxies in case of reverse proxies
if [ "$APACHE_PORT" != '443' ]; then
CADDYFILE="$(sed 's|# trusted_proxies placeholder|trusted_proxies static private_ranges|' /Caddyfile)"
CADDYFILE="$(sed 's|# trusted_proxies placeholder|trusted_proxies static private_ranges|' /caddy/Caddyfile)"
else
CADDYFILE="$(sed 's|trusted_proxies.*private_ranges|# trusted_proxies placeholder|' /Caddyfile)"
CADDYFILE="$(sed 's|trusted_proxies.*private_ranges|# trusted_proxies placeholder|' /caddy/Caddyfile)"
fi
echo "$CADDYFILE" > /Caddyfile
echo "$CADDYFILE" > /caddy/Caddyfile

# Fix the Caddyfile format
caddy fmt --overwrite /Caddyfile
caddy fmt --overwrite /caddy/Caddyfile

# Add caddy path
mkdir -p /mnt/data/caddy/
Expand Down
2 changes: 1 addition & 1 deletion Containers/apache/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/usr/bin/caddy run --config /Caddyfile
command=/usr/bin/caddy run --config /caddy/Caddyfile
2 changes: 1 addition & 1 deletion php/containers-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"type": "array",
"items": {
"type": "string",
"pattern": "^/[a-z/_-]+$"
"pattern": "^/[a-z/_0-9-]+$"
}
},
"volumes": {
Expand Down
7 changes: 7 additions & 0 deletions php/containers.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
],
"networks": [
"nextcloud-aio"
],
"read_only": true,
"tmpfs": [
"/var/log/supervisord",
"/var/run/supervisord",
"/usr/local/apache2/logs",
"/caddy"
]
},
{
Expand Down