Change dir structure
This commit is contained in:
14
setup/docker/Dockerfile
Normal file
14
setup/docker/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
FROM golang:1.6
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get install -y git openssh-client gcc nmap
|
||||
WORKDIR /app
|
||||
RUN go get github.com/kotakanbe/go-cve-dictionary
|
||||
RUN go get github.com/future-architect/vuls
|
||||
COPY fetch.sh .
|
||||
RUN /bin/bash /app/fetch.sh
|
||||
COPY config.toml .
|
||||
COPY run.sh .
|
||||
ENTRYPOINT ["/bin/bash", "/app/run.sh"]
|
||||
COPY id_rsa .
|
||||
COPY id_rsa.pub .
|
||||
7
setup/docker/README.md
Normal file
7
setup/docker/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Before building the docker
|
||||
|
||||
Since it's not on docker hub because blablabla, you have to :
|
||||
* Edit your [config.toml](https://github.com/future-architect/vuls#step6-config) to match your infrastructure
|
||||
* generate a keypair dedicated to this docker : ```ssh-keygen -t rsa -b 4096 -C "your_email@example.com"```
|
||||
* it's **highly** recommanded to use a restrained `authorized_keys` files with this key to be sure that it will be only usable from a single IP (after all it's a root executed software) : ```from="1.2.3.4,1.2.3.5" ssh-rsa [...] your_email@example.com```
|
||||
* Deploy your ssh key on the targetted machines
|
||||
2
setup/docker/fetch.sh
Normal file
2
setup/docker/fetch.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
for i in {2002..2016}; do go-cve-dictionary fetchnvd -years $i ; done
|
||||
1
setup/docker/id_rsa
Normal file
1
setup/docker/id_rsa
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
setup/docker/id_rsa.pub
Normal file
1
setup/docker/id_rsa.pub
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
28
setup/docker/run.sh
Normal file
28
setup/docker/run.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
tries=0
|
||||
|
||||
function isopen {
|
||||
tries=$1
|
||||
nmap -Pn -T4 -p 1323 127.0.0.1|grep -iq open
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $tries -lt 5 ]; then
|
||||
let tries++
|
||||
startserver $tries
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
function startserver {
|
||||
tries=$1
|
||||
go-cve-dictionary server &
|
||||
sleep 2
|
||||
isopen $tries
|
||||
}
|
||||
|
||||
startserver $tries
|
||||
if [ $? -ne 1 ]; then
|
||||
vuls scan -config /app/config.toml -report-slack
|
||||
fi
|
||||
Reference in New Issue
Block a user