美文网首页
CA证书制作

CA证书制作

作者: 糖can果 | 来源:发表于2018-10-10 16:09 被阅读0次

1. Create your own CA certificate:

# 执行命令:

openssl req \
    -newkey rsa:4096 -nodes -sha256 -keyout ca.key \
    -x509 -days 365 -out ca.crt


# 执行过程
Generating a 4096 bit RSA private key
.................................................................................++
..................................++
writing new private key to 'ca.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]:cn
State or Province Name (full name) []:beijing
Locality Name (eg, city) [Default City]:beijing
Organization Name (eg, company) [Default Company Ltd]:boco
Organizational Unit Name (eg, section) []:oss
Common Name (eg, your name or your server's hostname) []:cloud2.xdpp.boco
Email Address []:wanglishuai@boco.com.cn

2. Generate a Certificate Signing Request:

如果你使用域名的方式访问你的仓库地址,那必须使用 reg.yourdomain.com 作为CN。如果使用ip地址访问,这个值可以为任意。

# 执行命令:
openssl req \
    -newkey rsa:4096 -nodes -sha256 -keyout cloud2.xdpp.boco.key \
    -out cloud2.xdpp.boco.csr
    
# 执行过程:
Generating a 4096 bit RSA private key
.....................................................................................................................................................++
...................................................++
writing new private key to 'cloud2.xdpp.boco.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]:cn
State or Province Name (full name) []:beijing
Locality Name (eg, city) [Default City]:beijing
Organization Name (eg, company) [Default Company Ltd]:boco
Organizational Unit Name (eg, section) []:oss
Common Name (eg, your name or your server's hostname) []:cloud2.xdpp.boco
Email Address []:wanglishuai@boco.com.cn

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

3. Generate the certificate of your registry host

如果使用域名进行访问,则执行以下命令:

# 执行命令
openssl x509 -req -days 3650 -in cloud2.xdpp.boco.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out cloud2.xdpp.boco.crt

#执行结果:

Signature ok
subject=/C=cn/ST=beijing/L=beijing/O=boco/OU=oss/CN=cloud2.xdpp.boco/emailAddress=wanglishuai@boco.com.cn
Getting CA Private Key


如果使用IP进行访问:

  echo subjectAltName = IP:192.168.1.101 > extfile.cnf

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

4. Configuration and Installation

  • 当生成了 yourdomain.com.crt and yourdomain.com.key 后,将其放置于harbor可以访问的路径下。
mkdir -p /data/cert
cp /opt/ca/cloud2.xdpp.boco.{crt,key} /data/cert
cd /data/cert
rename cloud2.xdpp.boco server *
  • Generate configuration files for Harbor:
# 切换至 harbor的工作目录
  ./prepare
  • 重启 harbor
# 切换至 harbor的工作目录

docker-compose down  
docker-compose up -d

5. 验证

相关文章

  • openvpn

    一、openvpn原理二、安装openvpn三、制作相关证书3.1 制作CA证书3.2 制作Server端证书3....

  • CA证书制作

    1. Create your own CA certificate: 2. Generate a Certific...

  • Nginx+SSL实现双向认证

    首先创建一个目录 CA与自签名 制作CA私钥 制作 CA 根证书(公钥) 注意: 1、Common Name 可以...

  • OpenSSL生成SSL证书

    1.制作CA证书 ca.key CA私钥步骤与使用OpenSSL自签发服务器https证书所述大同小异。opens...

  • CA证书制作实战

    需求:自建CA 颁发证书,使用自签名证书来构建安全网络,所谓自签名证书,就是自己扮演 CA 机构,自 己给自己的服...

  • openssl

    制作自签名证书(无用户名密码保护) 制作自签名证书(有用户名密码保护) 制作CA根证书并为第三方颁发证书 获取服务...

  • HTTPS网站 | SSL证书和ca证书有何区别?

    SSL证书和ca证书 你知道SSL证书和ca证书有何区别吗?其实SSL证书是ca证书中的一种,CA是数字证书管理机...

  • 局域网通过 itms-services(https) 协议安装

    1. 创建 CA 根证书 CA 是证书名字,自己改 2. 基于上边的 CA 证书,再创建证书 mycert 是证书...

  • kubernetes rbac只读账户

    创建只读rbac账户 readonly.json ca-config-readonly.json 下载证书制作工具...

  • 数字证书格式简述和OPENSSL证书制作

    各种数字证书的格式总结. 1.证书编码方式分类 2.证书包含内容分类 3.证书文件类型 4.openssl制作CA...

网友评论

      本文标题:CA证书制作

      本文链接:https://www.haomeiwen.com/subject/kbbpaftx.html