From 4ac5d9e0daf05abe461ca5dc65fb2de26f0f3661 Mon Sep 17 00:00:00 2001 From: sadayuki-matsuno Date: Tue, 22 Aug 2017 12:40:54 +0900 Subject: [PATCH] add oval docker (#466) * add oval docker * Update README.md --- setup/docker/README.md | 43 ++++++ .../docker/goval-dictionary/latest/Dockerfile | 19 +++ .../docker/goval-dictionary/latest/README.md | 125 ++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 setup/docker/goval-dictionary/latest/Dockerfile create mode 100644 setup/docker/goval-dictionary/latest/README.md diff --git a/setup/docker/README.md b/setup/docker/README.md index 06cd4e38..0d3c5ac6 100644 --- a/setup/docker/README.md +++ b/setup/docker/README.md @@ -6,6 +6,8 @@ This is the Git repo of the official Docker image for vuls. - go-cve-dictionary - [`latest` (*go-cve-dictionary:latest Dockerfile*)]() +- goval-dictionary + - [`latest` (*goval-dictionary:latest Dockerfile*)]() - vuls - [`latest` (*vuls:latest Dockerfile*)]() - vulsrepo @@ -28,6 +30,14 @@ $ docker run --rm vuls/go-cve-dictionary -v go-cve-dictionary v0.0.xxx xxxx ``` +- goval-dictionary + +```console +$ docker run --rm vuls/goval-dictionary -v + +goval-dictionary v0.0.xxx xxxx +``` + - vuls ```console @@ -44,6 +54,12 @@ vuls v0.0.xxx xxxx $ docker rmi vuls/go-cve-dictionary ``` +- goval-dictionary + +``` +$ docker rmi vuls/goval-dictionary +``` + - vuls ``` @@ -58,6 +74,12 @@ $ docker rmi vuls/vuls $ docker pull vuls/go-cve-dictionary ``` +- goval-dictionary + +``` +$ docker pull vuls/goval-dictionary +``` + - vuls ``` @@ -72,6 +94,12 @@ $ docker run --rm vuls/go-cve-dictionary -v go-cve-dictionary v0.1.xxx xxxx ``` +```console +$ docker run --rm vuls/goval-dictionary -v + +goval-dictionary v0.1.xxx xxxx +``` + - vuls ```console @@ -84,6 +112,7 @@ vuls v0.1.xxx xxxx # How to use this image 1. fetch nvd (vuls/go-cve-dictionary) +1. fetch oval (vuls/goval-dictionary) 1. configuration (vuls/vuls) 1. configtest (vuls/vuls) 1. scan (vuls/vuls) @@ -100,6 +129,19 @@ $ for i in `seq 2002 $(date +"%Y")`; do \ done ``` +- To fetch JVN(Japanese), See [README](https://github.com/kotakanbe/go-cve-dictionary#usage-fetch-jvn-data) + +## Step2. Fetch OVAL (e.g. redhat) + +```console +$ docker run --rm -it \ + -v $PWD:/vuls \ + -v $PWD/goval-dictionary-log:/var/log/vuls \ + vuls/goval-dictionary fetch-redhat 5 6 7 +``` + +- To fetch other OVAL, See [README](https://github.com/kotakanbe/goval-dictionary#usage-fetch-oval-data-from-redhat) + ## Step2. Configuration Create config.toml referring to [this](https://github.com/future-architect/vuls#configuration). @@ -149,6 +191,7 @@ $ docker run --rm -it \ -v /etc/localtime:/etc/localtime:ro \ vuls/vuls report \ -cvedb-path=/vuls/cve.sqlite3 \ + -ovaldb-path=/vuls/oval.sqlite3 \ -format-short-text \ -config=./config.toml # path to config.toml in docker ``` diff --git a/setup/docker/goval-dictionary/latest/Dockerfile b/setup/docker/goval-dictionary/latest/Dockerfile new file mode 100644 index 00000000..6aeeb76b --- /dev/null +++ b/setup/docker/goval-dictionary/latest/Dockerfile @@ -0,0 +1,19 @@ +FROM golang:latest + +MAINTAINER sadayuki-matsuno + +ENV REPOSITORY github.com/kotakanbe/goval-dictionary +ENV LOGDIR /var/log/vuls +ENV WORKDIR /vuls +# goval-dictionary install +RUN git clone https://$REPOSITORY.git $GOPATH/src/$REPOSITORY \ + && cd $GOPATH/src/$REPOSITORY \ + && make install \ + && mkdir -p $LOGDIR + +VOLUME [$WORKDIR, $LOGDIR] +WORKDIR $WORKDIR +ENV PWD $WORKDIR + +ENTRYPOINT ["goval-dictionary"] +CMD ["--help"] diff --git a/setup/docker/goval-dictionary/latest/README.md b/setup/docker/goval-dictionary/latest/README.md new file mode 100644 index 00000000..48b33e68 --- /dev/null +++ b/setup/docker/goval-dictionary/latest/README.md @@ -0,0 +1,125 @@ +# goval-dictionary-Docker + +This is the Git repo of the official Docker image for goval-dictionary. +See the [Hub page](https://hub.docker.com/r/vuls/goval-dictionary/) for the full readme on how to use the Docker image and for information regarding contributing and issues. + +# Supported tags and respective `Dockerfile` links + +- [`latest` (*goval-dictionary:latest Dockerfile*)](https://github.com/future-architect/vuls/blob/master/setup/docker/goval-dictionary/latest/Dockerfile) + +# Caution + +This image is built per commit. +If you want to use the latest docker image, you should remove the existing image, and pull it once again. + +- Remove old docker image + +``` +$ docker rmi vuls/goval-dictionary +``` + +- Pull new docker image + +``` +$ docker pull vuls/goval-dictionary +``` + +# What is goval-dictionary? + +This is tool to build a local copy of the OVAL. The local copy is generated in sqlite format, and the tool has a server mode for easy querying. + +# How to use this image + +## check vuls version + +``` +$ docker run --rm vuls/goval-dictionary -v +``` + +## fetch-redhat + +```console +$ for i in `seq 5 7`; do \ + docker run --rm -it \ + -v $PWD:/vuls \ + -v $PWD/goval-dictionary-log:/var/log/vuls \ + vuls/goval-dictionary fetch-redhat $i; \ + done +``` + +## fetch-debian + +```console +$ for i in `seq 7 10`; do \ + docker run --rm -it \ + -v $PWD:/vuls \ + -v $PWD/goval-dictionary-log:/var/log/vuls \ + vuls/goval-dictionary fetch-debian $i; \ + done +``` + +## fetch-ubuntu + +```console +$ for i in `seq 12 2 16`; do \ + docker run --rm -it \ + -v $PWD:/vuls \ + -v $PWD/goval-dictionary-log:/var/log/vuls \ + vuls/goval-dictionary fetch-ubuntu $i; \ + done +``` + +## fetch-suse + +```console +$ docker run --rm -it \ + -v $PWD:/vuls \ + -v $PWD/goval-dictionary-log:/var/log/vuls \ + vuls/goval-dictionary fetch-suse -opensuse 13.2 +``` + +## fetch-oracle + +```console +$ docker run --rm -it \ + -v $PWD:/vuls \ + -v $PWD/goval-dictionary-log:/var/log/vuls \ + vuls/goval-dictionary fetch-oracle +``` + +## server + +```console +$ docker run -dt \ + --name goval-dictionary \ + -v $PWD:/vuls \ + -v $PWD/goval-dictionary-log:/var/log/vuls \ + --expose 1324 \ + -p 1324:1324 \ + vuls/goval-dictionary server --bind=0.0.0.0 +``` + +Prease refer to [this](https://hub.docker.com/r/vuls/goval-dictionary). + +## vuls + +Please refer to [this](https://hub.docker.com/r/vuls/vuls/). + +# User Feedback + +## Documentation + +Documentation for this image is stored in the [`docker/` directory](https://github.com/future-architect/vuls/tree/master/setup/docker) of the [`future-architect/vuls` GitHub repo](https://github.com/future-architect/vuls). + +## Issues + +If you have any problems with or questions about this image, please contact us through a [GitHub issue](https://github.com/future-architect/vuls/issues). + +## Contributing + +1. fork a repository: github.com/future-architect/vuls to github.com/you/repo +1. get original code: go get github.com/future-architect/vuls +1. work on original code +1. add remote to your repo: git remote add myfork https://github.com/you/repo.git +1. push your changes: git push myfork +1. create a new Pull Request