Golang and Let's Encrypt: a free software story

4 hours ago 2

Here’s a story from nearly 10 years ago.

the bug

I think it was my friend Richard Kettlewell who told me about a bug he encountered with Let’s Encrypt in its early days in autumn 2015: it was failing to validate mail domains correctly.

the context

At the time I had previously been responsible for Cambridge University’s email anti-spam system for about 10 years, and in 2014 I had been given responsibility for Cambridge University’s DNS. So I knew how Let’s Encrypt should validate mail domains.

Let’s Encrypt was about one year old. Unusually, the code that runs their operations, Boulder, is free software and open to external contributors.

Boulder is written in Golang, and I had not previously written any code in Golang. But its reputation is to be easy to get to grips with.

So, in principle, the bug was straightforward for me to fix. How difficult would it be as a Golang newbie? And what would Let’s Encrypt’s contribution process be like?

the hack

I cloned the Boulder repository and had a look around the code.

As is pretty typical, there are a couple of stages to fixing a bug in an unfamiliar codebase:

  • work out where the problem is

  • try to understand if the obvious fix could be better

In this case, I remember discovering a relatively substantial TODO item that intersected with the bug. I can’t remember the details, but I think there were wider issues with DNS lookups in Boulder. I decided it made sense to fix the immediate problem without getting involved in things that would require discussion with Let’s Encrypt staff.

I faffed around with the code and pushed something that looked like it might work.

A fun thing about this hack is that I never got a working Boulder test setup on my workstation (or even Golang, I think!) – I just relied on the Let’s Encrypt cloud test setup. The feedback time was very slow, but it was tolerable for a simple one-off change.

the fix

My pull request was small, +48-14.

After a couple of rounds of review and within a few days, it was merged and put into production!

A pleasing result.

the upshot

I thought Golang (at least as it was used in the Boulder codebase) was as easy to get to grips with as promised. I did not touch it again until several years later, because there was no need to, but it seemed fine.

I was very impressed by the Let’s Encrypt continuous integration and automated testing setup, and by their low-friction workflow for external contributors. One of my fastest drive-by patches to get into worldwide production.

My fix was always going to be temporary, and all trace of it was overwritten years ago. It’s good when “temporary” turns out to be true!

the point

I was reminded of this story in the pub this evening, and I thought it was worth writing down. It demonstrated to me that Let’s Encrypt really were doing all the good stuff they said they were doing.

So thank you to Let’s Encrypt for providing an exemplary service and for giving me a happy little anecdote.

Read Entire Article