説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

root_letsencrypt_gencert.j2 1005B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. # Build list of domains and subdomains we need a certificate for
  3. d=""
  4. for domain in {{ virtual_domains | json_query('[*].name') | join(' ') }}; do
  5. # domain itself - foo.com
  6. # only add if the DNS entry for the domain does actually exist
  7. if (getent hosts $domain > /dev/null); then
  8. if [ -z "$d" ]; then
  9. d="$domain";
  10. else
  11. d="$d,$domain";
  12. fi
  13. fi
  14. # subdomains - www.foo.com mail.foo.com ...
  15. for sub in {{ subdomains | join(' ') }}; do
  16. # only add if the DNS entry for the subdomain does actually exist
  17. if (getent hosts $sub.$domain > /dev/null); then
  18. if [ -z "$d" ]; then
  19. d="$sub.$domain";
  20. else
  21. d="$d,$sub.$domain";
  22. fi
  23. fi
  24. done
  25. done
  26. # We are using the "standalone" letsencrypt plugin, which runs its own
  27. # webserver, so we need to temporarily free up the HTTP(S) ports by stopping
  28. # our own Apache.
  29. service apache2 stop
  30. certbot certonly --standalone -c /etc/letsencrypt/cli.conf --domains $d
  31. service apache2 start