#!/bin/bash
# 你的域名
Domain="abc.hahaha.xyz"
# 如果你的 cloudflare python 模块版本 小于 2.3.1. 大于2.3.1 使用更为安全的办法 https://certbot-dns-cloudflare.readthedocs.io/en/stable/
CloudFlareAccount="abc@gmail.com"
GlobalKey="0123456789abcdef0123456789abcdef01234"
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update && apt upgrade -y --fix-missing
sudo apt-get install certbot
# 对于 域名托管在 cloudflare 的域名而言, more detail refs: https://certbot.eff.org/lets-encrypt/ubuntubionic-other
sudo apt-get install python3-certbot-dns-cloudflare
cd ~/ && mkdir .certbot && cd .certbot
echo -e "dns_cloudflare_email = ${CloudFlareAccount}
dns_cloudflare_api_key = ${GlobalKey}" > cloudflare.ini
certbot certonly --dns-cloudflare --dns-cloudflare-credentials ~/.certbot/cloudflare.ini -d ${Domain}
更新域名:
sudo certbot renew --dry-run
详细连接:
https://certbot.eff.org/lets-encrypt/ubuntubionic-other