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

feat: vulnz Docker #87

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
42 changes: 42 additions & 0 deletions vulnz/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM httpd:alpine

ARG BUILD_DATE
ARG BUILD_VERSION

ARG http_proxy
ARG https_proxy
ARG no_proxy

LABEL authors="derhecht,stevespringett,jeremylong"
LABEL maintainer="[email protected]"
LABEL name="jeremylong/vulnz"
LABEL version=$BUILD_VERSION
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.build-date=$BUILD_DATE
LABEL org.label-schema.name="jeremylong/vulnz"
LABEL org.label-schema.description="Persist the data using the open-vulnerability-store."
LABEL org.label-schema.url="https://github.com/jeremylong/Open-Vulnerability-Project"
LABEL org.label-schema.vcs-url="https://github.com/jeremylong/Open-Vulnerability-Project"
LABEL org.label-schema.vendor="jeremylong"
LABEL org.label-schema.version=$BUILD_VERSION
LABEL org.label-schema.docker.cmd="docker run -it --rm --name mirror -e NVD_API_KEY=YOUR_API_KEY_HERE -p 80:80 jeremylong/vulnz"

ENV user=mirror
ENV BUILD_VERSION=$BUILD_VERSION

RUN apk update && \
apk add --no-cache openjdk11 dcron nss supervisor && \
addgroup -S "$user" && \
adduser -S "$user" -G "$user" && \
chown -R "$user":"$user" /usr/local/apache2/htdocs && \
rm -v /usr/local/apache2/htdocs/index.html

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

EXPOSE 80/tcp

CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf", "-l", "/var/log/supervisord.log", "-j", "/var/run/supervisord.pid"]
8 changes: 8 additions & 0 deletions vulnz/src/docker/conf/mirror.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Configuration for the httpd mirror
#
ServerName localhost
<Directory /usr/local/apache2/htdocs>
Options +Indexes +MultiViews
IndexOptions FancyIndexing -SuppressLastModified
</Directory>
23 changes: 23 additions & 0 deletions vulnz/src/docker/conf/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[supervisord]
nodaemon=true
user=root

[program:crond]
command=crond -s /var/spool/cron/crontabs -f
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true

[program:httpd]
command=/usr/local/bin/httpd-foreground
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true

[program:initialize_htdocs]
command=/mirror.sh
autorestart=false
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
user=mirror
1 change: 1 addition & 0 deletions vulnz/src/docker/crontab/mirror
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 0 * * * /mirror.sh
9 changes: 9 additions & 0 deletions vulnz/src/docker/scripts/mirror.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

echo "Updating..."

CACHE_DIR=/usr/local/apache2/htdocs

java -jar /usr/local/bin/vulnz cve --cache --directory $CACHE_DIR
cd $CACHE_DIR || (echo "$CACHE_DIR not found - could not zip cve files\!" && exit 1)
for file in *.json; do gzip -k "${file}"; done

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this step still required? in 5.0.3 the output is produced already gzip'ed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if so, of course not. i will update.