Giter Club home page Giter Club logo

acme-haproxy-clustered's Introduction

acme-haproxy-clustered

Clustered version of the HAProxy deployment script for acme.sh.

We use this in the Riff.CC Lab to deploy and renew TLS certificates from Let's Encrypt without having to specifically account for them in the HAProxy configuration.

It's best used with clustered storage.

What it does

  • It's a post-deployment hook for acme.sh that copies your certificates to the remote hosts you specify.
  • It then informs haproxy that it has new certificates using the admin socket.
  • This allows you to load new certificates in real-time without so much as a reload!

Usage

  • Install acme.sh using whatever method you prefer. Install haproxy, preferably using haproxy-cluster-playbook
  • Mount /etc/haproxy/certs on each of your HAProxy hosts using shared storage (MooseFS, CephFS, NFS will all work just fine).
  • Copy haproxy_clustered.sh to .acme.sh/deploy/haproxy_clustered.sh and ensure it has an execute flag set (chmod +x .acme.sh/deploy/haproxy_clustered.sh)
  • Ensure the user you're logged in as has key-based SSH access to the remote machines you want to update. We suggest creating a user called "haproxy_admin" on each of your HAProxy hosts, and adding it to the haproxy POSIX group. This will allow you to use the haproxy group to control access to the HAProxy stats socket.
  • Run the deploy script, here's an example of how to use it
DEPLOY_HAPROXY_HOT_UPDATE=yes \
    DEPLOY_HAPROXY_STATS_SOCKET=/var/run/haproxy/admin.sock \
    DEPLOY_HAPROXY_PEM_PATH=/etc/haproxy/certs \
    [email protected],[email protected],[email protected] \
    acme.sh --deploy -d riff.cc -d *.riff.cc --deploy-hook haproxy_clustered

Examples

Here is an example of a successful run, deploying a certificate to three HAProxy hosts.

root@prod-haproxy01:~# DEPLOY_HAPROXY_HOT_UPDATE=yes DEPLOY_HAPROXY_STATS_SOCKET=/var/run/haproxy/admin.sock DEPLOY_HAPROXY_PEM_PATH=/etc/haproxy/certs   [email protected],[email protected],[email protected] acme.sh --deploy -d riff.cc -d *.riff.cc --deploy-hook haproxy_clustered
[Mon Oct  9 13:06:43 UTC 2023] The domain 'riff.cc' seems to have a ECC cert already, lets use ecc cert.
[Mon Oct  9 13:06:44 UTC 2023] Deploying PEM file
[Mon Oct  9 13:06:44 UTC 2023] Moving new certificate into place
Updating existing certificate '/etc/haproxy/certs/riff.cc.pem' over HAProxy stats socket.
Applying to remote machine: [email protected]
Updating existing certificate '/etc/haproxy/certs/riff.cc.pem' over HAProxy stats socket.
Applying to remote machine: [email protected]
Updating existing certificate '/etc/haproxy/certs/riff.cc.pem' over HAProxy stats socket.
Applying to remote machine: [email protected]
Updating existing certificate '/etc/haproxy/certs/riff.cc.pem' over HAProxy stats socket.
[Mon Oct  9 13:06:48 UTC 2023] Success

acme-haproxy-clustered's People

Contributors

zorlin avatar

Watchers

 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.