Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix kill signal handling #244 #246

Merged
merged 2 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions vulnz/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ARG http_proxy
ARG https_proxy
ARG no_proxy

LABEL authors="derhecht,stevespringett,jeremylong"
LABEL authors="derhecht,stevespringett,jeremylong,eugenmayer"
LABEL maintainer="[email protected]"
LABEL name="jeremylong/vulnz"
LABEL version=$BUILD_VERSION
Expand Down Expand Up @@ -37,13 +37,15 @@ RUN apk update && \

COPY ["/src/docker/supervisor/supervisord.conf", "/etc/supervisord.conf"]
COPY ["/src/docker/scripts/mirror.sh", "/mirror.sh"]
COPY ["/src/docker/scripts/validate.sh", "/validate.sh"]
COPY ["/src/docker/crontab/mirror", "/etc/crontabs/mirror"]
COPY ["/src/docker/crontab/validate", "/etc/crontabs/validate"]
COPY ["/src/docker/apache/mirror.conf", "/usr/local/apache2/conf"]
COPY ["/build/libs/vulnz-$BUILD_VERSION.jar", "/usr/local/bin/vulnz"]

RUN chmod +x /mirror.sh && \
chown root:root /etc/crontabs/mirror && \
chown mirror:mirror /mirror.sh && \
RUN chmod +x /mirror.sh /validate.sh && \
chown root:root /etc/crontabs/mirror /etc/crontabs/validate && \
chown mirror:mirror /mirror.sh /validate.sh && \
chown mirror:mirror /usr/local/bin/vulnz

# ensures we can log cron task is into stdout of docker
Expand Down
1 change: 1 addition & 0 deletions vulnz/src/docker/crontab/validate
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 4 * * * /validate.sh 2>&1 | tee -a /var/log/docker_out.log | tee -a /var/log/cron_validate.log
14 changes: 3 additions & 11 deletions vulnz/src/docker/scripts/mirror.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
set -e

echo "Updating..."

Expand Down Expand Up @@ -32,14 +33,5 @@ if [ -n "${DEBUG}" ]; then
DEBUG_ARG="--debug"
fi

java $JAVA_OPT -jar /usr/local/bin/vulnz cve $DELAY_ARG $DEBUG_ARG $MAX_RETRY_ARG $MAX_RECORDS_PER_PAGE_ARG --cache --directory /usr/local/apache2/htdocs

echo "Validating the cache..."
for file in /usr/local/apache2/htdocs/*.gz; do
if ! gzip -t "$file"; then
echo "Corrupt gz file detected: $file, clearing cache and re-running mirror"
rm -rf /usr/local/apache2/htdocs/*
java $JAVA_OPT -jar /usr/local/bin/vulnz cve $DELAY_ARG $DEBUG_ARG $MAX_RETRY_ARG $MAX_RECORDS_PER_PAGE_ARG --cache --directory /usr/local/apache2/htdocs
break
fi
done
exec java $JAVA_OPT -jar /usr/local/bin/vulnz cve $DELAY_ARG $DEBUG_ARG $MAX_RETRY_ARG $MAX_RECORDS_PER_PAGE_ARG --cache --directory /usr/local/apache2/htdocs

12 changes: 12 additions & 0 deletions vulnz/src/docker/scripts/validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

echo "Validating the cache..."
for file in /usr/local/apache2/htdocs/*.gz; do
if ! gzip -t "$file"; then
echo "Corrupt gz file detected: $file, clearing cache and re-running mirror"
rm -rf /usr/local/apache2/htdocs/*
supervisorctl start init_nvd_cache
break
fi
done

Loading