Two months ago, because Tencent Cloud CDN suspends service immediately upon arrears, I switched to DogeCloud CDN.

But!
Currently, the free SSL certificates from BT/1Panel are only valid for 90 days. Although they can be renewed automatically, after renewal you still have to manually update the CDN certificate frequently, which is very troublesome.
Fortunately, DogeCloud provides a corresponding API, allowing us to automatically sync SSL certificates to DogeCloud CDN through scripts.

Features
- 🔑 Dynamically generate DogeCloud API access tokens
- 📤 One-click certificate upload and management
- 🌐 Intelligent multi-domain certificate binding
- 🗑️ Old certificate cleanup (optional)
- ⏰ Seamless integration with Let's Encrypt automatic renewal
- ✅ Dual-platform support (BT/1Panel)
Quick Start
- Obtain DogeCloud API key:
- Log in to the DogeCloud console
- Go to "User Center" → "Key Management"
- Create a new key pair
- Confirm certificate path:
- BT Panel:
/www/server/panel/vhost/ssl/domain-directory/ - 1Panel can skip this step
- BT Panel:
Configuration Guide
Edit the following parameters in the script:
Deployment Guide
1Panel
- Enter the certificate management interface
Create/edit certificate:
- Enable "Auto-renew"
- Enable "Push certificate to local directory"
- Select directory
- Enable "Execute script after application"
- Paste the content of this script
- Modify the certificate path to:
CodeBlock Loading...

1Panel certificate settings
BT Panel
- Create a scheduled task:
- Task type: Shell script
- Task name: arbitrary
- Execution cycle: execute once at 01:30 on the 1st of every month
- Execution user: root
- Script content: paste the content of this script

BT scheduled task
- Cooperate with the automatic renewal of Let’s Encrypt certificate scheduled task
/www/server/panel/pyenv/bin/python /www/server/panel/class/acme_v2.py –renew=1to theoretically achieve hands-off certificate management for DogeCloud CDN.
After saving, run the task once. If the following information is displayed, the certificate sync is complete:
Code Ideas
Obtain Key & Generate AccessToken
DogeCloud's API has an authentication mechanism. Before use, you need to obtain AccessKey and SecretKey from the console's Key Management, and then generate AccessToken based on AccessKey and SecretKey.
The generation process of AccessToken is to concatenate the request URL and request content, then encrypt it with SecretKey using HMAC-SHA1, and finally connect the encrypted value with AccessKey using a colon. For the specific generation algorithm, please refer to the documentation Authentication Mechanism .
After generating the AccessToken, you only need to add Authorization: TOKEN <AccessToken> to the request header to pass authentication.
Find BT Panel Domain Certificate & Upload Certificate
Under the /www/server/panel/vhost/ssl/ directory, you can find all domain-named folders for BT Panel, and inside each folder are the full certificate chain fullchain.pem and private key privkey.pem corresponding to that domain.
It is recommended to use the same wildcard certificate for the domain and all its subdomains, so that the domain and all its subdomains can be synced at once.
Taking the domain vinking.top as an example, the paths of the full certificate chain file and private key file are as follows:
After obtaining the domain certificate, you need to submit the certificate content to https://api.dogecloud.com/cdn/cert/upload.json via POST. After a successful upload, you need to obtain the certificate ID so that the just-uploaded certificate can be bound to the domain.
Refer to the documentation Upload Certificate and Bind Certificate.