Skip to content

Commit

Permalink
Merge pull request #2660 from aledbf/fix-modesecurity
Browse files Browse the repository at this point in the history
Change modsecurity directories
  • Loading branch information
k8s-ci-robot authored Jun 20, 2018
2 parents 30c6567 + 8107e0f commit fe9a5ae
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,32 @@ RUN clean-install \
dumb-init \
libcap2-bin

# Create symlinks to redirect nginx logs to stdout and stderr docker log collector
# This only works if nginx is started with CMD or ENTRYPOINT
RUN mkdir -p /var/log/nginx \
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log

COPY . /

RUN setcap cap_net_bind_service=+ep /usr/sbin/nginx \
&& setcap cap_net_bind_service=+ep /nginx-ingress-controller

RUN mkdir -p /etc/ingress-controller/ssl /etc/ingress-controller/auth \
&& chown -R www-data.www-data /etc/nginx /etc/ingress-controller
RUN bash -eux -c ' \
writeDirs=( \
/etc/nginx \
/etc/ingress-controller/ssl \
/etc/ingress-controller/auth \
/var/log \
/var/log/nginx \
/opt/modsecurity/var/log \
/opt/modsecurity/var/upload \
/opt/modsecurity/var/audit \
); \
for dir in "${writeDirs[@]}"; do \
mkdir -p ${dir}; \
chown -R www-data.www-data ${dir}; \
done \
'

# Create symlinks to redirect nginx logs to stdout and stderr docker log collector
# This only works if nginx is started with CMD or ENTRYPOINT
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log

USER www-data

Expand Down

0 comments on commit fe9a5ae

Please sign in to comment.