Git Product home page Git Product logo

certbot-dns-windows's Introduction

TL/DR

This is a PowerShell script that can be used as manual auth and cleanup hook, and executes the necessary dnscmd commands on a Windows DNS server to enable dns-01 authentication.

Prerequisites

certbot auth hook

Save certbot-dns-windows.ps1 to /etc/letsencrypt and change the following variables:

  • $zone: The name of the forward lookup zone
  • $dnsServerHostName: The fully qualified Windows DNS server we're logging in to
  • $userName: The name of the administrator user used for a login

Important: Make the certbot-dns-windows.ps1 script executable with: chmod 755 /etc/letsencrypt/certbot-dns-windows.ps1.

certbot command

The REQUESTS_CA_BUNDLE is required for a successful TLS connection to your custom ACME CA server.

You should change the following values:

  • REQUESTS_CA_BUNDLE: Path to the root CA file to be able to connect to your custom ACME CA server
  • --email: The ACME CA account
  • --installer: To be changed when you don't use NGINX
  • -d: The domain to get the certificate for
  • --cert-name: The (internal) name of the certificate to be issued
  • --server: The URL to your custom ACME CA server (e.g. step-ca)
#!/bin/bash

sudo \
  REQUESTS_CA_BUNDLE=/usr/local/share/ca-certificates/your-custom-root-ca.crt \
  certbot --agree-tos --email "[email protected]" \
    run \
      --installer nginx                  \
      --authenticator manual             \
      --manual-auth-hook "/etc/letsencrypt/certbot-dns-windows.ps1" \
      --manual-cleanup-hook "/etc/letsencrypt/certbot-dns-windows.ps1 --remove" \
      -d \*.your.intern.domain.com       \
      --cert-name wildcard-cert-name     \
      --preferred-challenges dns         \
      --server https://your-internal-acme-ca-like-step-ca/acme/acme/directory \
      --force-renewal

Troubleshooting

Challenge fails

Symptom: The challenge simply doesn't work and you see lots of messages in the step-ca log like There was a problem with a DNS query during identifier validation

Explanation: The DNS record lookup uses systemd-resolved which caches DNS requests. Thus, the ACME CA (like step-ca) never sees the newly created TXT records.

Solution: Ensure that the ACME CA queries the Windows DNS server directly.

In case you use step-ca, just add the --resolver 127.0.0.53:53 argument when starting the step-ca server. Don't forget to replace 127.0.0.53 with the correct IP of your DNS server!

The CMD of the smallstep/step-ca docker image can be overriden, with - for example - the following values:

version: "3.8"
services:
  step-ca:
    image: smallstep/step-ca:latest
    restart: always
    command: ["/usr/local/bin/step-ca", "--resolver", "127.0.0.53:53", "--password-file", "/home/step/secrets/password", "/home/step/config/ca.json"]
    network_mode: "host"
    volumes:
      - step:/home/step

volumes:
  step:

certbot-dns-windows's People

Contributors

fubar-coder avatar

Watchers

 avatar  avatar  avatar

certbot-dns-windows's Issues

REQ: cert-manager integration

Thank you! this looks very promising, and chance you have information or could add incorporating this into cert-manager?

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.