SHARE
TWEET

get-multiple-domain-SSL-certificate-LetsEncrypt.sh

a guest Dec 28th, 2016 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.    
  3. # specify the location of Let's Encrypt tool
  4. # and its parameters
  5. certbot='/usr/bin/certbot  --agree-tos --email my@email.com --apache --redirect --expand --renew-by-default -n '
  6.    
  7. # put the list of the domains in this file
  8. vhost=( `cat "domain-list.txt" `)
  9.    
  10. # loop variables
  11. ssl_exec="${certbot}"
  12. n=1
  13.    
  14. #################### START ##########################
  15.    
  16. for t in "${vhost[@]}"
  17. do
  18.    
  19.     ssl_exec="${ssl_exec} -d $t "
  20.     let "n++"
  21.    
  22.     # every 100th domain,
  23.     # create a SSL certificate for these 100 domains
  24.     # (SAN = Subject Alternative Name certificate)
  25.     if (( n == 100 )); then
  26.    
  27.         $ssl_exec
  28.         # echo $ssl_exec
  29.    
  30.         # reset the loop variables
  31.         ssl_exec="${certbot}"
  32.         n=1
  33.     fi
  34.    
  35. done
  36.    
  37. # create SSl certificate for the rest of the domains
  38. $ssl_exec
  39. # echo $ssl_exec
RAW Paste Data
Top