解决ssl certificates updated-生成环境中的实例

news2024/9/25 4:53:09

应原来小伙伴的要求,生产环境出错了,是harbor的ssl cert过期了,也因为使用的是免费的ssl证书,现在无法正常使用harbor,所以贴来了2023年1月曾经搭建的文档,希望能解决问题。^v^.

-------------------------------------------------------------------------------------------------------------------------------

以下是历史正文记录:

最近发现其中一个域名的证书到期了,无赖,现在行情不好,所以没准备续费购买商用版的证书,自己搭建把。好几个ssl证书都颁发使用(如下域名服务),域名为阿里购买的,所以原来的证书也是阿里的。

写个docs,就是update harbor的ssh crt把。

0、登录:https://harbortest.ihlt.com即出现以下界面,配置了ssl证书想通过IP也访问不了!

登录aliyun申请免费的证书把,需要购买证书服务,用了公司的企业账号,一次性可以免费申请20个,但是并非是根证书哦。截图记录把。

这里我看了harbor原来的证书格式为crt,密钥为key

所以我下载了对应的nginx的

应该harbor的证书也是通过nginx来写的

harbor@uat-harbor01:~$ sudo -i

[sudo] password for harbor:

root@uat-harbor01:~# cd /root/harbor/

root@uat-harbor01:~/harbor# ls

common  common.sh  docker-compose.yml  harbor.v2.6.0.tar.gz  harbor.yml  harbor.yml.tmpl  install.sh  LICENSE  prepare

root@uat-harbor01:~/harbor# ls

common  common.sh  docker-compose.yml  harbor.v2.6.0.tar.gz  harbor.yml  harbor.yml.tmpl  install.sh  LICENSE  prepare

root@uat-harbor01:~/harbor# cd /data/cert/

root@uat-harbor01:/data/cert# ls

harbortest.ihlt.com.crt  harbortest.ihlt.com.key

root@uat-harbor01:/data/cert#

root@uat-harbor01:~/harbor# cat 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: harbortest.ihlt.com

# http related config

http:

  # port for http, default is 80. If https enabled, this port will redirect to https port

  port: 80

# https related config

https:

  # https port for harbor, default is 443

  port: 443

  # The path of cert and key files for nginx

  certificate: /data/cert/harbortest.ihlt.com.crt

  private_key: /data/cert/harbortest.ihlt.com.key

依次操作如下图,

2、更新证书:

把下载的证书拷贝到对应的目录

通过finnalshell的sftp来直接拉传

root@uat-harbor01:/data/cert# ls

harbortest.ihlt.com.crt  harbortest.ihlt.com.key

root@uat-harbor01:/data/cert# mv harbortest.ihlt.com.crt harbortest.ihlt.com.crt0

root@uat-harbor01:/data/cert# mv harbortest.ihlt.com.key harbortest.ihlt.com.key0

root@uat-harbor01:/data/cert# mv /tmp/harbortest.ihlt.com.* ./

root@uat-harbor01:/data/cert# ls

harbortest.ihlt.com.crt0  harbortest.ihlt.com.key  harbortest.ihlt.com.key0  harbortest.ihlt.com.pem

root@uat-harbor01:/data/cert# ls -al

total 24

drwxr-xr-x 2 root   root   4096 Sep  1 09:19 .

drwxr-xr-x 4 root   root   4096 Oct 11  2022 ..

-rw-r--r-- 1 harbor harbor 3805 Oct 11  2022 harbortest.ihlt.com.crt0

-rw-rw-r-- 1 harbor harbor 1675 Sep  1 09:13 harbortest.ihlt.com.key

-rw-r--r-- 1 harbor harbor 1675 Oct 11  2022 harbortest.ihlt.com.key0

-rw-rw-r-- 1 harbor harbor 3813 Sep  1 09:13 harbortest.ihlt.com.pem

root@uat-harbor01:/data/cert#

3、重启harbor

停止docker-compose down

重新执行./prepare

启动docker-compose up -d

root@uat-harbor01:~/harbor# ./prepare

prepare base dir is set to /root/harbor

Clearing the configuration file: /config/portal/nginx.conf

Clearing the configuration file: /config/log/rsyslog_docker.conf

Clearing the configuration file: /config/log/logrotate.conf

Generated configuration file: /config/portal/nginx.conf

Generated configuration file: /config/log/logrotate.conf

Generated configuration file: /config/log/rsyslog_docker.conf

Traceback (most recent call last):

  File "/usr/src/app/main.py", line 15, in <module>

    cli()

  File "/usr/lib/python3.10/site-packages/click/core.py", line 1137, in __call__

    return self.main(*args, **kwargs)

  File "/usr/lib/python3.10/site-packages/click/core.py", line 1062, in main

    rv = self.invoke(ctx)

  File "/usr/lib/python3.10/site-packages/click/core.py", line 1668, in invoke

    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/usr/lib/python3.10/site-packages/click/core.py", line 1404, in invoke

    return ctx.invoke(self.callback, **ctx.params)

  File "/usr/lib/python3.10/site-packages/click/core.py", line 763, in invoke

    return __callback(*args, **kwargs)

  File "/usr/src/app/commands/prepare.py", line 47, in prepare

    prepare_nginx(config_dict)

  File "/usr/src/app/utils/nginx.py", line 23, in prepare_nginx

    render_nginx_template(config_dict)

  File "/usr/src/app/utils/nginx.py", line 56, in render_nginx_template

    prepare_nginx_certs(config_dict['cert_key_path'], config_dict['cert_path'])

  File "/usr/src/app/utils/nginx.py", line 43, in prepare_nginx_certs

    shutil.copy2(host_ngx_cert_path, real_crt_path)

  File "/usr/lib/python3.10/shutil.py", line 434, in copy2

    copyfile(src, dst, follow_symlinks=follow_symlinks)

  File "/usr/lib/python3.10/shutil.py", line 254, in copyfile

    with open(src, 'rb') as fsrc:

FileNotFoundError: [Errno 2] No such file or directory: '/hostfs/data/cert/harbortest.ihlt.com.crt'

//马虎,提示没有这个文件,所以去看了下,忘记了上面的harbor.yml的crt而不是拷贝进来的pem,所以进入目录可以直接修改即可。

root@uat-harbor01:~/harbor# cd /data/cert/

root@uat-harbor01:/data/cert# ls

harbortest.ihlt.com.crt0  harbortest.ihlt.com.key  harbortest.ihlt.com.key0  harbortest.ihlt.com.pem

root@uat-harbor01:/data/cert# mv harbortest.ihlt.com.pem harbortest.ihlt.com.crt

root@uat-harbor01:~/harbor# ./prepare

prepare base dir is set to /root/harbor

Clearing the configuration file: /config/portal/nginx.conf

Clearing the configuration file: /config/log/rsyslog_docker.conf

Clearing the configuration file: /config/log/logrotate.conf

Generated configuration file: /config/portal/nginx.conf

Generated configuration file: /config/log/logrotate.conf

Generated configuration file: /config/log/rsyslog_docker.conf

Generated configuration file: /config/nginx/nginx.conf

Generated configuration file: /config/core/env

Generated configuration file: /config/core/app.conf

Generated configuration file: /config/registry/config.yml

Generated configuration file: /config/registryctl/env

Generated configuration file: /config/registryctl/config.yml

Generated configuration file: /config/db/env

Generated configuration file: /config/jobservice/env

Generated configuration file: /config/jobservice/config.yml

loaded secret from file: /data/secret/keys/secretkey

Generated configuration file: /compose_location/docker-compose.yml

Clean up the input dir

root@uat-harbor01:~/harbor# docker-compose up -d

[+] Running 10/10

  Network harbor_harbor        Created                                                                              0.2s

  Container harbor-log         Started                                                                              0.8s

  Container registryctl        Started                                                                              1.4s

  Container harbor-portal      Started                                                                              1.7s

  Container redis              Started                                                                              1.8s

  Container registry           Started                                                                              1.7s

  Container harbor-db          Started                                                                              1.3s

  Container harbor-core        Started                                                                              1.9s

  Container nginx              Started                                                                              2.3s

  Container harbor-jobservice  Started                                                                              2.2s

root@uat-harbor01:~/harbor#

再次访问:恢复正常了!

nginx更新证书-2023/10/19

公司的holitech.net的证书过期了,阿里云上购买了根证书。首先上传服务,然后替换对应的路径,可以查看nginx.conf的配置:路径,然后必须重启nginx服务。后端测试OK。。。。!

[root@k8s-ng2 paas]# scp holitech.net.* root@10.6.200.223:/root/

ssh: connect to host 10.6.200.223 port 22: Connection refused

lost connection

[root@k8s-ng2 paas]# scp holitech.net.* root@10.0.200.223:/data/cert

root@10.0.200.223's password:

holitech.net.key                                                                                                      100% 1679    18.3KB/s   00:00   

holitech.net.pem                                                                                                      100% 3822   987.3KB/s   00:00   

[root@k8s-ng1 data]# cd cert/

[root@k8s-ng1 cert]# ls

8631154__holitech.net.key  holitech.net.key

8631154__holitech.net.pem  holitech.net.pem

[root@k8s-ng1 cert]# mv  holitech.net.key 8631154__holitech.net.key

mv:是否覆盖"8631154__holitech.net.key" y

[root@k8s-ng1 cert]# mv holitech.net.pem 8631154__holitech.net.pem

mv:是否覆盖"8631154__holitech.net.pem" y

[root@k8s-ng1 cert]# whereis ngix

ngix:[root@k8s-ng1 cert]# whereis nginx

nginx: /usr/local/nginx

[root@k8s-ng1 cert]# cd /usr/local/nginx/

[root@k8s-ng1 nginx]# ls

client_body_temp  fastcgi_temp  logs        sbin       uwsgi_temp

conf              html          proxy_temp  scgi_temp

[root@k8s-ng1 nginx]# cd sbin/

[root@k8s-ng1 sbin]# ls

nginx

[root@k8s-ng1 sbin]# ./nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

[root@k8s-ng1 sbin]# systemctl restart nginx

[root@k8s-ng2 paas]# systemctl restart nginx

--------------------------------------------------------------------------------------------------------

crt证书信息:

Harbor.ihlt.com_chain的证书

详细信息如下:

版本 :V3

序列号:0de0ffb5ee62cb61109f608c9ced5ed3

签名算法: sha256RSA

签名哈希算法: sha256

颁发者:

CN = DigiCert Global Root G2

OU = www.digicert.com

O = DigiCert Inc

C = US

有效期从: Monday, ‎November ‎27, ‎2017 8:46:40 PM

到: ‎Saturday, ‎November ‎27, ‎2027 8:46:40 PM

使用者:

CN = Encryption Everywhere DV TLS CA - G2

OU = www.digicert.com

O = DigiCert Inc

C = US

公钥:

30 82 01 0a 02 82 01 01 00 ef 14 7f 8e a2 fe 7a fb a6 48 13 0e a9 c4 79 22 1f 08 5a af 3e 75 2a dd a1 75 b4 c2 79 86 1f 4c 9c ee 8b 9a de 54 74 77 c1 1b 00 bd 4a 2f 97 8c ad 76 72 36 60 c4 e6 ec 2f a4 60 d6 78 ef 36 10 0c 27 82 6e 9c dd 09 18 64 49 19 27 af 6c 9b 00 de c7 3a f2 76 cf 43 3b 8a a7 92 5c f2 fa 6b ca 9d a6 b6 cd fc a5 20 97 a2 b3 d1 fa c7 21 42 2b 0a 03 b3 92 43 53 23 70 53 74 77 bb 5b ad c7 96 14 d6 f3 80 bd 9c b0 95 50 7a 88 0e 04 64 9e fc a6 44 21 9c 3a 81 72 ca 78 57 bb 9a ea 67 35 82 51 3a 2d a2 0b 5d 7e 1e e1 7b f6 20 2d b4 c7 37 d8 2b fa 50 ec 62 c5 8f f7 65 5f 8b ce 92 e7 92 51 6a f7 c5 ce 46 0c 24 20 92 f5 1e eb cf 85 af 32 bd bf 96 e8 98 ac 95 92 4b f8 72 c5 b6 27 68 c6 62 3b 42 6d d9 c8 85 7a e9 6e 77 dc 3b 06 16 29 85 26 4c f7 cb 41 9e 1d 6b 92 54 c6 c8 95 fb 02 03 01 00 01

公钥参数: 05 00

使用者密钥标识符:78df91905feedeacf6c575ebd54c5553ef244ab6

授权密钥标识符: KeyID=4e2254201895e6e36ee60ffafab912ed06178f39

增强型密钥用法:

服务器身份验证 (1.3.6.1.5.5.7.3.1)

客户端身份验证 (1.3.6.1.5.5.7.3.2)

授权信息访问:

[1]Authority Info Access

     Access Method=联机证书状态协议 (1.3.6.1.5.5.7.48.1)

     Alternative Name:

          URL=http://ocsp.digicert.com

CRL分发点:

[1]CRL Distribution Point

     Distribution Point Name:

          Full Name:

               URL=http://crl3.digicert.com/DigiCertGlobalRootG2.crl

证书策略:

[1]Certificate Policy:

     Policy Identifier=2.16.840.1.114412.1.2

     [1,1]Policy Qualifier Info:

          Policy Qualifier Id=CPS

          Qualifier:

               Legal Repository | DigiCert.com

[2]Certificate Policy:

     Policy Identifier=2.23.140.1.2.1

密钥用法: Digital Signature, Certificate Signing, Off-line CRL Signing, CRL Signing (86)

基本约束:

Subject Type=CA

Path Length Constraint=0

指纹: ed6302684a3259aa04f10fe9a97a8fd30b965d26

常规信息:

颁发给: Encryption Everywhere DV TLS CA - G2

颁发者: DigiCert Global Root G2

Harbor.ihlt.com_public的证书

常规信息:

颁发给: harbor.ihlt.com

颁发者: Encryption Everywhere DV TLS CA - G2

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2077568.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

25 filedialog组件

Tkinter filedialog 组件使用指南 Tkinter 的 filedialog 组件提供了一个图形界面&#xff0c;用于打开和保存文件。它允许用户通过标准的文件选择对话框来选择文件&#xff0c;非常适合需要文件操作的GUI应用程序。以下是对 filedialog 组件的详细说明和一个使用案例。 file…

爆改YOLOv8 |YOLOv8融合SEAM注意力机制

1&#xff0c;本文介绍 SEAM&#xff08;Spatially Enhanced Attention Module&#xff09;是一个注意力网络模块&#xff0c;旨在解决面部遮挡导致的响应损失问题。通过使用深度可分离卷积和残差连接的组合&#xff0c;SEAM模块增强未遮挡面部的响应。深度可分离卷积在每个通…

Xshell 连接 Ubuntu 服务器失败问题(Connection failed)

目录 Xshell 连接 Ubuntu 服务器失败问题&#xff08;Connection failed&#xff09; 1.查看Ubuntu中是否安装 sshd 2.在Ubuntu中安装sshd 3.需要打开Ubuntu中新安装的sshd 4.在检查Ubuntu中sshd是否安装成功 5.临时关闭Ubuntu中的防火墙 6.Xshell 连接 Ubuntu 服务器成…

认知杂谈24

今天分享 有人说的一段争议性的话 I I 《人生逆袭的关键&#xff1a;开窍带来的转变》 在女人的生活里啊&#xff0c;最宝贝的东西可不是那些金银首饰啥的&#xff0c;也不只是那些起起落落的经历&#xff0c;更不是偶尔碰到的贵人帮忙。真正无价的&#xff0c;是在某个瞬间…

构建buildroot根文件系统

目录 1.确定gcc工具版本2.下载Buildroot源码并编译2.1 下载Buildroot源码2.2 配置Buildroot2.2.1 配置 Target options2.2.2 配置交叉编译工具链2.2.3 配置 System configuration2.2.4 配置 Filesystem images2.2.5 禁止编译 Linux 内核和 uboot2.2.6 编译Buildroot源码2.2.7 查…

Bootloader中的PBL、SBL的区别

从0开始学习CANoe使用 从0开始学习车载车身 相信时间的力量 星光不负赶路者&#xff0c;时光不负有心人。 目录 1.概述2.BootloaderPBLSBL3.SBL存在意义4.PBL存在意义 1.概述 应用软件和应用数据可以同时编程或者相互独立编程&#xff0c;不允许Boot Loader在软件运行时被非法…

透明度测试

&#xff11;、透明测试是用于处理哪种透明需求 在游戏开发中对象的某些部位完全透明而其他部位完全不透明,这种透明需求往往不需要半透明效果,相对比较极端&#xff0c;只有看得见和看不见之分比如树叶、草、栅栏等等。&#xff08;即一张图除了主要物体有颜色&#xff0c;其…

<WPF> xaml代码如何使用c#编写

<Window x:Class"grid面板的使用.MainWindow"xmlns"http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x"http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d"http://schemas.microsoft.com/expression/blend/2008&…

【Java】—— Java面向对象基础:编程实例(学生信息管理)

目录 场景描述 定义学生类 创建学生对象并处理需求 代码解析 总结 在Java中&#xff0c;面向对象编程&#xff08;OOP&#xff09;是一种常用的编程范式&#xff0c;它允许我们创建基于现实世界的模型&#xff0c;通过类和对象来模拟这些模型。今天&#xff0c;我们将通过…

MySQL 集群技术全攻略:从搭建到优化(上)

目录 一.Mysql在服务器中的部署方法 1.在Linux下部署mysql 二.mysql的组从复制 1.当有数据时添加slave2 2.延迟复制 3.慢查询日志 4.mysql的并行复制 5.原理架构图 5.1三个线程 5.2复制三步骤 6.架构缺陷 三.半同步模式 1.半同步模式原理 2.gtid模式 3.启用半同…

数组、向量与矩阵

问题缘起 在看《矩阵力量》的时候&#xff0c;写到 利用 a numpy.array([4,3]). 严格说&#xff0c;此代码产生的不是行向量&#xff0c;运行 a.ndim 发现 a 只有一个维度。因此&#xff0c;转置 numpy.array([4,3]).T 得到的仍然是一维数组&#xff0c;只不过默认展示方式为…

腾讯提出一种新的针对风格化角色和逼真服装动画的生成3D运动转移方法,生成效果逼真!

来自腾讯XR视觉实验室的研究团队提出了一种创新的3D运动转移方法&#xff0c;专门针对风格化角色和逼真服装动画的生成。该方法能够将源动作准确地映射到目标角色上&#xff0c;同时考虑了角色身体的刚性变形和服装的局部物理动态变形。 与现有技术相比&#xff0c;这技术不仅…

探索分析文档布局,基于YOLOv8全系列【n/s/m/l/x】参数模型开发构建大规模文档数据集DocLayNet场景下文档图像布局智能检测分析识别系统

随着数字化和信息化的快速发展&#xff0c;大量的文档&#xff08;如合同、报告、表格、发票等&#xff09;以电子形式存在&#xff0c;这些文档中包含了丰富的信息。然而&#xff0c;这些信息往往以非结构化的形式存在&#xff0c;难以直接被计算机程序理解和处理。文档布局分…

8.26DEBUG

线程负责监听和处理不同的需求 顾客&#xff1a;代表需要被监控的文件句柄或网络socket&#xff0c;他们可能有各种需求&#xff0c;如点餐&#xff08;发送数据&#xff09;、询问菜品状态&#xff08;读取数据&#xff09;或需要帮助&#xff08;异常处理&#xff09; 菜单…

Android adb shell查看手机user,user_root,user_debug版本

Android adb shell查看手机user&#xff0c;user_root&#xff0c;user_debug版本 1、首先&#xff0c; adb shell 2、进入后&#xff0c;运行&#xff1a; getprop | grep ro.system.build.type 即会输出当前手机类型user,user_debug等。 另外&#xff0c;也可以运行&#…

NoSql数据库Redis集群

一、关系型数据库和 NoSQL 数据库 1.1 数据库主要分为两大类&#xff1a;关系型数据库与 NoSQL 数据库 关系型数据库 &#xff0c;是建立在关系模型基础上的数据库&#xff0c;其借助于集合代数等数学概念和方法来处理数据库中的数据主流的 MySQL 、 Oracle 、 MS SQL Server…

打渔的寓言--汽车软件开发技术进化史

刺儿&#xff0c;生于渔村。 少有志&#xff0c;即从学&#xff0c;颇有祖逖、车胤之风。尝三冬读书于野&#xff0c;狂风暴雪而不辍&#xff0c;七月就读于闹室而不知挥汗如雨。既加冠&#xff0c;有所成。能熟读古圣贤之书&#xff0c;亦能倒背《春秋》如流。 是年&#xf…

Git在IDEA中的集成操作(附步骤图)

1.先做适配操作&#xff0c;将安装的Git软件关联到IDEA中 点击Test之后若成功会显示出Git版本&#xff1a; 2.创建版本仓库 3.创建新的版本 3.1将文件提交到暂存区(不重要) 第一种方式&#xff1a;菜单栏提交 第二种方式&#xff1a;项目右键提交 4.查看历史版本信息 目…

Pyqt5:多线程任务、窗体打开、常用控件介绍(含基础Demo)

一、多线程任务和第二窗体打开demo 【main】 import untitled import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBoxif __name__ __main__:app QApplication(sys.argv)MainWindow QMainWindow()ui untitled.Ui_MainWindow()#也可能是Ui_Form/U…

网络各层的安全实例:从物理层到应用层的保护

在前面的各节中&#xff0c;我们学习了利用密码学技术实现机密性、完整性、数字签名和实体鉴别等安全服务的基本方法。在本节中&#xff0c;我们将讨论这些方法在网络各层的具体应用实例。这些安全应用实例涉及从物理层到应用层的所有层次。 1. 为什么需要在网络各层提供安全服…