Package: lancer
LAN-Cer: Certificates For Your LANlanceris a tool which will quickly and simply provision certificates for any
number of hosts in a domain, using Let's Encrypt, assuming that you have an
API-controlled DNS service.The ProblemYou have too many computers.  Too many (all) of them have to talk to the
Internet.  And, as we all know, any computer on the internet needs a TLS
certificate and thelock
iconthat comes with it if you want to be able to talk to it.For example:Maybe you need to test some web APIs thatdon't
workwithout HTTPS, so you need a development certificate for localhost.Maybe you have anOpenWRTrouter and you need to
administer it via its web interface; you don't want every compromised IoT
device or bored teenager on your WiFi to be able to read your administrator
password.The Bad Old DaysPreviously the way you'd address problems like this would be to:⚠️😡⚠️ use a garbage self-signed root and click through annoying warnings all
the time🔒️🗑️🔒️ add a garbage self-signed root to your trust store🔥😱🔥 turn off certificate validation entirely in your softwareThese are all bad in similar ways: they decrease your security and they require
fiddly, machine-specific configuration that has to be repeated on every new
machine that needs to talk to such endpoints.The SolutionLet's Encrypt is 99% of the solution here.  And, for public-facing internet
services, it's almost trivially easy to use; many web servers provide built-in
support for it.  But you don't want to use production certificates for your
main website on your development box: you want to put an entry in/etc/hostsunder a dedicated test domain name, and you shouldn't have to figure out how to
route inbound public traffic to a web server on that host name in order to
respond to a challenge.Luckily, Let's Encrypt offers DNS-01 validation, so all you need to do is
update a DNS record.  Lancer uses this challenge.What You NeedYour DNS needs to be hosted on a platform that supportslibcloud(Rackspace
DNS and CloudFlare are two that I have tested with), or Gandi's' V5 API which
Lancer has specific support for.  You will need an API key.How To Use Itpip install lancermkdir certificates-for-mydomain.comCreate empty files for the certificates you want to provision:touch certificates-for-mydomain.com/myhost1.lan.mydomain.com.pem certificates-for-mydomain.com/myhost2.lan.mydomain.com.pem.lancer certificates-for-mydomain.comUpon first run, lancer will ask you 4 questions:what driver do you want to use?  this should be the libcloud driver name, or
'gandi' for the Gandi V5 API.what is your username?what is the DNS zone that you will be provisioning certificates under?
(usually this is theregistrable partof the
domain name; if you want certificates forlan.somecompany.comthen your
zone is usuallysomecompany.com)what is your API key?  This will be prompted for and stored withSecretly, which usesKeyringto securely store secrets; this
may mean that in certain unattended configurations you might needkeyrings.altto store your API key
in a configuration file rather than something likeKeychainorGnomeKeyring.It will store the answers to the first three questions incertificates-for-mydomain.com/lancer.jsonand the secrets depending upon your
keyring configuration, so you shouldn't need to answer them again (although you
may need to click through a security confirmation on subsequent attempts to
allow access to your API key).Wait forlancerto log that it has successfully provisioned your
certificates, and copy your now-no-longer-empty.pemfiles (which will each
contain a certificate, chain certificates, and a private key) to wherever you
need them on your LAN.  You can kill it with^Cor you can just leave it
running in the background and let it auto-renew every 90 days or so.If you don't leave it running, to renew your certificates when they've expired,
simply runlancer certificates-for-mydomain.comagain, and any expired or
soon-to-expire.pemfiles in that directory will be renewed and replaced.
You can add new certificates at any time by creating new, emptyfully-qualified-domain-name.pemfiles,