Cause: Because configuring domestic CDNs usually requires manually uploading certificates, but the domain name certificates I applied for are usually valid for three months, so I wanted to write a script to automatically update the certificates.
Environment:
1panel (a domestic panel, automatically applies for certificates, and has other powerful functions, very convenient)
Taking the Doyun cloud I use as an example, you can find the corresponding SDK for other manufacturers.
The code is as follows:
The basic implementation idea is to first delete the existing certificate, then add the read certificate, and then upload and activate the uploaded certificate, so as to achieve automatic configuration of CDN certificates. You can use the automatic timing execution script function of 1panel to execute it every month to update the certificate. It really implements a strange little trick✊✊✊.