3.1 证书的导入导出
证书的导出功能支持直接将证书内容输出到盒子,或者ftp服务器,tftp服务器,u盘。
导入功能也是类似。
3.1.1 命令行介绍
(1)PKI密钥对的创建与删除
pki key generate {rsa | dsa} {label key-name} [modulus size] [noconfirm]
pki key zeroize {default | label key-name} [noconfirm]
(2)PKI信任域模式下的配置
配置证书获取方式: enrollment {self | terminal | ca}
配置密钥对: keypair key-name
配置普通名称: subject commonName string
配置国家名称(可选):subject country string
配置所在位置(可选):subject localityName string
配置州或省名称(可选):subject stateOrProvinceName string
配置机构名称(可选):subject organization string
配置机构单元(可选):subject organizationUnit string
(3)证书内容的导入及安装
导入CA证书:pki authenticate trust-domain-name
生成证书服务请求:pki enroll trust-domain-name
安装本地证书:pki import trust-domain-name certificate
(4)导入导出证书
{ import | export } pki trust-domain-name pkcs12 password to ftp server ip-address [user user-name password password [file-name]| file-name]
(5)刷新自签名证书
pki refresh trust-domain-name
3.1.2 导入证书常用方法
方法1:pfx格式直接导入法
- 新建信任域test,默认方式即为terminal
SG-6000(config)# pki trust-domain test
SG-6000(config-trust-domain)# enrollment terminal
SG-6000(config-trust-domain)# end
(2)从ftp服务器导入pfx格式的证书
SG-6000# import pki test pkcs12-der hillstone from ftp server 10.180.160.3 /upload/jdu/cert/rsa/client.pfx
方法2:分别导入CA证书和本地证书
- 新建信任域test
SG-6000(config)# pki trust-domain test
SG-6000(config-trust-domain)# enrollment terminal
SG-6000(config-trust-domain)# keypair Default-Key
- 从CA服务器10.180.159.10直接下载本地证书
访问网址https://10.180.159.10/certsrv/(http和https方式均可)
直接点击下载CA证书,自定义名称为ca.cer
- 将ca.crt导入到DUT
SG-6000# import pki test cacert from ftp server 10.180.159.10 ca.cer
或者
使用命令pki authenticate test将ca.crt的内容直接粘贴,并回车后以.结束
- 在DUT上配置主题信息
SG-6000(config)# pki trust-domain test
SG-6000(config-trust-domain)# subject commonName test
SG-6000(config-trust-domain)# subject country cn
SG-6000(config-trust-domain)# subject localityName jiangsu
SG-6000(config-trust-domain)# subject organization suzhou
SG-6000(config-trust-domain)# subject organizationu
SG-6000(config-trust-domain)# subject organizationunit hillstone
SG-6000(config-trust-domain)# subject stateOrProvinceName jiangsu
SG-6000(config-trust-domain)# exit
(5)生成证书请求
SG-6000(config)# pki enroll test
Tip: Trust domain test certificate service request as follow
-----BEGIN CERTIFICATE REQUEST-----
MIIB+zCCAWQCAQAwZTENMAsGA1UEAwwEdGVzdDELMAkGA1UEBgwCY24xEDAOBgNVBAcMB2ppYW5nc3UxEDAOBgNVBAgMB2ppYW5nc3UxDzANBgNVBAoMBnN1emhvdTESMBAGA1UECwwJaGlsbHN0b25lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDFH7UO7uHbkuo8t7W09c12vT+VgLU6nwjmhOD6qABvb6sh+lfwQxjV/77m/ZIBtnjHnxk9ln/mT95Lsa9i9gux21cHAEMW7RmNautGdoX1vO43vGp+HUGdu0PTkAaU4Qd86npngb6+GMWGM8Cew8nKZrLKEYldbwhR8feB86iZiQIDAQABoFYwVAYJKoZIhvcN
AQkOMUcwRTAOBgNVHQ8BAf8EBAMCAaYwEQYJYIZIAYb4QgEBBAQDAgZAMBIGA1UdEQQLMAmCB2ludmFsaWQwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCxha5oGT2S01dLcqGv40NBZhYXYc9QkD35PkmwVF3Tdv6VO5kqynE9KORh0zUe8vfWI0odzlWU2foG+CXi9VrqCmHLs+mLeLroNORyW3H/ud31D4PjYu34B0GZrdsCnY5lfdzEowTcOI9eKcY3OULqsUbEjgOftCNw6bitv86otA==
-----END CERTIFICATE REQUEST-----
(6)从证书服务器申请证书
访问https://10.180.159.10/certsrv/并点击申请证书---高级证书申请,将step5得到的信息粘贴,证书模板选择Hillstone,点击提交,得到的证书保存名称为local.cer
(7)在DUT上导入本地证书
SG-6000# import pki test cert from ftp server 10.180.159.10 local.cert
或者:
使用命令pki import trust-domain-name certificate将local.cer的内容直接粘贴,并回车后以.结束
3.1.3 证书的存储
在StoneOS里,证书和密钥隐藏在Flash文件磁铁里,启动后加载至内存。
~ # cd flash/pki/vsys0/
/wr_point/etc/mnt/mtdblock2/pki/vsys0 # ls
key sslproxy trustdomain