Bläddra i källkod

Do not let the user overwrite the apache site config

Johannes Zellner 8 år sedan
förälder
incheckning
ce59a2a7b1
2 ändrade filer med 4 tillägg och 14 borttagningar
  1. 2 5
      Dockerfile
  2. 2 9
      start.sh

+ 2 - 5
Dockerfile

@@ -47,10 +47,6 @@ RUN sed -e "s,MaxSpareServers[^:].*,MaxSpareServers 5," -i /etc/apache2/mods-ava
 
 RUN a2disconf other-vhosts-access-log
 RUN echo "Listen 8000" > /etc/apache2/ports.conf
-
-RUN ln -sf /app/data/apache2-app.conf /etc/apache2/sites-available/app.conf
-RUN ln -sf /etc/apache2/sites-available/app.conf /etc/apache2/sites-enabled/app.conf
-
 RUN a2enmod rewrite
 
 # configure mod_php
@@ -61,7 +57,8 @@ RUN crudini --set /etc/php/7.0/apache2/php.ini PHP upload_max_filesize 8M && \
 
 RUN mv /etc/php/7.0/apache2/php.ini /etc/php/7.0/apache2/php.ini.orig && ln -sf /app/data/php.ini /etc/php/7.0/apache2/php.ini
 
-ADD apache2-app.conf /app/code/apache2-app.conf
+# configure site
+COPY apache2-app.conf /etc/apache2/sites-enabled/app.conf
 
 # configure proftpd
 ADD proftpd.conf /app/code/proftpd.conf.template

+ 2 - 9
start.sh

@@ -10,20 +10,13 @@ for f in /app/data/public/index.*; do
     break
 done
 
-# check for old webdav enabled apache2-app.conf
-if grep "### WARNING the following lines will be updated dynamically by start.sh" /app/data/apache2-app.conf; then
-    echo "=> Removing old apache2-app.conf"
-    rm -f /app/data/apache2-app.conf
-fi
+# cleanup for old apache2-app.conf
+rm -f /app/data/apache2-app.conf
 
 if [ ! -f "/app/data/php.ini" ]; then
     cp /etc/php/7.0/apache2/php.ini.orig /app/data/php.ini
 fi
 
-if [ ! -f "/app/data/apache2-app.conf" ]; then
-    cp /app/code/apache2-app.conf /app/data/apache2-app.conf
-fi
-
 # SFTP_PORT can be unset to disable SFTP
 disable_sftp="false"
 if [[ -z "${SFTP_PORT:-}" ]]; then