Giter VIP home page Giter VIP logo

cloudelementsca / certbot-automation Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 4.0 34 KB

This repo contains scripts to automatically create (renew) certificates with Let's Encrypt using certbot by leveraging an Azure DevOps YAML pipeline. It deploys the newly obtained certificate to an Azure KeyVault.

Home Page: https://cloudelements.ca/renew-lets-encrypt-tls-with-azure-devops-pipelines/

License: GNU General Public License v3.0

PowerShell 41.44% Shell 58.56%
letsencrypt azure certificate acme dns azure-devops-pipelines certbot yaml powershell shell

certbot-automation's Introduction

certbot-automation

This repo contains scripts to automatically create (renew) certificates with Let's Encrypt using certbot by leveraging an Azure DevOps YAML pipeline. It deploys the newly obtained certificate to an Azure KeyVault.

It covers two scenarios:

  • Create Let's Encrypt certificate using Certbot and deploy to Azure KeyVault with Azure DNS Zone
  • Create Let's Encrypt certificate using Certbot and deploy to Azure KeyVault with GoDaddy

Prerequisites

Azure DNS Zone

Azure Resources

  • Azure DNS Zone
  • Azure KeyVault

Azure RBAC

  • Contributor on Azure DNS Zone
  • Import permissions in Access Policies on the Azure KeyVault

Service Providers

GoDaddy

Azure Resources

  • Azure KeyVault with import permissions access policy

Azure DNS Zone

The azure/ folder contains PowerShell scripts that will request a certificate from Let's Encrypt using certbot on a Windows Agent, and update an Azure DNS Zone with the required TXT record.

az-renew-cert.ps1

  • installs certbot
  • installs openssl with chocolatey
  • runs certbot command to create certificate
  • imports certificate to keyvault

az-auth.ps1

  • runs before certbot tries to validate the domain via the --manual-auth-hook flag
  • adds TXT record to Azure DNS Zone

cleanup.ps1

  • runs after certbot has completed verification process via --manual-cleanup-hook
  • removes the TXT record that was added from the --manual-auth-hook

Service Providers

GoDaddy

The service-provider/ folder contains shell scripts that will request a certificate from Let's Encrypt using certbot on a Linux Agent, and update a GoDaddy DNS Zone with the required TXT record using their REST API.

renew-cert.sh

  • installs certbot via snap
  • runs certbot command to create certificate
  • imports certificate to keyvault

godaddy-auth.sh

  • runs before certbot tries to validate the domain via the --manual-auth-hook flag
  • adds TXT record to GoDaddy domain via REST API

cleanup.sh

  • runs after certbot has completed verification process via --manual-cleanup-hook
  • removes the TXT record that was added from the --manual-auth-hook

Pipeline

  • The Azure DevOps pipeline is split into 2 jobs separating the GoDaddy and Azure DNS Zone tasks.
  • The service principal (service connection) used to run the pipeline must have at least contributor on the Azure DNS Zone, and import permissions in the Azure KeyVault access policies.
  • Replace the serviceConnection variable with the name of your service connection.
  • The pipeline uses a variable group containing a secret variable with the password for the private key. The replace token task is configured to replace tokens with pattern __<variable>__ in all files in the folder matching variable names.

certbot-automation's People

Stargazers

 avatar  avatar

Watchers

 avatar

certbot-automation's Issues

Guidence on using other providers

wonder if you could offer guidence or even provider-scripts to extend from Azure DNS, to another.. such as Route53, or DNSMadeEasy..

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.