Harbor离线安装及扫描器的使用
harbor
Harbor 是一个开源的容器镜像仓库,用于存储和管理 Docker 镜像和其他容器镜像。 * 容器镜像仓库、存储和管理 Docker 镜像和其他容器镜像 * 有什么特点:支持多种镜像格式、易于使用、安全性和访问控制
项目地址:https://gitcode.com/gh_mirrors/ha/harbor

·
参考链接:https://blog.51cto.com/lidabai/5175749
注意!:此文章内出现的源都是自己配置的!!!!原样复制代码行不通!!!
#安装docker-compose
yum -y install epel-release
yum -y install docker-compose
#升级docker-compose(此处从其他地方下载来的)
mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
rm -f /usr/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
#安装docker
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://mirrors.xurikeji.com/package/setting/docker-ce.repo
sudo yum clean all
sudo yum makecache fast
sudo yum -y install docker-ce
#配置加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://docker.xurikeji.com"]
}
EOF
sudo systemctl daemon-reload
systemctl enable --now docker.service
#安装Harbor
wget https://mirrors.xurikeji.com/package/harbor/harbor-offline-installer-v2.4.0.tgz
tar zxvf harbor-offline-installer-v2.4.0.tgz -C /usr/local/
cd /usr/local/harbor
cp harbor.yml.tmpl harbor.yml
#配置文件只需修改hostname 为主机的ip地址,注释掉https
vim harbor.yml
#看看docker和docker-compose 还有所需文件等
./prepare
#安装
./install.sh
#然后看看提示安装成功后
#可以是用IP地址进行访问
#默认用户:admin 密码: Harbor12345(也可以自行更改)
#登录http://10.10.0.10后新建了一个habor项目
#配置私有仓库
[root@10.10.0.10 harbor]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.xurikeji.com"],
"insecure-registries":["http://10.10.0.10"]
}
[root@10.10.0.10 harbor]# systemctl restart docker.service
#登录私有仓库
[root@10.10.0.10 harbor]# docker login http://10.10.0.10
Username: admin
Password:
#修改镜像tag并且上传
[root@10.10.0.10 harbor]# docker tag nginx:latest 10.10.0.10/habor/nginx:1.20
[root@10.10.0.10 harbor]# docker tag nginx:latest 10.10.0.10/habor/nginx:latest
[root@10.10.0.10 harbor]# docker push 10.10.0.10/habor/nginx:1.20
[root@10.10.0.10 harbor]# docker push 10.10.0.10/habor/nginx:latest
#登录harbor查看是否上传成功
#安装Harbor时安装扫描器
[root@10.10.0.10 harbor]# ./install.sh --help
Note: Please set hostname and other necessary attributes in harbor.yml first. DO NOT use localhost or 127.0.0.1 for hostname, because Harbor needs to be accessed by external clients.
Please set --with-notary if needs enable Notary in Harbor, and set ui_url_protocol/ssl_cert/ssl_cert_key in harbor.yml bacause notary must run under https.
Please set --with-trivy if needs enable Trivy in Harbor
Please set --with-chartmuseum if needs enable Chartmuseum in Harbor
[root@10.10.0.10 harbor]# ./install.sh --with-trivy
#Harbor已启动后才安装扫描器(不会影响已存在的项目和镜像)
#先停止容器
[root@10.10.0.10 harbor]# docker-compose down
#到harbor工作目录执行./prepare
[root@10.10.0.10 harbor]# pwd
/usr/local/harbor
#安装Trivy扫描器
[root@10.10.0.10 harbor]# ./install.sh --with-trivy
#验证是否安装成功
[root@10.10.0.10 harbor]# docker-compose ps
Name Command State Ports
-----------------------------------------------------------------------------------------------------------------
harbor-core /harbor/entrypoint.sh Up (health: starting)
harbor-db /docker-entrypoint.sh 96 13 Up (health: starting)
harbor-jobservice /harbor/entrypoint.sh Up (health: starting)
harbor-log /bin/sh -c /usr/local/bin/ ... Up (health: starting) 127.0.0.1:1514->10514/tcp
harbor-portal nginx -g daemon off; Up (health: starting)
nginx nginx -g daemon off; Up (health: starting) 0.0.0.0:80->8080/tcp,:::80->8080/tcp
redis redis-server /etc/redis.conf Up (health: starting)
registry /home/harbor/entrypoint.sh Up (health: starting)
registryctl /home/harbor/start.sh Up (health: starting)
trivy-adapter(看这里) /home/scanner/entrypoint.sh Up (health: starting)
#可以登录Harbor UI界面查看了
#扫描器的使用说明
查看扫描器:登录Harbor UI界面==> 【项目】==>【扫描器】即可看到已经安装的扫描器。
单个镜像的扫描:项目–需要扫描的项目——项目下的某个镜像——点击【扫描】即可进行扫描
全局漏洞扫描:【系统管理】——【审查服务】——【漏洞】,全局漏洞扫描可手动触发,也可设置定时任务触发。
定时任务格式:秒 分钟 小时 每日 每月 周
自动扫描:在系统上传到项目成功后,系统自动对其进行扫描操作并生成相关报告。【项目】——【项目名】——【配置管理】
阻止有漏洞的镜像部署到容器中:当镜像经过漏洞扫描发现存在漏洞后,可以在【部署安全】-【阻止潜在漏洞镜像】选项阻止不同漏洞级别的镜像部署。
CVE白名单:如果某个镜像存在漏洞,但部署者可以接收这种漏洞,想继续使用该镜像来部署服务,则可以使用CVE特赦白名单。【系统管理】——【配置管理】——【系统设置】——【部署安全性】
扫描数据存储:进行漏洞扫描后,扫描结果数据存放于./data/trivy-adapter/trivy/db/trivy.db文件中。
扫描状态说明
1.已入队列:扫描过程的起始阶段,已创建扫描任务,但未执行扫描;
2.扫描中:正在进行扫描,但还未完成;
3.失败:扫描过程因为遇到不可忽略的错误导致扫描未成功完成,可通过系统扫描的日志信息排查;
4.成功:扫描过程成功,并生成对应的扫描报告。




Harbor 是一个开源的容器镜像仓库,用于存储和管理 Docker 镜像和其他容器镜像。 * 容器镜像仓库、存储和管理 Docker 镜像和其他容器镜像 * 有什么特点:支持多种镜像格式、易于使用、安全性和访问控制
最近提交(Master分支:6 个月前 )
45659070
Fix integration issue with UI
Signed-off-by: stonezdj <stone.zhang@broadcom.com> 9 天前
add0b600
chore(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp
Bumps [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp](https://github.com/open-telemetry/opentelemetry-go) from 1.31.0 to 1.34.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.31.0...v1.34.0)
---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 11 天前
更多推荐
所有评论(0)