首先,下载fq (fanqiang) harbor-offline-installer-v1.2.0-rc5.tgz

 tar xvf harbor-offline-installer-<version>.tgz

本文参考(https://github.com/vmware/harbor/blob/master/docs/configure_https.md )

  1. Create your own CA certificate:
  openssl req \
-newkey rsa:4096 -nodes -sha256 -keyout ca.key \
-x509 -days 365 -out ca.crt
  1. Generate a Certificate Signing Request:

If you use FQDN like reg.yourdomain.com to connect your registry host, then you must use reg.yourdomain.com as CN (Common Name). Otherwise, if you use IP address to connect your registry host, CN can be anything like your name and so on:

  openssl req \
-newkey rsa:4096 -nodes -sha256 -keyout yourdomain.com.key \
-out yourdomain.com.csr
  1. Generate the certificate of your registry host:

If you're using IP, say 10.1.1.5 to connect your registry host, you may instead run the command below:

  echo subjectAltName = IP:10.1.1.50 > extfile.cnf

  openssl x509 -req -days 365 -in 10.1.1.5.csr -CA ca.crt -CAkey ca.key -CAcreateserial -extfile extfile.cnf -out 10.1.1.50.com
.crt

Configuration and Installation

After obtaining the yourdomain.com.crt and yourdomain.com.key files, you can put them into directory such as/root/cert/:

  cp 10.1.1.50.crt /root/cert/
cp 10.1.1.50.key /root/cert/

Next, edit the file make/harbor.cfg , update the hostname and the protocol, and update the attributes ssl_cert andssl_cert_key:

  #set hostname
hostname = 10.1.1.50
#set ui_url_protocol
ui_url_protocol = https
......
#The path of cert and key files for nginx, they are applied only the protocol is set to https
ssl_cert = /root/cert/10.1.1.50.crt
ssl_cert_key = /root/cert/10.1.1.50.key

Generate configuration files for Harbor:

  ./prepare

Finally, restart Harbor:

  docker-compose up -d

After setting up HTTPS for Harbor, you can verify it by the following steps:

  1. Open a browser and enter the address: https://10.1.1.50 . It should display the user interface of Harbor.

docker login reg.yourdomain.com
(admin/Harbor12345) --succeed

Troubleshooting

You may get an intermediate certificate from a certificate issuer. In this case, you should merge the intermediate certificate with your own certificate to create a certificate bundle. You can achieve this by the below command:

[

自签CA证书:
cd /etc/pki/CA
touch index.txt
echo 01 > serial
openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048
chmod 600 private/cakey.pem
openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -days 7300 -out /etc/pki/CA/cacert.pem

cd /etc/docker/certs.d/
 mkdir 10.1.1.50
cd 10.1.1.50/
cp /etc/pki/CA/cacert.pem ./
 cat /etc/pki/CA/cacert.pem >> /etc/pki/tls/certs/ca-bundle.crt

systemctl restart docker

docker-compose stop
docker-compose up -d
 docker-compose ps

]



harbor Configuring Harbor with HTTPS Access的更多相关文章

  1. 【Docker】企业级镜像仓库harbor的搭建(http/https)及使用

    一:用途 Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器. 二:安装docker-ce 环境:阿里云轻量应用服务器CentOS 7.3 这里通过yum Docker源仓 ...

  2. Configuring HTTP and HTTPS

    Configuring HTTP and HTTPS .NET Framework (current version)   Other Versions   WCF services and clie ...

  3. (七)VMware Harbor 问题:Get https://192.168.3.135:8088/v2/: http:server gave HTTP response to HTTPS client

    (一)问题描述 登陆时,报错 docker Get https://192.168.3.135:8088/v2/: http:server gave HTTP response to HTTPS cl ...

  4. harbor官方关于创建https的有关命令

    官方地址:https://goharbor.io/docs/2.0.0/install-config/configure-https/ 命令总结: openssl genrsa -out ca.key ...

  5. Installation and Configuration Guide

    Harbor can be installed by one of three approaches: Online installer: The installer downloads Harbor ...

  6. Docker 私有仓库 Harbor registry 安全认证搭建 [Https]

    Harbor源码地址:https://github.com/vmware/harborHarbort特性:基于角色控制用户和仓库都是基于项目进行组织的, 而用户基于项目可以拥有不同的权限.基于镜像的复 ...

  7. 私有仓库harbor安装包括https

    1. 下载离线的 harbor gz包 wget https://github.com/vmware/harbor/releases/download/v1.2.0/harbor-offline-in ...

  8. Harbor + Https 部署

    关闭防火墙和selinux systemctl stop firewalld sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selin ...

  9. K8S集群集成harbor(1.9.3)服务并配置HTTPS

    一.简介 简介请参考:https://www.cnblogs.com/panwenbin-logs/p/10218099.html 二.安装Harbor主机环境及安装要求 主机环境: OS: Cent ...

随机推荐

  1. js判断数据类型的四种方法

    1.typeof typeof是一个操作符,其右侧跟一个一元表达式,并返回这个表达式的数据类型.返回的结果用该类型的字符串(全小写字母)形式表示,包括number,string,boolean,und ...

  2. blfs(systemv版本)学习笔记-编译安装ligtdm显示管理器

    我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! ligtdm带有显示管理器和登录器,参照我的笔记安装xorg和i3后安装lightdm,就可以组成一个简易的桌面环境了 下面是l ...

  3. python爬虫入门---第三篇:保存一张图片

    import requests import os url = 'http://imgsrc.baidu.com/forum/w%3D580%3B/sign=749ed018cecec3fd8b3ea ...

  4. 2017 SCNUCPC 解题报告

    校内赛题目.解题思路.参考代码一览 A. Blackstorm's Blackstore Problem Description Blackstorm is going to open a black ...

  5. 微信小程序地图报错——ret is not defined

    刚刚在使用微信的map做地图时候 发现如下报错: 后来找了一会发现错误为经纬度写反了导致经纬度超出了范围 正确取值范围: latitude   纬度  浮点数,范围 -90 ~ 90 longitud ...

  6. maven(六),外置maven运行环境配置

    外置maven eclipse内置的maven插件是固定版本,如果要用其他版本的maven,可以使用外置maven 下载地址: http://maven.apache.org/download.cgi ...

  7. js判断元素是否是disable状态

    js判断元素是否是disable状态 jquery判断元素状态用$(select).prop(属性值) == true js判断button是否可以点击: //判断button是否为不可点击状态 if ...

  8. 【PAT】B1001 害死人不偿命的(3n+1)猜想

    超级简单题 偶数砍掉一半, 奇数乘三加一砍掉一半 #include<stdio.h> int mian(){ int n,step=0; scanf("%d",n); ...

  9. Sql注入的分类:数字型+字符型

    Sql注入: 就是通过把SQL命令插入到Web表单提交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令.通过构造恶意的输入,使数据库执行恶意命令,造成数据泄露或者修改内容等,以 ...

  10. GUI_鼠标事件

    所有的组件都有鼠标和键盘监听器 import java.awt.Button; import java.awt.FlowLayout; import java.awt.Frame; import ja ...