Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2007
    Location
    Greensboro, NC
    Posts
    44
    Points
    5,361
    Level
    31

    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.

    Prerequisites:
    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/copyssh.sh (Note: change the first 3 green values to match your server)

    Code:
    #!/bin/bash
    
    
    ## note: this should be run as the root user on the server
    
    ## user variables
    ## email address of main nodeworx user
    nodeuser="webmaster@yourhostingcompany.com"
    
    ## domain to copy letsencrypt key from
    domain="server.yourhostingcompany.com"
    
    ## unix username of the account
    usr="serveryo"
    
    ## 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
    cypher='HIGH:MEDIUM:!EXPORT:!SSLv2:!ADH:!aNULL:!eN ULL:!NULL:!LOW'
    
    ## 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 copyssh.sh
    8. Add a cron job to run the script: sudo nano /etc/crontab

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

  2. The Following User Says Thank You to marco114 For This Useful Post:


  3. #2
    Join Date
    Apr 2012
    Posts
    2,154
    Points
    23,652
    Level
    67
    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

    John

  4. #3
    Join Date
    Sep 2007
    Location
    Greensboro, NC
    Posts
    44
    Points
    5,361
    Level
    31
    this one is updated, with more directions than the old one I posted in March
    ---
    Marc Pope
    Falcon Internet
    http://www.falconinternet.net/

  5. #4
    Join Date
    Apr 2012
    Posts
    2,154
    Points
    23,652
    Level
    67
    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

    John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •