#3193·lego

Named-Reference Hooks, Multiple Hooks

Author: johnnybubonicCreated Jul 8, 2026Updated Aug 4, 2026
Labelsproposalno-decision

Welcome

  • Yes, I'm using a binary release or the library within the two latest releases.
  • Yes, I've searched for similar issues on GitHub and didn't find any.

Detailed Description

Currently when using the config file, only a single hook of each type may be defined and it is applied to all certificate definitions/references.

Certbot at least has the option of hook directories, in which multiple hooks could be placed.

The hooks should support named references (just like challenges, accounts, etc.) and they should be a list, not a string scalar.

The following suggestion is backwards compatible by creating a new section, hooksets:

yaml
# (...)

hooksets:
  # A named reference, 'one'.
  one:
    deploy:
      - command: '/usr/bin/some_deploy_hook'
        timeout: 2m
      - command: '/usr/bin/some_other_deploy_hook'
        timeout: 1m
  # A hookset named 'two'.
  two:
    pre:
      - command: '/usr/bin/a_pre_hook'
    post:
      - command: '/usr/bin/a_post_hook'

# (...)

certificates:
  cert_foo:
    # ( ... )
    hooksets:
      - one
  cert_bar:
    # ( ... )
    hooksets:
      - one
      - two

Any/all hooks defined in hooks would still be applied globally, but hooksets would only be run if referenced by a certificate object.

This adds missing functionality, allows for far more modular deploys, and retains backwards compatibility.

Effective version of lego

v5.2.2

How do you use lego?

Binary

In which context are you using lego?

Personal and professional use

Supporting the Maintainers

  • Yes, I find this project useful, and I appreciate the work done by the maintainers.
  • Yes, I have starred this repository to help others find it.
  • Yes, I have sponsored this project to keep the project stable and maintained.

Confirmation

  • Yes, I've included all the information above (version, usage, etc.).