Quick script for obtaining lets encrypt certificate through DNS authentication

Scripts based on letsencrypt.sh By calling the dns service provider interface to update TXT records for authentication, we can quickly obtain lets encrypt certificates. No root permission is required, no website directory and DNS resolution need to be specified

cloudxns

download

 wget  https://github.com/xdtianyu/scripts/raw/master/le-dns/le-cloudxns.sh wget  https://github.com/xdtianyu/scripts/raw/master/le-dns/cloudxns.conf chmod +x le-cloudxns.sh

to configure

cloudxns.conf Document content

 API_KEY="YOUR_API_KEY" SECRET_KEY="YOUR_SECRET_KEY" DOMAIN="example.com" CERT_DOMAINS="example.com www.example.com im.example.com" #ECC=TRUE

Modify API_KEY and SECRET_KEY For your cloudxns api key , Modify DOMAIN For your root domain name, modify CERT_DOMAINS For the list of domain names you want to sign, you need to ECC Please cancel the certificate #ECC=TRUE Comments for.

function

./le-cloudxns.sh cloudxns.conf

The last generated file is in the certs directory of the current directory

Cron scheduled task

If the certificate expires no less than 30 days, letsencrypt.sh The script will automatically ignore the update, so it needs at least 29 days to run the update.

The certificate is automatically renewed every 20 days (on the 2nd and 22nd of each month) le-cloudxns.sh At the end of the script, add service nginx reload and other reload services.

0 0 2/20 * * /etc/nginx/le-cloudxns.sh /etc/nginx/le-cloudxns.conf >> /var/log/le-cloudxns.log 2>&1

be careful ubuntu 16.04 Cannot define day of month With start days step values , you can replace the 2/20 by 2,22

For more detailed crontab parameters, please refer to crontab.guru Customize

dnspod

download

 wget  https://github.com/xdtianyu/scripts/raw/master/le-dns/le-dnspod.sh wget  https://github.com/xdtianyu/scripts/raw/master/le-dns/dnspod.conf chmod +x le-dnspod.sh

to configure

dnspod.conf Document content

 TOKEN="YOUR_TOKEN_ID,YOUR_API_TOKEN" RECORD_LINE="Default" DOMAIN="example.com" CERT_DOMAINS="example.com www.example.com im.example.com" #ECC=TRUE

Modify the TOKEN For your dnspod api token Note that the format is 123456,556cxxxx
modify DOMAIN For your root domain name, modify CERT_DOMAINS For the list of domain names you want to sign, you need to ECC Please cancel the certificate #ECC=TRUE Comments for.

function

./le-dnspod.sh dnspod.conf

The last generated file is in the certs directory of the current directory

Cron scheduled task

If the certificate expires no less than 30 days, letsencrypt.sh The script will automatically ignore the update, so it needs at least 29 days to run the update.

The certificate is automatically renewed every 20 days (on the 5th and 25th of each month) le-dnspod.sh At the end of the script, add service nginx reload and other reload services.

0 0 5/20 * * /etc/nginx/le-dnspod.sh /etc/nginx/le-dnspod.conf >> /var/log/le-dnspod.log 2>&1

be careful ubuntu 16.04 Cannot define day of month With start days step values , you can replace the 5/20 by 5,25

For more detailed crontab parameters, please refer to crontab.guru Customize

Last modification: November 17, 2017
If you think my article is useful to you, please feel free to appreciate it