Use acme.sh to generate/renew Let's Encrypt SSL cert

The Knowledgebase provides a database of answers to many Technical questions.
Post Reply
FTP
Site Admin
Posts: 2099
Joined: Tue Sep 29, 2009 6:09 am

Use acme.sh to generate/renew Let's Encrypt SSL cert

Post by FTP »

Acme.sh is a simple and easy-to-use ACME protocol (Automatic Certificate Management Environment) client, you can use it to generate and renew Let's Encrypt/ZeroSSL's certificates.

First you may install acme.sh via a simple command:

Code: Select all

curl -k https://get.acme.sh | sh
Then generate signed SSL certs by executing the following commands:

Code: Select all

cd ~/.acme.sh
./acme.sh --set-default-ca --server letsencrypt
./acme.sh --issue -d demo.wftpserver.com -w /opt/wftpserver/webclient
Here, "demo.wftpserver.com" is your real domain name, and "/opt/wftpserver/webclient" is WingFTP's web client folder, you may change it into your own path (where WingFTP installed).

All the signed certs will be placed in "~/.acme.sh/demo.wftpserver.com_ecc/".
In WingFTP's administration, you may add an SSL cert configuration under "Server > Settings > SSL Certificate Manager", choose "fullchain.cer" as the certificate, and choose "demo.wftpserver.com.key" as the private key:
Image

You also need to select this new cert under "Domain > Settings > General Settings > Miscellaneous > SSL Certificate":
Image

WingFTP will cache the SSL context, so you need to reload the SSL context after renewing the cert. You can add a daily task under "Server > Task Scheduler" and input the below lua script:

Code: Select all

c_SetAdminOptionStr(ADMIN_OPTION_SSL_NAME_STR, c_GetAdminOptionStr(ADMIN_OPTION_SSL_NAME_STR))
for _,domain in pairs(c_GetDomainList()) do
	c_SetOptionInt(domain, DOPTION_TLS_SESSION_TIMEOUT, 3600+(c_GetRandom()%100))
end
Image




For Windows Systems, you need a Cygwin environment. If you do not have Cygwin, maybe you can install Git and run all the above commands in Git Bash: https://git-scm.com/
Linux system has a daily cron job to check and renew the certs if needed, but in Windows Git Bash, cron is not included by default, so you need to schedule a task to renew the SSL cert every 30 days, just execute the following command to schedule a task:

Code: Select all

schtasks /create /tn "Renew SSL cert" /tr "'C:/Program Files/Git/bin/sh.exe' --login -i -c 'C:/Users/xxx/.acme.sh/acme.sh --renew -d demo.wftpserver.com --force --ecc'" /sc daily /mo 30 /it
Please change "xxx" into your own username, make sure "sh.exe" and "acme.sh" already installed.
Post Reply