Skip to content

Commit

Permalink
Merge pull request #163 from hikachan/repo01
Browse files Browse the repository at this point in the history
Improve setup/docker
  • Loading branch information
kotakanbe authored Oct 1, 2016
2 parents ea582d2 + c2eab87 commit c077c74
Show file tree
Hide file tree
Showing 22 changed files with 389 additions and 303 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ vendor/
log/
results/
*config.toml
!setup/docker/*
1 change: 0 additions & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ Vulsは上に挙げた手動運用での課題を解決するツールであり
Vulsのセットアップは以下の3パターンがある

- Dockerコンテナ上にセットアップ
Docker Composeを用いて少ないコマンドでセットアップ可能
see https://github.com/future-architect/vuls/tree/master/setup/docker
[日本語README](https://github.com/future-architect/vuls/blob/master/setup/docker/README.ja.md)
- Chefでセットアップ
Expand Down
101 changes: 0 additions & 101 deletions setup/docker/README.ja.md

This file was deleted.

147 changes: 83 additions & 64 deletions setup/docker/README.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,106 @@
# Vuls on Docker
# Vuls Docker components

## What's Vuls-On-Docker
This is the Git repo of the official Docker image for vuls.

- This is a dockernized-Vuls with vulsrepo UI in it.
- It's designed to reduce the cost of installation and the dependencies that vuls requires.
- You can run install and run Vuls on your machine with only a few commands.
- The result can be viewed with a browser
# Supported tags and respective `Dockerfile` links

## Setting up your machine

1. [Install Docker](https://docs.docker.com/engine/installation/)
2. [Install Docker-Compose](https://docs.docker.com/compose/install/)
3. Make sure that you can run the following commands before you move on.
- go-cve-dictionary
- [`latest` (*go-cve-dictionary:latest Dockerfile*)]()
- vuls
- [`latest` (*vuls:latest Dockerfile*)]()
- vulsrepo
- [`latest` (*vulsrepo:latest Dockerfile*)]()

```
$ docker version
$ docker-compose version
```

4. git clone vuls
```
mkdir work
cd work
git clone https://github.com/future-architect/vuls.git
cd vuls/setup/docker
```
This image version is same as the github repository version.

# How to use this image

1. fetch nvd (vuls/go-cve-dictionary)
1. configuration (vuls/vuls)
1. prepare (vuls/vuls)
1. scan (vuls/vuls)
1. vulsrepo (vuls/vulsrepo)

## Start A Vuls Container
## Step1. Fetch NVD

- Execute the following command to build and run a Vuls Container
```console
$ for i in {2002..2016}; do \
docker run --rm -it \
-v $PWD:/vuls vuls/go-cve-dictionary fetchnvd -years $i; \
done
```

```
$ docker-compose up -d
```
## Step2. Configuration

## Setting up Vuls
Create config.toml referring to [this](https://github.com/future-architect/vuls#configuration).

1. Locate ssh-keys of target servers in (vuls/setup/docker/conf/)
2. Create and adjust config.toml(vuls/setup/docker/conf/config.toml) to your environment

```
[servers]
```toml
[servers]

[servers.172-31-4-82]
host = "172.31.4.82"
user = "ec2-user"
keyPath = "conf/id_rsa"
```
[servers.amazon]
host = "54.249.93.16"
port = "22"
user = "vuls-user"
keyPath = "/root/.ssh/id_rsa" # path to ssh private key in docker
```


```console
$ docker run --rm \
-v ~/.ssh:/root/.ssh:ro \
-v $PWD:/vuls \
vuls/vuls configtest \
-config=./config.toml # path to config.toml in docker
```

## Fetch Vulnerability database
## Step3. Prepare

- Fetch Vulnerability database from NVD
```
$ docker exec -t vuls scripts/fetch_nvd_all.sh
```
```console
$ docker run --rm \
-v ~/.ssh:/root/.ssh:ro \
-v $PWD:/vuls \
vuls/vuls prepare \
-config=./config.toml # path to config.toml in docker
```

## Scan servers with Vuls-On-Docker
## Step4. Scan

```console
$ docker run --rm -it \
-v ~/.ssh:/root/.ssh:ro \
-v $PWD:/vuls \
-v /etc/localtime:/etc/localtime:ro \
-e "TZ=Asia/Tokyo" \
vuls/vuls scan \
-cve-dictionary-dbpath=/vuls/cve.sqlite3 \
-config=./config.toml \ # path to config.toml in docker
-report-json
```

- Use the embedded script to scan servers for vulsrepo(or run whatever with docker exec)
## Step5. vulsrepo

```
$ docker exec -t vuls vuls prepare -config=conf/config.toml
$ docker exec -t vuls scripts/scan_for_vulsrepo.sh
```
```console
$docker run -dt \
-v $PWD:/vuls \
-p 80:80 \
vuls/vulsrepo
```

## See the results in a browser
# User Feedback

```
http://${Vuls_Host}/vulsrepo/
```
## Documentation

Documentation for this image is stored in the [`docker/` directory]() of the [`future-architect/vuls` GitHub repo](https://github.com/future-architect/vuls).

# Update modules
## Issues

- update vuls, go-cve-dictionary, vulsrepo
```
$ docker exec -t vuls scripts/update_modules.sh
```
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).

# Update Vulnerability database
## Contributing

- Fetch Vulnerability database from NVD
```
$ docker exec -t vuls scripts/fetch_nvd_last2y.sh
```
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
12 changes: 12 additions & 0 deletions setup/docker/base/latest/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM golang:1.7.1

MAINTAINER hikachan sadayuki-matsuno

# glide install
ENV GLIDE_VERSION 0.12.2
ENV GLIDE_DOWNLOAD_URL https://github.com/Masterminds/glide/releases/download/v$GLIDE_VERSION/glide-v$GLIDE_VERSION-linux-amd64.tar.gz
RUN curl -fsSL "$GLIDE_DOWNLOAD_URL" -o glide.tar.gz \
&& mkdir /usr/local/glide \
&& tar -C /usr/local/glide -xzf glide.tar.gz \
&& ln -s /usr/local/glide/linux-amd64/glide /usr/local/bin/ \
&& rm glide.tar.gz
14 changes: 14 additions & 0 deletions setup/docker/base/latest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Vuls-Base-Docker

This is the Git repo of the official Docker image for vuls-base.
See the [Hub page](https://hub.docker.com/r/vuls/vuls-base/) for the full readme on how to use the Docker image and for information regarding contributing and issues.

# Supported tags and respective `Dockerfile` links

- [`0.1.0`, `latest` (*vuls-base:0.1.0 Dockerfile*)]()


# What is vuls-base?

Base images of vuls and go-cve-dictionary.

Empty file removed setup/docker/conf/.gitkeep
Empty file.
11 changes: 0 additions & 11 deletions setup/docker/docker-compose.yml

This file was deleted.

73 changes: 0 additions & 73 deletions setup/docker/dockerfile/Dockerfile

This file was deleted.

Loading

0 comments on commit c077c74

Please sign in to comment.