Greenlock™ for hapi
An Automated HTTPS ACME client (Let's Encrypt v2) for hapi
| Sponsered by ppl | Greenlock™ is for Browsers, Node.js, Commandline, Express.js, Node.js Cluster, hapi, Koa, and rill |
Features
- Automatic Registration via SNI (
httpsOptions.SNICallback
) - Secure domain approval callback
- Automatic renewal between 10 and 14 days before expiration
- Virtual Hosting (vhost) with Multiple Domains & SAN
- plugins for AWS, redis, etc
- and more
This module is just an alias for greenlock-express.js, which works with any middleware system.
Install
npm install --save greenlock-hapi@2.x
QuickStart
'use strict'; //////////////////////// Greenlock Setup //////////////////////// var greenlock = ; ///////////////////// Just add hapi ///////////////////// var hapi = ;var https = ;var server = ;var acmeResponder = greenlock;var httpsServer = https; server; server; server; //// http redirect to https//var http = ;var redirectHttps = ; http;
Usage & Troubleshooting
See https://git.coolaj86.com/coolaj86/greenlock-express.js
Handling a dynamic list of domains
In the oversimplified exapmple above we handle a static list of domains.
If you add domains programmatically you'll want to use the approveDomains
callback.
SECURITY: Be careful with this. If you don't check that the domains being requested are the domains you allow an attacker can make you hit your rate limit for failed verification attempts.
We have a vhost example that allows any domain for which there is a folder on the filesystem in a specific location.
See that example for an idea of how this is done.