Vuls是针对Linux系统的安全扫描工具,可以扫描各种系统安全漏洞并给出修订建议。
yum -y install sqlite git gc wget gcc
wget https://storage.googleapis.com/golang/go1.10.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.10.linux-amd64.tar.gz
mkdir $HOME/go
sudo sh -c 'cat << "EOF" > /etc/profile.d/goenv.sh
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
EOF'
source /etc/profile.d/goenv.sh
sudo mkdir /var/log/vuls
以下步骤需要连接google服务器,如果不能直接访问google服务器,需要提前设置
http_proxy和https_proxy
export http_proxy=x.x.x.x:abcd
export https_proxy=x.x.x.x:abcd
go get github.com/kotakanbe/go-cve-dictionary
如果go-cve-dictionary没有自动编译安装,需要手动编译安装
cd $GOPATH/src/github.com/kotakanbe/go-cve-dictionary
make install
cd $HOME
for i in `seq 2002 $(date +"%Y")`; do go-cve-dictionary fetchnvd -years $i; done
这个步骤时间较长,大约需要几十分钟,依赖于网速。
go get github.com/kotakanbe/goval-dictionary
如果goval-dictionary没有自动编译安装,需要手动编译安装,完成在$GOPATH/bin目录可以看到goval-dictionary可执行文件
cd $GOPATH/src/github.com/kotakanbe/goval-dictionary
make install
goval-dictionary fetch-redhat 7
go get github.com/future-architect/vuls
如果vuls没有自动编译安装,需要手动编译安装,完成在$GOPATH/bin目录可以看到vuls可执行文件
cd $GOPATH/src/github.com/future-architect/vuls
make install
扫描时需要从扫描服务器上能通过ssh免密码登录到被扫描服务器。ssh免密码配置需要在这两台服务器上同时配置。将每台服务器各自的公钥发送到对方服务器上。
- 生成RSA密钥对。此步骤不需要特殊指定,按三次回车确认即可完成。
ssh-keygen -t rsa
cd $HOME/.ssh/
ssh-copy-id -i id_rsa.pub x.x.x.x
用户以root为例
[servers]
[servers.x-x-x-x]
host = "x.x.x.x"
port = "22"
user = "root"
keyPath = "/root/.ssh/id_rsa"
[servers.y.y.y.y]
host = "y.y.y.y"
port = "22"
user = "root"
keyPath = "/root/.ssh/id_rsa"
go-cve-dictionary server
vuls configtest -config=/root/config.toml
vuls scan
vuls report -format-full-text