Easy Tutorial
❮ Programmer Joke 15 Android Tutorial Xfermode Porterduff5 ❯

Generating Wildcard HTTPS Certificates with Let’s Encrypt

Category Programming Technology

1. Obtain acme.sh

curl https://get.acme.sh | sh

Installation successful as shown below:

...
[Tue Sep 24 18:23:55 CST 2019] Good, bash is found, so change the shebang to use bash as preferred.
[Tue Sep 24 18:23:55 CST 2019] OK
[Tue Sep 24 18:23:55 CST 2019] Install success!

2. Obtain Certificates

acme.sh excels in automatically configuring DNS, eliminating the need to manually manage DNS records in the domain control panel.

Here, we use a domain registered with Alibaba Cloud as an example. For domains registered elsewhere, please refer to the modifications here: Portal.

First, obtain App_Key and App_Secret from the Alibaba Cloud console Portal, then execute the following script:

# Replace with the keys obtained from the Alibaba Cloud console
export Ali_Key="123"
export Ali_Secret="abbcddddd"
# Replace with your own domain
acme.sh --issue --dns dns_ali -d tutorialpro.org -d *.tutorialpro.org

Successful execution output:

...
[Tue Sep 24 18:28:45 CST 2019] Download cert, Le_LinkCert: https://acme-v02.api.letsencrypt.org/acme/cert/03324bb19fec1de831b1083a9810ccdd2109
[Tue Sep 24 18:28:47 CST 2019] Cert success.
...

The output includes the directory where the certificates are stored.

The certificates generated in my case are located in this directory: /www/server/panel/vhost/cert/tutorialpro.org/tutorialpro.org.cer.

After the first successful attempt, acme.sh will record the App_Key and App_Secret and create a scheduled task, which can be seen via crontab -e. If not needed, you can remove the scheduled task and clean up the ~/.acme.sh folder.

Note: Some domestic providers may require the use of PEM format content. Simply copy the contents of the following two certificates (cer === PEM):

Certificate content (PEM format):

$ cat domain.cer

Certificate private key (PEM format):

$ cat domain.key

** Click to Share Notes

Cancel

-

-

-

❮ Programmer Joke 15 Android Tutorial Xfermode Porterduff5 ❯