harbor的https访问方式及自定义证书

2023-11-14

一、基本安装

docker  docker-compose

二、https访问harbor需要自定义证书

1、首先创建存放证书的目录,到对应目录证书的位置

[root@host1 harbor]# mkdir /opt/cert && cd /opt/cert

2、创建自己的CA证书(生成私钥,无加密)

[root@host1 cert]# openssl req -x509 -new -nodes -key ca.key -days 10000 -out ca.crt -subj "/CN=Harbor-ca"

3、生成自签名证书(使用已有私钥ca.key自行签发根证书)

[root@host1 cert]# openssl req -x509 -new -nodes -key ca.key -days 10000 -out ca.crt -subj "/CN=Harbor-ca"
req     产生证书签发申请命令
-x509   签发X.509格式证书命令。X.509是最通用的一种签名证书格式。
-new    生成证书请求
-key     指定私钥文件
-nodes   表示私钥不加密
-out    输出
-subj    指定用户信息
-days    有效期

4、生成服务器端私钥和CSR签名请求

[root@host1 cert]# openssl req -newkey rsa:4096 -nodes -sha256 -keyout server.key -out server.csr
Generating a 4096 bit RSA private key
...............................................................................................................................................................................................................++
..................................................................................++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:192.168.2.4
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

5、签发服务器证书

[root@host1 cert]# echo subjectAltName = IP:192.168.2.4 > extfile.cnf
[root@host1 cert]# openssl  x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -days 10000 -extfile extfile.cnf -out server.crt
Signature ok
subject=/C=XX/L=Default City/O=Default Company Ltd/CN=192.168.2.4
Getting CA Private Key

 6、下载安装harbor

wget https://github.com/goharbor/harbor/releases/download/v2.3.4/harbor-offline-installer-v2.3.4.tgz

可以在 以下地址下载离线安装包

https://github.com/   搜索 goharbor/harbor 找到releases下载

7、解压

[root@host1 src]# tar xvf harbor-offline-installer-v2.3.4.tgz 

 8、修改配置文件

[root@host1 src]# cd harbor
[root@host1 harbor]# ll
总用量 596284
-rw-r--r--. 1 root root      3361 11月  9 2021 common.sh
-rw-r--r--. 1 root root 610560420 11月  9 2021 harbor.v2.3.4.tar.gz
-rw-r--r--. 1 root root      7840 11月  9 2021 harbor.yml.tmpl
-rwxr-xr-x. 1 root root      2500 11月  9 2021 install.sh
-rw-r--r--. 1 root root     11347 11月  9 2021 LICENSE
-rwxr-xr-x. 1 root root      1881 11月  9 2021 prepare
[root@host1 harbor]# cp harbor.yml.tmpl harbor.yml
[root@host1 harbor]# vi harbor.yml
# Configuration file of Harbor

# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 192.168.2.4   #修改主机名,可以是域名也可以是ip

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 8000            # 端口号

# https related config
https:                  #打开注释
  # https port for harbor, default is 443
  port: 5000            #可以使用默认的443
  # The path of cert and key files for nginx
  # 因为k8s获取harbor仓库的镜像是使用的https,所有需要用证书
  certificate: /opt/cert/ca.crt    # 自定义证书位置目录
  private_key: /opt/cert/ca.key    # 自定义私钥目录

# # Uncomment following will enable tls communication between all harbor components
# internal_tls:
#   # set enabled to true means internal tls is enabled
#   enabled: true
#   # put your cert and key files on dir
#   dir: /etc/harbor/tls/internal
........
# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: Harbor12345     #修改harbor登录的密码

# Harbor DB configuration
database:
  # The password for the root user of Harbor DB. Change this before any production use.
  password: root123
  # The maximum number of connections in the idle connection pool. If it <=0, no idle connections are retained.
  max_idle_conns: 100
  # The maximum number of open connections to the database. If it <= 0, then there is no limit on the number of open connections.
  # Note: the default number of connections is 1024 for postgres of harbor.
  max_open_conns: 900

# The default data volume
data_volume: /opt/harbor/images   #指定harbor仓库存放镜像位置

9、装好docker-compose后,为harbor生成配置文件

[root@host1 harbor]# systemctl  restart docker
[root@host1 harbor]# ./prepare 

10、启动harbor

[root@host1 harbor]# docker-compose  up -d

11、浏览器测试登录

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

harbor的https访问方式及自定义证书 的相关文章

随机推荐

  • input标签的类型

    今天学习突然想着input有哪些类型呢 然后就查了下资料 记录一下 1 文本框 type text 2 密码框 type password 3 单选框 type radio 4 复选框 type checkbox 5 图片上传 type f
  • linux切换用户时报错 this account is currently not available

    linux切换用户时报错 this account is currently not available 在安装完redis之后系统创建了一个名叫redis用户 但切换到这个用户的时候却报了错 this account is current
  • 网站怎么创建?

    网站怎么创建 现在很多公司企业都会有自己的网站 即使是没有网站的公司也抓紧时间纷纷入局 希望能在互联网的流量中分到一杯羹 那么网站怎么创建呢 下面给大家简单说一说 网站怎么创建步骤1 首先我们准备好一个域名 一个网站需要有域名才能访问 我们
  • 论文笔记:DEEP DECLARATIVE DYNAMIC TIME WARPING FOREND-TO-END LEARNING OF ALIGNMENT PATHS

    个人感觉 可微DTW的主要优点作为一个损失函数 可以进行梯度反向传播 如果目标只是两个时间序列的相似度 可能不太需要 1 Intro 1 1 背景 DTW 笔记 Dynamic Time Warping 动态时间规整 DTW的python实
  • 寒假训练 第一节 时空复杂度分析

    算法是由若干条指令所组成的的有穷序列 其中每一条指令表示计算机的一个或多个操作 一个好的算法首先要具备正确性 可读性和健壮性 在具备这三个条件后 就应该考虑算法的效率问题 即算法的时间效率和空间效率两方面 时间复杂度 一个算法所需要的运算时
  • windows 搭建ssh服务

    1 官网下载安装包 mls software com 2 点击安装 一直默认即可 3 配置 opensshServer 4 成功登录
  • android6.0源码分析之Camera API2.0下的初始化流程分析

    在文章android源码分析之Camera API2 0简介中 对Camera API2 0的框架以及代码做了简单介绍 本文将基于android6 0源码 分析Camera API2 0下的Camera2内置应用中 对Camera的初始化的
  • umi3 antDesignPro布局layout配置快速搭建项目

    umi3 快速搭建项目 1 环境准备 2 创建项目 3 修改配置 应用antd layout布局 1 安装antd layout插件 2 修改 umirc 文件配置路由 3 根据配置文件中component新建路由对应的组件 1 环境准备
  • c语言中weak的作用

    转载至 https blog csdn net q2519008 article details 82774774 在u boot源码中看到 weak关键字 在移植过程中遇到了问题 用例 weak在不同的环境中用法不同 在stm32源码中也
  • 合宙Air105

    基础资料 基于Air105开发板 Air105 LuatOS 文档 上手 开发上手 LuatOS 文档 探讨重点 官方SFUD库操作 外置flash demo相关内容的学习及探讨 扩展 合宙Air103 SDIO 扩展 LuatOS SOC
  • 服务器UDIMM, LRDIMM,RDIMM三种内存的区别

    服务器UDIMM LRDIMM RDIMM三种内存的区别 UDIMM RDIMM LRDIMM 区别与应用 随着应用程序的不断增长 内存被迫承担着更大压力 目前不管是服务器租用还是PC领域 DDR4内存技术依旧是主流 由于DDR4采用并行传
  • keil stm32f407工程环境搭建

    一 库函数 1 安装https www keil com dd2 Pack 2Feula container 直接双击Keil STM32F4xx DFP 1 0 8 pack 二 创建工程 为当前工程添加相应的库函数 点击确定 函数添加成
  • 可能影响经济体安全的技术类别

    这份新的技术出口管理新提案内容相对简洁 清晰罗列了可能会影响强大国家安全或者经济体的14类新兴和基础技术 1 生物技术 例如 1 纳米生物学 2 合成生物学 3 基因组和基因工程 4 神经科学 2 人工智能 AI 和机器学习技术 例如 1
  • mac 下 jdgui invalid input fileloader

    在一次反编译中 前面几个步骤都是正确的 将classes dex成功转为classes dex2jar jar文件 在即将把classes dex2jar jar文件在jd gui中打开的时候 出现了jdgui invalid input
  • 判断ListView的第一个/最后一个item是否完全显示

    判断最后一项 亲测可用 当然网上还有很多其他的方法 不同场景的方式可能不一样 Override public void onScroll AbsListView view int firstVisibleItem int visibleIt
  • Android shape渐变色用代码怎么写?

    前言 shape在实际开发中非常常用 一般我们会在xml中使用 但涉及到颜色动态变更时 我们需要在代码中动态创建 xml中的shape 实际上被创建出来后它是一个Drawable 点开Drawable的子类一看 我们很容易就发现一些可疑的实
  • 【Android】DataBinding 最全使用解析

    DataBinding 最全使用解析 一 DataBinding 概述 二 基本用法 2 1 使用入门 2 2 布局和绑定表达式 2 3 事件绑定 2 4 单向绑定 2 5 双向绑定 三 高级用法 BindingAdapter 一 Data
  • Linux节点释放,关于linux:如何释放Inode的使用量?

    我有一个磁盘驱动器 其索引节点使用率为100 使用df i命令 但是 在实质上删除文件后 使用率仍为100 那么正确的方法是什么 磁盘空间使用较少的磁盘驱动器如何可能具有 Inode的使用率比磁盘空间使用率更高的磁盘驱动器高 如果我压缩大量
  • 前端面试大全(jQuery篇——含移动端常见问题)

    目录 面试系列 内容介绍 1 JQuery的源码看过吗 能不能简单概况一下它的实现原理 2 jQuery fn的init方法返回的this指的是什么对象 为什么要返回this 3 jquery中如何将数组转化为json字符串 然后再转化回来
  • harbor的https访问方式及自定义证书

    一 基本安装 docker docker compose 二 https访问harbor需要自定义证书 1 首先创建存放证书的目录 到对应目录证书的位置 root host1 harbor mkdir opt cert cd opt cer