之前说过,利用Certbot申请Let’s Encrypt SSL证书,当时还是单个域名,现在泛域名已经可以申请了,生命不止,折腾不息,折腾了下,把let’s encrypt的ECC泛域名证书申请下来了。
certbot的下载安装参考这个:利用Certbot申请Let’s Encrypt SSL证书。
和之前申请当个域名不同的是,我们现在申请ECC证书之前,需要自己先行生成ecc的csr文件,下面是生成步骤。
先是生成key:
[root@elsenow-virmach src]# openssl ecparam -genkey -name secp384r1 | openssl ec -out elsenow-ecc.key
read EC key
writing EC key
然后用生成的key生成csr:
[root@elsenow-virmach src]# openssl req -new -sha256 -key elsenow-ecc.key -nodes -out elsenow-ecc.csr -outform pem
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) []:Guangdong
Locality Name (eg, city) [Default City]:Shenzhen
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:*.xxx.win
Email Address []:admin@xxx.win
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
[root@elsenow-virmach src]# ls
certbot-auto elsenow-ecc.csr elsenow-ecc.key
利用certbot签发let’s encrypt泛域名ecc证书
接下来就是利用生成好的csr文件申请let’s encrypt的ecc证书了:
[root@elsenow-virmach src]# ./certbot-auto certonly --csr elsenow-ecc.csr --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): admin@xxx.win
-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: A
-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: A
-------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: N
Performing the following challenges:
dns-01 challenge for xxx.win
-------------------------------------------------------------------------------
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.
Are you OK with your IP being logged?
-------------------------------------------------------------------------------
(Y)es/(N)o: Y
-------------------------------------------------------------------------------
Please deploy a DNS TXT record under the name
_acme-challenge.xxx.win with the following value:
F82ZfL2Q07AiE8rE1CFoSAZUSELcowTWUhunesGqzwM ###这一步需要到DNS服务商出添加一条TXT记录
Before continuing, verify the record is deployed.
-------------------------------------------------------------------------------
Press Enter to Continue
Waiting for verification...
Cleaning up challenges
Server issued certificate; certificate written to /usr/local/src/0000_cert.pem
Cert chain written to <fdopen>
Cert chain written to <fdopen>
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/usr/local/src/0001_chain.pem
Your cert will expire on 2018-06-17. To obtain a new or tweaked
version of this certificate in the future, simply run certbot-auto
again. To non-interactively renew *all* of your certificates, run
"certbot-auto renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
[root@elsenow-virmach src]# ls
0000_cert.pem 0000_chain.pem 0001_chain.pem certbot-auto elsenow-ecc.csr elsenow-ecc.key
update:2018-03-29
利用certbot签发单域名ECC证书
申请letsencrypt单域名ECC证书和泛域名其实差不多,只需要在生成CSR那一步,FQDN输入单域名就行了,然后用certbot指定生成好的CSR文件,就能签发了:
./certbot certonly --csr=elsenow-ecc.csr
下面是搭配Nginx之后在浏览器中查看结果: