Giter VIP home page Giter VIP logo

certbothook's Introduction

certbothook

A python library to simplify the common task of running hooks when certbot renews your Let's Encrypt certificates.

An example

#!/usr/bin/env python3
from certbothook import CertbotHook

hooks = [
  CertbotHook('web', ['me.example.com','you.example.com'], ['nginx']),
  CertbotHook('mail', ['mail.example.com'], ['dovecot', 'exim4']),
]

for hook in hooks:
    hook()

This example will restart nginx if certificates for me.example.com or you.example.com are renewed. It will restart dovecot and exim4 if mail.example.com is renewed. That's it!

Other parameters

You can override the service handler with the handler parameter. The default handler, systemctl_restart will try to restart the service with systemctl. There are 2 other handlers in the handlers package, and echo handler for testing and a laserjet handler for pushing a certificate to your printer (which works for me, but is not exactly "production grade").

You can easily make a custom handler; any method that takes (service, domain) will work. Have a look at the examples.

There is another optional parameter once, which defaults to True. This causes the list of services in a given hook to only be restarted once per run, instead of once per domain. You can set this to False if you want your handler to be called for every matching service, domain combination.

certbothook's People

Contributors

jamesmcdonald avatar

Watchers

 avatar  avatar  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.