No announcement yet.

Updated Auto Copy Script for Let's Encrypt to Server's SSL Certs

  • Filter
  • Time
  • Show
Clear All
new posts

  • Updated Auto Copy Script for Let's Encrypt to Server's SSL Certs

    Wouldn't you like to have all your Interworx SSL protected? Mail, Web, FTP, etc? This makes it easy, free and auto-updates.

    I've updated my Let's Encrypt Server Copy Script.

    What this does:

    It copies the auto-renewed Let's Encrypt SSL Certificate in a Siteworx Account to the Server's SSL Certificates. You could add a cronjob to run this everynight so that it always has the latest SSL Certificate.

    1. Tested on Centos 6 or 7. (not tested on other platforms)
    2. Enable the Let's Encrypt Plugin in Interworx under ( Nodeworx > Plugins )
    3. Create a SiteWorx Account that is the same as the primary hostname of the server
    4. Make sure you have an A record that points to the server as well
    5. In Siteworx, generate a Let's Encrypt certificate.
    6. Copy this script to your server /root/ (Note: change the first 3 green values to match your server)

    ## note: this should be run as the root user on the server
    ## user variables
    ## email address of main nodeworx user
    ## domain to copy letsencrypt key from
    ## unix username of the account
    ## auto set locations for each certificate and key
    key=$(cat "/home/$usr/var/$domain/ssl/$domain.priv.key")
    sslcrt=$(cat "/home/$usr/var/$domain/ssl/$domain.crt")
    chain=$(cat "/home/$usr/var/$domain/ssl/$domain.chain.crt")
    ## set the cypher level
    ## perform the task (the return in the command is intentional)
    nodeworx -u "$nodeuser" -o pretty -n -v -c Ssl --ssl_ciphersuite $cypher --key "$key" --crt "$sslcrt
    $chain" --restart_now 1 --services all --action updateall
    7. Make it executable: chmod +x
    8. Add a cron job to run the script: sudo nano /etc/crontab

    Add a line:
    35 2 * * * root /root/
    Close and Save and you are done.
    Run it manually the first time to see if it works:
     sh /root/
    Last edited by marco114; 09-26-2017, 09:12 AM.
    Marc Pope
    Falcon Internet

  • #2
    Hi marco114

    Many thanks for sharing your script.

    This is the third script for nodeworx ssl copy from siteworx but kudos to you

    I hope others will share more of their scripts, not only for ssl

    Many thanks



    • #3
      this one is updated, with more directions than the old one I posted in March
      Marc Pope
      Falcon Internet


      • #4
        Hi marco114

        Many thanks, and apologies I was only giving credit to those who wrote previous scripts without realising you were one of them.

        I meant no offence

        Many thanks



        • #5
          This script doesn't seem to have any provisions for detecting whether or not the SSL certificates are actually brand new and thus, replace the SSL certificates when it's time to do that... aside from a cron job?

          If so, that should probably be integrated so we're not needlessly replacing the SSL certificates based on cron times.
          ★ Ramon Reyes @ EidolonHost
          ★ Shared, Reseller, VPS and Dedicated Servers.
          ★ Need more stuff? Ask us about custom configurations!
          ★ Authorized Blesta and InterWorx License Reseller! See Web Host Licenses