RepositoryPythonCNChina
JI

jinhucheung/letscertbot

Let's Certbot is a tool builds automated scripts base on Certbot for obtaining, renewing, deploying SSL certificates.

150stars
32forks
0issues
2views

Let's Certbot

中文文档 Chinese document

Let's Certbot is a tool builds automated scripts base on Certbot for obtaining, renewing, deploying SSL certificates.

In order to verify your domains, Let's Certbot uses dns challenge on Certbot. Compared to http challenge, it means you can obtain a wildcard certificate and don't need to touch webserver.

On dns challenge, you need to set a TXT DNS record with specific contents on domain. Let's Certbot will help you do it via domain name registrar DNS API.

Supports domain name registrar at persent:

Example

example

Installation

Let's Certbot as a Certbot tool supports docker and non-docker environments.

Downloading Repository

Clone this repository to get Let's Certbot:

$ git clone git@github.com:jinhucheung/letscertbot.git

Then copy configurations:

$ cd letscertbot
$ cp config.json.example config.json

Installing with Docker

Run Let's Certbot with Docker:

$ sudo docker run --rm --name letscertbot -v "$your_letscertbot_home/config.json:/app/config.json" -v "$your_letscertbot_home/tlds.txt:/app/tlds.txt" -v "/etc/letsencrypt:/etc/letsencrypt" -v "/var/lib/letsencrypt:/var/lib/letsencrypt" jimcheung/letscertbot

You can run Let's Certbot with Compose if Docker Compose is installed:

$ sudo docker-compose run --rm app

Installing without Docker

Let's Certbot requires Python 2.7 or 3.4+ running on a UNIX-like operation system.

First, you need to confirm if python is installed:

$ python --version

If everything is ok, get Certbot on Official Document for your system.

After installing Certbot, run Certbot with root:

$ sudo certbot --version

Usage

Configuration

Before running Let's Certbot, you have the following configuration to change:

NameRequiredDescriptionDefault
base.emailtrueEmail address for important renewal notifications
dnstruedns settings
dns.wait_timefalsedns challenge wait time (seconds)20
dns.aliyunfalseAccess Key Id and Access Key Secret of Aliyun account
dns.qcloudfalseSecret Id and Secret Key of Tencent Cloud account
dns.huaweicloudfalseAccess Key Id and Secret Access Key of Huawei Cloud account
dns.godaddyfalseAPI Key and API Secret of GoDaddy account
dns.cloudflarefalseAPI Key or API Token of Cloudflare account
log.enablefalseWhether to enable log trackerfalse
log.logfilefalseThe path of log file./log/application.log
deploy.serversfalseThe deployment servers
deploy.server.enablefalseWhether to run deployment script for serverfalse
deploy.server.hostfalseThe host of deployment server, set "localhost" for local server, required on deploy.
deploy.server.portfalseThe port of remote server SSH daemon22
deploy.server.userfalseThe user of remote server uses SSH login, run commandroot
deploy.server.passwordfalseThe password of remote user
deploy.server.deploy_tofalseThe stored path of certificate in server/etc/letsencrypt/live
deploy.server.restart_nginxfalseWhether to restart nginx in serverfalse
deploy.server.after_hookfalseThe command that server runs after successful deployment

In addition, tlds.txt contains some top level domains(TLD) and second level domains(SLD) for separating subdomain and main domain. If the TLD or SLD of your domain is not existed in tlds.txt, you need to append it in list.

DNS API

Before obtaining certificate, you can run manual script (manual.py) to test DNS API with with your access key:

# Running with docker
$ sudo docker-compose run --rm app manual --test --domain your.example.com --dns aliyun

# Running without docker
$ sudo python ./bin/manual.py --test --domain your.example.com --dns aliyun

The script will place _acme-challenge TXT record under your domain via specified DNS API.

Obtainment

Run the obtainment script (obtain.py) with root for obtaining certificate:

# Running with docker
$ sudo docker-compose run --rm app obtain -d your.example.com *.your.example.com

# Running without docker
$ sudo python ./bin/obtain.py -d your.example.com *.your.example.com

Then you will get a wildcard certificate names your.example.com in /etc/letsencrypt/live/

You can specify certificate name with --cert argument:

# Running with docker
$ sudo docker-compose run --rm app obtain -d x.example.com y.example.com --cert xny.example.com

# Running without docker
$ sudo python ./bin/obtain.py -d x.example.com y.example.com --cert xny.example.com

If your domain name registrar doesn't support api access, or if you're concerned about security problems from giving the access tokento your main domain, then you can use DNS alias argument:

$ sudo docker-compose run --rm app obtain -d x.main_domain.com y.main_domain.com --dns qcloud --challenge-alias alias_domain.com

# Running without docker
$ sudo python ./bin/obtain.py -d x.main_domain.com y.main_domain.com --dns qcloud --challenge-alias alias_domain.com

In the above command, Let's Certbot transfers x.main_domain.com, y.main_domain.com challenge to alias_domain.com, and sets the txt record of alias_domain.com via qcloud API. So you need to add CNAME record for challenged domain in advance:

_acme-challenge.x.main_domain.com => _acme-challenge.alias_domain.com
_acme-challenge.y.main_domain.com => _acme-challenge.alias_domain.com

Renewal

Renew certificates with the renewal script (renewal.py):

# Running with docker
$ sudo docker-compose run --rm app renewal

# Running without docker
$ sudo python ./bin/renewal.py

Then Certbot will try renew all certificates which will be expired soon.

You can add renewal script as schedule task to crontab:

# Running with docker
0 0 */7 * * sudo docker-compose -f $your_letscertbot_home/docker-compose.yml run --rm app renewal > /var/log/letscertbot-renewal.log 2>&1

# Running without docker
0 0 */7 * * sudo $your_letscertbot_home/bin/renewal.py > /var/log/letscertbot-renewal.log 2>&1

The task will run renewal script every 7 days.

If you need to force renew specified certificates, provide --force and --certs arguments:

# Running with docker
$ sudo docker-compose run --rm app renewal --certs xny.example.com --force

# Running without docker
$ sudo python ./bin/renewal.py --certs xny.example.com --force

Deployment

If you set deploy.server.enable to true, Certbot will run the deployment script (deploy.py) on deploy hook. The script receives renewed certificate and push it to configured servers.

Let's Certbot deploys certificate to remote server via SSH, it means that local server runs Certbot must be able to connect remote server. In order to connect, you need to add the public key of local server to remote server or provide deploy.server.password for sshpass.

In order to add certificate to deploy.server.deploy_to or restart nginx, Let's Certbot requires deploy.server.user has permissions.

You can get deployment script by running the following command:

# Running with docker
$ sudo docker-compose run --rm app deploy --check

# Running without docker
$ sudo python ./bin/deploy.py --check

And push certificate to server:

# Running with docker
$ sudo docker-compose run --rm app deploy --push --cert $certificate_name --server $server_host

# Running without docker
$ sudo python ./bin/deploy.py --push --cert $certificate_name --server $server_host

Note: If deploy.server enables SELinux in enforcing mode, you need to confirm that nginx has access to the SElinux security context of deploy.server.deploy_to.

Note: If you run Let's Certbot via container and restart nginx in local server, you should set local server as remote.

Thanks

Contributing

Bug report or pull request are welcome.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)

Please write unit test with your code if necessary.

License

The repository is available as open source under the terms of the MIT License.

Similar Projects

Discover other similar projects and AI models.

RepositoryGo
certimate-go/certimate

An open-source and free self-hosted SSL certificates ACME tool, automates the full-cycle of issuance, deployment, renewal, and monitoring visually. 完全开源免费的自托管 SSL 证书 ACME 工具,申请、部署、续期、监控全流程自动化可视化,支持各大主流云厂商。

9.5k
Dec 1, 2026
RepositoryC#
webprofusion/certify

Professional ACME Client for Windows (and now cross-platform via Certify Management Hub). Certificate Management UI, powered by Let's Encrypt and compatible with all ACME v2 CAs. Used by over 150,000 organisations. Download from certifytheweb.com

1.7k
Nov 30, 2026
RepositoryPython
certbot/certbot

Certbot is EFF's tool to obtain certs from Let's Encrypt and (optionally) auto-enable HTTPS on your server. It can also act as a client for any other CA that uses the ACME protocol.

33.4k
Nov 30, 2026
RepositoryPython
ywdblog/certbot-letencrypt-wildcardcertificates-alydns-au

certbot'renewing letencrypt certificate plugin - automatic verification aliyun/tencentyun/godaddy dns

1.2k
Oct 30, 2023
RepositoryTypeScript
allinssl/allinssl

AllinSSL 是一个集证书申请、管理、部署和监控于一体的SSL证书全生命周期管理工具。AllinSSL is an all-in-one SSL certificate lifecycle management tool that integrates certificate application, management, deployment, and monitoring.

3.6k
Nov 13, 2026
RepositoryShell
JonasAlfredsson/docker-nginx-certbot

Automatically create and renew website certificates for free using the Let's Encrypt certificate authority.

1.2k
Nov 30, 2026
RepositoryPython
fabriziosalmi/certmate

Self-hosted control plane for TLS certificates, ready for 47-day certificates: issue, renew, discover, inventory and deploy them, and serve ACME for internal names and IPv4 addresses

1.5k
Nov 25, 2026
RepositoryPython
adferrand/dnsrobocert

Orchestrate Certbot and Lexicon together to provide Let's Encrypt TLS certificates validated by DNS challenges

565
Nov 29, 2026
RepositoryPython
EEEugene/StepNumberChangeSNC

自动修改小米运动步数,同步微信/支付宝运动,支持腾讯云/阿里云函数定时运行

272
Nov 5, 2026