Harden web root, secrets and realtime auth

- .htaccess: refuse .git, .env, docker, nodejs, sdlc*, scripts, archives and
  app internals; security headers, HSTS over TLS, optional HTTPS redirect
- uploads served through app/file.php to signed-in users only
- Apache/PHP hardening config for the container (ServerTokens, expose_php)
- least-privilege DB account and APP_SECRET_KEY via docker/php/provision.php;
  SMTP passwords re-encrypted with a random IV (secret_box.php)
- Socket.IO rooms from a PHP-signed token; /emit and cron refuse empty secrets
- escape notification text; CLI guards on build scripts; no fixed demo password
This commit is contained in:
Thanakorn
2026-09-24 14:53:40 +07:00
parent e579dd596c
commit ae98dcdcdd
29 changed files with 525 additions and 42 deletions
+5 -1
View File
@@ -5,12 +5,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libpng-dev libjpeg-dev libfreetype6-dev \
&& docker-php-ext-configure gd --with-jpeg --with-freetype \
&& docker-php-ext-install pdo_mysql mysqli mbstring gd zip intl sockets exif opcache \
&& a2enmod rewrite \
&& a2enmod rewrite headers \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
COPY docker/php/opcache.ini /usr/local/etc/php/conf.d/opcache-recommended.ini
COPY docker/php/security.ini /usr/local/etc/php/conf.d/zz-security.ini
COPY docker/php/apache-wms.conf /etc/apache2/conf-available/wms.conf
RUN a2enconf wms
COPY docker/php/entrypoint.sh /usr/local/bin/docker-entrypoint-wms.sh
COPY docker/php/config.php.template /usr/local/etc/wms/config.php.template
COPY docker/php/provision.php /usr/local/etc/wms/provision.php
RUN chmod +x /usr/local/bin/docker-entrypoint-wms.sh
WORKDIR /var/www/html/wms-app