Limitations of CertMagic


(Oliver Dunk) #1

Hi! As I documented in this post, I was using a Caddy plugin to save certificate information in a database. This very roughly worked as follows:

  • Added an event fired when a certificate is obtained
  • Caddy plugin listens for that event and saves details to a database

Unfortunately, with certificates now obtained by CertMagic, I’m in a tricky situation. I can’t use a Caddy plugin, as CertMagic doesn’t know about Caddy and can’t emit an event. Additionally, I can’t make a CertMagic plugin, as those don’t exist.

Any ideas? My only thought is to build my database integration directly into CertMagic.


(Oliver Dunk) #2

Matt to the rescue! https://twitter.com/mholt6/status/1075478598146875392


(Matt Holt) #3

Most Caddy events related to TLS are emitted from this function now: https://github.com/mholt/caddy/blob/master/caddytls/setup.go#L70

However, you should still be seeing the event as before: https://github.com/mholt/caddy/blob/0684cf861170a112a041137b352322602543ccdf/caddytls/setup.go#L100