Repository navigation
Conversation
|
Thanks for this. I'm also inventing an eventing system (say that 10x fast) in parallel, so we'll take ideas from both probably and make something awesome. Great start! |
Rename app
Move sub interface to listener
Better comment
Addresses issue 4039
|
This branch is now being continued. Please see #4984 for additional context and documentation |
|
Will probably move the exec event handler plugin out into its own repo for now. (There is rationale for this decision. No known security issues -- except perhaps an abundance of caution -- rather, just going to wait and see what demand there is for event handler plugins. Most users might end up writing their own anyway!) |
This will be a separate plugin for now
|
After chatting in Slack, we've agreed this feature is ready to be merged in its experimental state. It will be iterated upon through time and production experience. One lingering question is whether users will want to plug in event handler modules that don't need any configuration -- i.e. custom modules that should only subscribe to events. Right now there's not really an API for a module that only subscribes to events. Right now an I'm not sure how much demand there will be for this, since right now all Caddy modules that are used appear in the configuration. So let's see what the requirements are and the feedback is over time and we can tune this. Because it is experimental we can make breaking changes (though we will try not to). Thanks @francislavoie for making this possible and laying the groundwork! |
|
The next event handler that would be great to have, will be a my use case: opening port 80 incoming (and any other) firewall rule(s) only during the ACME authentication phase. The 3xx/4xx/5xx responses could be an early certification failure event, while the 2xx a continue with the |
|
@hevisko So basically, make an HTTP request? Sounds logical. |
See #4984 for contextual discussion and documentation.
Events currently emitted, along with their data fields:
unhealthywhen a reverse proxy backend goes downhost: The host addresshealthywhen a reverse proxy backend comes back uphost: The host addresscert_obtainingbefore a certificate is obtained or renewed - can be abortedrenewal: True if renewed an existing certificate, false otherwiseidentifier: The domain or IP addressissuer: The name or unique string for the issuer of the certforced: Whether renewal is being forced (early renewal)remaining: Time left before expirationcert_obtainedafter a certificate is obtained OR renewedrenewal: True if renewed an existing certificate, false otherwiseidentifier: The domain or IP addressissuer: The name or unique string for the issuer of the certstorage_key: Part of the key/path to find cert resource in storagecert_failedafter a certificate obtain failedrenewal: True if renewed an existing certificate, false otherwiseidentifier: The domain or IP addressissuer: The name or unique string for the issuer of the certstorage_key: Part of the key/path to find cert resource in storageerror: The error valuecert_ocsp_revokedwhen a certificate's new OCSP status is Revokedsubjects: The SANs/identifiers on the certificatecert: The certificate value itself (don't modify it; TODO: might remove this)reason: The revocation reasonrevoked_at: Time when the certificate was revokedtls_get_certificatewhen GetCertificate is called during a TLS handshakeclient_hello: Thetls.ClientHelloInfostructurecached_managed_certwhen a managed/automated certificate is loaded into memorysans: the certificate SANscached_unmanaged_certwhen a manual certificate is loaded into memorysans: the certificate SANsOne big question is whether to have distinct event names for obtaining a new certificate and renewing an existing one. (To the ACME protocol, they are exactly identical, no distinction is made.) We have the
renewalfield to distinguish the two cases if needed, but we figure most users will just want to listen to one event and then if they care they can use the data field to discern renewals from first-time certs.