stevespringett / nist-data-mirror

A simple Java command-line utility to mirror the CVE JSON data from NIST.
Apache License 2.0
206 stars 93 forks source link

Cron running twice #135

Open s3dse opened 2 years ago

s3dse commented 2 years ago

When I set the crond command to debug crond -s /var/spool/cron/crontabs -f -d -l 8 in src/docker/conf/supervisord.conf the logs show that the mirror script is run twice: once for user root and once for user mirror. Is this behaviour intended?

I can confirm that the user mirror is not necessary for the setup. I build the image without the user mirror and the cron is running only for user root. The files are served the same way as before. I also deployed the helm chart to k8s and can confirm that it works, too. I can target the k8s mirror when using dependency-check without any issues.

From the Dockerfile (line 24-33):

# obsolete # ENV user=mirror

RUN apk update                                               && \
    apk add --no-cache openjdk8-jre dcron nss supervisor     && \
    # obsolete # addgroup -S $user                           && \
    # obsolete # adduser -S $user -G $user                   && \
    mkdir -p /tmp/nvd                                        && \
    # obsolete # chown -R $user:$user /tmp/nvd               && \
    # obsolete # chown -R $user:$user /usr/local/apache2/htdocs   && \
    rm -v /usr/local/apache2/htdocs/index.html

From src/docker/conf/supervisord.conf (line 17-23):

[program:initialize_htdocs]
command=/mirror.sh
autorestart=false
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
# obsolete # user=mirror