From 00e89ec449e4410a9ef70b6650df2ed761997da4 Mon Sep 17 00:00:00 2001 From: Asharas Date: Sun, 7 Mar 2021 17:14:25 +0100 Subject: [PATCH] hide server tokens --- Dockerfile-nginx | 5 +++-- Dockerfile-nginx-alpine | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile-nginx b/Dockerfile-nginx index 8188212..2406b5d 100644 --- a/Dockerfile-nginx +++ b/Dockerfile-nginx @@ -33,8 +33,9 @@ RUN set -x \ # Copy nginx conf from official image COPY --from=nginx:latest /etc/nginx /etc/nginx -# Debian uses www-data user instead of nginx -RUN sed -i 's@\(^user\).*[^;]@\1 www-data@' /etc/nginx/nginx.conf +# Change nginx and disable server tokens +RUN sed -i -e 's@\(^user\).*[^;]@\1 www-data@' \ + -e "/default_type/a \\ server_tokens off;" /etc/nginx/nginx.conf # Copy cryptpad with installed modules COPY --from=build --chown=cryptpad /cryptpad /cryptpad diff --git a/Dockerfile-nginx-alpine b/Dockerfile-nginx-alpine index 3138393..d8cf6bd 100644 --- a/Dockerfile-nginx-alpine +++ b/Dockerfile-nginx-alpine @@ -34,6 +34,9 @@ RUN set -x \ # Copy nginx conf from official image COPY --from=nginx:latest /etc/nginx /etc/nginx +# Disable server tokens +RUN sed -i "/default_type/a \\ server_tokens off;" /etc/nginx/nginx.conf + # Copy cryptpad with installed modules COPY --from=build --chown=cryptpad /cryptpad /cryptpad