Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

generate-ssl-cert.sh 628B

123456789101112131415161718192021
  1. #! /usr/bin/env bash
  2. if [ $# -eq 0 ]
  3. then
  4. echo "Usage: generate-ssl-cert hostname [options]" >&2
  5. exit 64
  6. fi
  7. host="$1"
  8. letsencrypt --agree-tos --renew-by-default --standalone --standalone-supported-challenges http-01 --http-01-port 9999 --server https://acme-v01.api.letsencrypt.org/directory certonly -d $*
  9. if [ $? -ne 0 ]
  10. then
  11. echo "Failed to generate certificate" >&2
  12. exit 1
  13. fi
  14. ln -sf /etc/letsencrypt/live/${host}/cert.pem /etc/ssl/private/${host}.crt
  15. ln -sf /etc/letsencrypt/live/${host}/privkey.pem /etc/ssl/private/${host}.key
  16. ln -sf /etc/letsencrypt/live/${host}/chain.pem /etc/ssl/private/${host}-chain.crt