我有一个开发容器,主要用作PHP的web服务器和反向代理。它从一个PHP-FPM图像开始,然后使用apt get添加许多包。我还没有将其用于PCI/支付处理,但我可能想这样做。
我对它进行了Trustwave PCI扫描,发现了一些问题,我认为可以通过向Dockerfile和nginx添加一些内容来解决。形态。
只是想得到一些建议。最终,我可能需要或想要使用Docker NGINX官方图像,或获得NGINX Plus的许可版本,以及WAF选项,但这可能会很快变得昂贵。
Dockerfile的开头是这样的:
FROM php:8.0-fpm
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies, libssl1.1-dev ?
# Debian GNU/Linux 11 (bullseye), xvfb and xorg are required for wkhtmltopdf, or the xfonts, fontconfig onwards
RUN apt-get update && apt-get install -y \
. . . \
nginx \
. . .
如果我修改它,从nginx安装nginx。如下图所示,它似乎仍然有效,但使用了nginx。org包和geoip模块。
RUN apt-get update && apt-get install -y \
. . . \
. . .
RUN curl https://nginx.org/keys/nginx_signing.key | gpg
| tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
RUN echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/debian `lsb_release -cs` nginx" \
| tee /etc/apt/sources.list.d/nginx.list
RUN apt-get update && apt-get install -y \
nginx \
nginx-module-geoip
TrustWave扫描中的另一个问题是TLS、SSL和证书链配置。我确实找到了这个参考文献,它似乎可以解决许多问题:
How to properly configure your nginx for TLS
看起来在我的服务器块或其他地方,我需要在服务器块和nginx中的ssl设置中添加http2。形态?
listen 443 ssl http2;
In nginx.conf
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
以及其他一些我不太熟悉的配置项目。
此链接似乎描述了如何在debian版本中使用官方nginx repo:
nginx: Linux packages
另一个选择是使用NGINX的正式docker映像,但这可能需要对我的整个构建和配置进行大量修改。
我确实对DockerFile做了一些修改,以便它使用我认为是NGINX的官方开源回购协议,而不是默认的debian apt源代码。新版本显示:
nginx version: nginx/1.20.2
built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
built with OpenSSL 1.1.1k 25 Mar 2021
TLS SNI support enabled
配置参数:--prefix=/etc/nginx--sbin path=/usr/sbin/nginx--modules path=/usr/lib/nginx/modules--conf path=/etc/nginx/nginx。conf——错误日志路径=/var/log/nginx/error。log——http日志路径=/var/log/nginx/access。log——pid路径=/var/run/nginx。pid——锁定路径=/var/run/nginx。lock--http客户端主体临时路径=/var/cache/nginx/client_temp--http代理临时路径=/var/cache/nginx/proxy_temp--http fastcgi临时路径=/var/cache/nginx/fastcgi_temp--http uwsgi temp路径=/var/cache/nginx/scgi_temp--user=nginx--group=nginx--compat--with file aio--with threads--with-http-http-U模块--带-http_auth_request_模块——带-http_dav_模块——带-http_flv_模块——带-http_gunzip_模块——带-http_gzip_static_模块——带-http_mp4_模块——带-http_random_index_模块——带-http_realip_模块——带-http_安全链接_模块——带-http_slice_模块——带-http_ssl_模块——带-http_stub status_状态_模块——带-http_sub--with-mail_ssl_模块——with stream——with-stream_realip_模块——with-stream_ssl_模块——with-stream_ssl_preread_模块——with cc opt='-g-O2——ffile prefix map=/data/builder/debild/nginx-1.20.2/debian/debild base/nginx-1.20.2=-fstack protector strong-Wformat-Werror=格式安全性-Wp,-D_FORTIFY_SOURCE=2-fPIC'-带ld opt='-Wl,-z,relro-Wl,-z,now-Wl,--根据需要-pie'
旧版本显示:
nginx version: nginx/1.18.0
built with OpenSSL 1.1.1k 25 Mar 2021
TLS SNI support enabled
配置参数:--with cc opt='-g-O2-ffile prefix map=/build/nginx-q9LD4J/nginx-1.18.0=-fstack protector strong-Wformat-Werror=format security-fPIC-Wdate time-D_FORTIFY_SOURCE=2'--带有ld opt='-Wl,-z,relro-Wl,-z,now-fPIC'--前缀=/usr/share/nginx--conf path=/etc/nginx/nginx。conf——http日志路径=/var/log/nginx/access。log——错误日志路径=/var/log/nginx/error。log——lock path=/var/lock/nginx。lock--pid path=/run/nginx。pid——模块路径=/usr/lib/nginx/modules——http客户端主体临时路径=/var/lib/nginx/body——http fastcgi临时路径=/var/lib/nginx/fastcgi——http代理临时路径=/var/nginx/proxy——http-scgi临时路径=/var/lib/nginx/uwsgi——带兼容——带调试——带pcre jit——带-http_ssl_模块——带-http_存根状态_模块——带http_realip模块--带-http_auth_request_模块——带-http_v2_模块——带-http_dav_模块——带-http_slice_模块——带线程——带-http_addition_模块——带-http_gunzip_模块——带-http_gzip_static_模块——带-http_sub_模块