Code Monkey home page Code Monkey logo

certbot-namecheap-hook's Introduction

Certbot Namecheap Hook

If Namecheap is your DNS registrar, the scripts can be used to automatically obtain/renew wildcard certificates using Certbot.

Introduction

Every certificate applied from Certbot expires in three months. It's frustrating that you have to renew certs every three months. Though Certbot supports auto renewing them by setting up a Cron task. However, it doesn't support auto renewing wildcard certificates due to the limitation ofdns-01 challenge. This repository uses Namecheap API updating your DNS record to fight back the Certbot challenge.

Get Started

Pre-requirements

  • Ensure you have your Namecheap account API key at hand. Refer to get API key.

  • Python 3 is required to get the script working

Run Scripts

The main.sh is a sample script showing how to use Certbot to obtain/renew a wildcard cert. Please refer to it and create your own customized scripts.

When you trial-and-error your customized script, you are highly recommended to hit the staging environment instead of production environment. Let's Encrypt has strict rate limit, which can be easily run out (then you have to wait another week to get your production certs).

Required Environment Variables

There are several environment variables required to get the namecheap.py working.

Env Variable Comment Example
API_USER Normally, it's the same with your username username
API_KEY Namecheap account API key your-api-key
USERNAME Namecheap account username username
CLIENT_IP The public IP which you use to hit the API 10.42.193.39
SLD Second level domain haomingyin
TLD Top level domain com

To use the sample main.sh script, you have set up the following environment variables as well.

Env Variable Comment Example
APPLY_DOMAIN The domain you are applying cert for. Wildcard is allowed *.haomingyin.com or Certbot.haomingyin.com
EMAIL The email to register a let's encrypt account [email protected]
ACME_MODE Staging mode or production mode staging or prod

How Do I Use It

I have my Jenkins server periodically run the script. The reason I'm not using Cron is that I have several severs and can't be bothered to set it up on each server. Also, by using Jenkins Pipeline, the latest scripts will always be sync and updated among all my servers. You welcome to check out my Jenkins Pipeline file.

Reference

certbot-namecheap-hook's People

Contributors

haomingyin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.