跳到主要内容开源漏洞扫描工具 SiriusScan 的 Docker 部署与常见问题解决 | 极客日志Go / Golang
开源漏洞扫描工具 SiriusScan 的 Docker 部署与常见问题解决
综述由AI生成详细记录了开源漏洞扫描工具 SiriusScan 基于 Docker 的部署全过程,涵盖环境准备、Docker 安装配置、镜像源加速及系统启动步骤。针对构建阶段常见的 Go 模块网络超时、结构体字段错误及 GitHub 克隆失败等典型问题,提供了修改 Dockerfile、清理缓存及使用代理地址的具体解决方案,帮助用户顺利完成本地化部署。
全栈工匠35 浏览 部署开源漏洞扫描工具 SiriusScan 及问题解决
SiriusScan 的核心代码托管在 GitHub 上,支持开源二次开发。官方网址 https://github.com/SiriusScan/Sirius。目前部署仅支持通过 Docker 进行。
1、先决条件
- Docker 引擎版本不低于 20.10.0+ 与 Docker Compose 版本 V2 以上
- 系统要求:至少 4GB RAM,10GB 可用磁盘空间
- 网络访问:用于漏洞数据库更新的互联网连接
- 支持的平台:Linux、macOS、Windows(带 WSL2)
部署 SiriusScan 主要依赖符合版本的 Docker 和 Docker Compose,其他为硬件、网络和系统类要求。
网络方面需配置好 IP 地址和 DNS,特别是 DNS(根据区域配置)。确保能正常更新系统和访问 GitHub 等网站。
如果是新系统最好把系统的源也配置好(以 Debian 12 为例):
nano /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware
deb-src https://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware
2、安装 Docker 和 Docker Compose
官方参考文档 https://docs.docker.com/engine/install/
根据自己的系统选择安装方式,以下以 Debian 系统为例:
2.1、卸载旧版本和冲突包
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do
sudo apt-get remove $pkg
done
2.2、选择安装方式
第一种 使用 apt 存储库安装:
在新主机上首次安装 Docker Engine 之前,需要设置 Docker apt 存储库。
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
root@sirius:~# apt-cache madison docker-ce | awk '{ print $3 }'
5:28.5.1-1~debian.12~bookworm
...
VERSION_STRING=5:28.5.1-1~debian.12~bookworm
sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl status docker
sudo systemctl start docker
docker version
docker compose version
第二种 使用包安装:
- containerd.io_<version>_<arch>.deb
- docker-ce_<version>_<arch>.deb
- docker-ce-cli_<version>_<arch>.deb
- docker-buildx-plugin_<version>_<arch>.deb
- docker-compose-plugin_<version>_<arch>.deb
安装 .deb 软件包。将以下示例中的路径更新为下载 Docker 软件包的位置。
sudo dpkg -i ./containerd.io_<version>_<arch>.deb \
./docker-ce_<version>_<arch>.deb \
./docker-ce-cli_<version>_<arch>.deb \
./docker-buildx-plugin_<version>_<arch>.deb \
./docker-compose-plugin_<version>_<arch>.deb
sudo systemctl status docker
sudo systemctl start docker
docker version
docker compose version
2.3、添加 docker 源
在 /etc/docker/ 目录下创建 daemon.json 文件,并添加源的信息。
nano /etc/docker/daemon.json
{
"registry-mirrors": [
"https://do.nark.eu.org",
"https://dc.j8.work",
"https://mirror.aliyuncs.com/",
"https://docker.mirrors.ustc.edu.cn/",
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://dockerproxy.com",
"https://docker.1panel.live",
"https://docker.1ms.run",
"https://dytt.online",
"https://registry.cyou",
"https://docker.xiaogenban1993.com",
"https://lispy.org",
"https://docker-0.unsee.tech",
"https://docker.mirrors.ustc.edu.cn",
"https://docker.nju.edu.cn"
]
}
3、Sirius scan 系统部署
git clone https://github.com/SiriusScan/Sirius.git
cd Sirius
docker compose up -d
4、登录系统
5、部署遇到的问题
git clone https://github.com/SiriusScan/Sirius.git
cd Sirius
docker compose up -d
在克隆 GitHub 上的 Sirius 项目时一般没什么问题,一遍步行可以多执行几遍就可以了。
大部分的问题都会出现在 docker compose up -d(构建、启动容器以及拉取镜像等等方面)。
报错信息 1:go mod download 步骤无法连接到 Go 模块代理服务器(proxy.golang.org),出现了网络超时问题,报错代码 1。
这个错误是因为在 Docker 构建过程中,go mod download 步骤无法连接到 Go 模块代理服务器(proxy.golang.org),出现了网络超时问题。
这种情况下需要编辑相应模块的 Dockerfile 文件来添加代理,这里出问题的是 sirius-ui 中的 app-system-monitor 模块,所以要编辑此模块的 Dockerfile 文件,凡是要执行 go mod download 命令的地方都添加代理:
ENV GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
ENV GOSUMDB=off
RUN git clone https://github.com/SiriusScan/app-system-monitor.git /tmp/system-monitor &&\
cd /tmp/system-monitor &&\
go mod download &&\
CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o system-monitor main.go &&\
cp system-monitor /system-monitor/ &&\
chmod +x /system-monitor/system-monitor &&\
rm -rf /tmp/system-monitor
为了防止其他模块出现同样问题,可以把其他模块(sirius-api、sirius-postgres、sirius-engine、sirius-rabbitmq、sirius-valkey)中的 Dockerfile 都添加了代理。或者那个出错就添加那个。
修改完以上信息后再次执行 docker compose up -d 命令。
报错信息 2:unknown field ID in struct literal of type sirius.Port。报错代码 1。
这是一个 Go 语言编译错误,问题出现在 sirius.Port 结构体的字段不匹配上。
unknown field ID in struct literal of type sirius.Port
这表明 sirius.Port 结构体中没有名为 ID 的字段,但代码中尝试使用这个字段。
再报同样错就清理缓存后,将 Sirius 项目删除后,重新拉取。
报错信息 3:Git 在克隆仓库时无法连接到 GitHub,报错代码 128
在报相同网络超时的错误时,一般多执行 2 遍 docker compose up -d 命令就可以了。
部署完成后,若登录系统未显示主机,建议检查构建日志或网络防火墙设置。
相关免费在线工具
- Base64 字符串编码/解码
将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online
- Base64 文件转换器
将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online
- Markdown转HTML
将 Markdown(GFM)转为 HTML 片段,浏览器内 marked 解析;与 HTML转Markdown 互为补充。 在线工具,Markdown转HTML在线工具,online
- HTML转Markdown
将 HTML 片段转为 GitHub Flavored Markdown,支持标题、列表、链接、代码块与表格等;浏览器内处理,可链接预填。 在线工具,HTML转Markdown在线工具,online
- JSON 压缩
通过删除不必要的空白来缩小和压缩JSON。 在线工具,JSON 压缩在线工具,online
- JSON美化和格式化
将JSON字符串修饰为友好的可读格式。 在线工具,JSON美化和格式化在线工具,online