Let’s Encrypt SSL Certificate:
Step 1
Log in to WF Account and take note of the username, and WEBXXX number from the dashboard. You will also want to copy the WF password to your clipboard for future use.
Step 2
Start an SSH session
On Mac you can use terminal. On PC you will have to first enable SSH by following these instructions – https://www.howtogeek.com/336775/how-to-enable-and-use-windows-10s-built-in-ssh-commands/ and then you can use command prompt
To SSH in you will type out:
ssh <webfactionusername>@<webXXX>.webfaction.com
It may prompt you to enter yes or no for fingerprint. Enter yes. Then you will need to paste in the password to log in.
Step 3
Install acme.sh by simply pasting and running the following command.
curl https://get.acme.sh | sh
Then run this command too.
[code]wget https://raw.githubusercontent.com/gregplaysguitar/acme-webfaction/master/acme_webfaction.py
cp ./acme_webfaction.py ~/bin/
chmod +x ~/bin/acme_webfaction.py[/code]
Step 4
Close the SSH session and run a new SSH session (this is necessary for Acme.sh to work)
Step 5
Test generate the certificates and generate real certificates
Run the following command replacing <webfactionusername> and <application-name> with the username of the WebFaction account and the name of the application via WebFaction Application tab (omitting the <>) and replace the domainname.com with the domain the certificate is for
[code]acme.sh –issue –test -w /home/<webfactionusername>/webapps/<application-name> -d domainname.com -d www.domainname.com[/code]
If successful you shouldn’t see any errors. Next you will want to run the same command this time replacing –test with –force
Step 6
SFTP to the server to grab the certificates files
Navigate to /home/<webfactionusername>/.acme.sh/domainname.com Here you will see the various certificate files. The files you will need to open with sublime text are: fullchain.cer, domainname.com.cer, and domainname.com.key
Step 7
Add SSL Certificate to WebFaction (Copy and paste)
Create a new certificate in WebFaction and copy and paste the 3 files to the corresponding fields. (the full-chain is the intermediate)
Step 8
Add new “Website” within WebFaction and set it up as HTTPS and have it load the certificate we just created.
Step 9
Now the magic script that auto renews the certificates
Enter the following command one line at a time (after you update the following fields: domainname.com, WebXXX, <webfactionusername>, <webfactionpassword>, and <certificatename> (this being what you created in step 7) remember to omit the <>)
[code]acme.sh –install-cert -d domainname.com -d www.domainname.com \
–reloadcmd “WF_SERVER=WebXXX WF_USER= WF_PASSWORD= WF_CERT_NAME=”[/code]
You probably won’t see any message of success or whatnot
Step 10
This script hasn’t been fully vetted to work 100% of the time so you will need to create a task in Liquid Planner and have it delayed to about a week before the certificate is set to expire for you to go check to make sure the certificate renewed. If it renewed, then delay the task until about a week before the next time it is set to expire. If it didn’t renew then something went wrong in the setup process.
