暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

home_deploy_ssl-self-signed.sh.j2 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. echo generating CA key
  3. openssl genrsa -out /etc/letsencrypt/rootCA.key 4096
  4. echo generating CA certificate
  5. openssl req -x509 -new -nodes -sha256 -days 7300 \
  6. -key /etc/letsencrypt/rootCA.key \
  7. -subj "/C=DE/ST=BW/O={{ domain }}/CN={{ server_fqdn }}" \
  8. -out /etc/letsencrypt/rootCA.crt
  9. echo generating server key
  10. openssl genrsa -out /etc/letsencrypt/{{ domain }}.key 2048
  11. echo generating signing request
  12. openssl req -new -sha256 \
  13. -key /etc/letsencrypt/{{ domain }}.key \
  14. -subj "/C=DE/ST=BW/O={{ domain }}/CN={{ server_fqdn }}" \
  15. -reqexts SAN \
  16. -extensions SAN \
  17. -config <(cat /etc/ssl/openssl.cnf \
  18. <(printf "\n[SAN]\nsubjectAltName=DNS:{{ server_fqdn }}")) \
  19. -out /etc/letsencrypt/{{ domain }}.csr
  20. echo generating server certificate
  21. openssl x509 -req -CAcreateserial -days 7300 -sha256 \
  22. -extfile <(printf "subjectAltName=DNS:{{ server_fqdn }}") \
  23. -in /etc/letsencrypt/{{ domain }}.csr \
  24. -CA /etc/letsencrypt/rootCA.crt \
  25. -CAkey /etc/letsencrypt/rootCA.key \
  26. -out /etc/letsencrypt/{{ domain }}.crt
  27. echo copy to proper locations
  28. cp /etc/letsencrypt/{{ domain }}.key /etc/letsencrypt/live/{{ domain }}/privkey.pem
  29. cp /etc/letsencrypt/rootCA.crt /etc/letsencrypt/live/{{ domain }}/chain.pem
  30. cp /etc/letsencrypt/{{ domain }}.crt /etc/letsencrypt/live/{{ domain }}/cert.pem
  31. echo generate full chain certificate
  32. cat /etc/letsencrypt/live/{{ domain }}/cert.pem > /etc/letsencrypt/live/{{ domain }}/fullchain.pem
  33. cat /etc/letsencrypt/live/{{ domain }}/chain.pem >> /etc/letsencrypt/live/{{ domain }}/fullchain.pem