diff --git a/README.md b/README.md index 06e03c6..9743058 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,14 @@ Features - [x] Express.js - [x] [Koa](https://git.coolaj86.com/coolaj86/greenlock-koa.js) - [x] [hapi](https://git.coolaj86.com/coolaj86/greenlock-hapi.js) + - [x] Extensible Plugin Support + - [x] AWS (S3, Route53) + - [x] Azure + - [x] CloudFlare + - [x] Consul + - [x] Digital Ocean + - [x] etcd + - [x] Redis Install ======= @@ -166,16 +174,45 @@ Plugins ===== **IMPORTANT**: Community plugins may or may not be maintained and working. Please try with the defaults before switching to community plugins. -| | challenge | store | -|:--------------:|:---------:|:-----:| -| Build Your Own | [le-challenge-SPEC](https://git.coolaj86.com/coolaj86/le-challenge-manual.js.git) | [le-store-SPEC](https://git.coolaj86.com/coolaj86/le-store-SPEC.js.git) | -| Defaults (fs) | [le-challenge-fs](https://git.coolaj86.com/coolaj86/le-challenge-fs.js.git) | [le-store-certbot](https://git.coolaj86.com/coolaj86/le-store-certbot.js.git) | -| Full List | [Search le-store- on npm](https://www.npmjs.com/search?q=le-store-) | [Search le-challenge- on npm](https://www.npmjs.com/search?q=le-challenge-) | -| AWS Route 53 | [thadeetrompetter/le-challenge-route53](https://github.com/thadeetrompetter/le-challenge-route53) | - | -| AWS S3 | | [paco3346/le-store-awss3](https://github.com/paco3346/le-store-awss3) | -| AWS S3 | [llun/le-challenge-s3](https://github.com/llun/le-challenge-s3) | [llun/le-store-s3](https://github.com/llun/le-store-s3) | -| json | - | [paulgrove/le-store-simple-fs](https://github.com/paulgrove/le-store-simple-fs) -| Redis | - | [digitalbazaar/le-store-redis](https://github.com/digitalbazaar/le-store-redis) | +HTTP-01 Challenges +----------- + +| | Plugin | +|:--------------:|:---------:| +| **Default (fs)** | [le-challenge-fs](https://git.coolaj86.com/coolaj86/le-challenge-fs.js.git) | +| AWS S3 | [llun/le-challenge-s3](https://github.com/llun/le-challenge-s3) | +| Azure | [kolarcz/node-le-challenge-azure-storage](https://github.com/kolarcz/node-le-challenge-azure-storage) | +| - | Build Your Own
[le-challenge-http-SPEC](https://git.coolaj86.com/coolaj86/le-challenge-manual.js.git) | +| Full List | Search [le-challenge-](https://www.npmjs.com/search?q=le-challenge-) on npm | + + +DNS-01 Challenges +----------- + +| | Plugin | +|:--------------:|:---------:| +| **Manual (cli)** | [le-challenge-dns](https://git.coolaj86.com/coolaj86/le-challenge-dns.js.git) | +| AWS Route 53 | [thadeetrompetter/le-challenge-route53](https://github.com/thadeetrompetter/le-challenge-route53) | +| CloudFlare | [buschtoens/le-challenge-cloudflare](https://github.com/buschtoens/le-challenge-cloudflare) | +| CloudFlare | [llun/le-challenge-cloudflare](https://github.com/llun/le-challenge-cloudflare) | +| Digital Ocean | [bmv437/le-challenge-digitalocean](https://github.com/bmv437/le-challenge-digitalocean) | +| etcd | [ceecko/le-challenge-etcd](https://github.com/ceecko/le-challenge-etcd) | +| - | Build Your Own
[le-challenge-dns-SPEC](https://git.coolaj86.com/coolaj86/le-challenge-dns.js.git) | +| Full List | Search [le-challenge-](https://www.npmjs.com/search?q=le-challenge-) on npm | + +Account & Certificate Storage +----------- + +| | Plugin | +|:--------------:|:---------:| +| **Defaults (fs)** | [le-store-certbot](https://git.coolaj86.com/coolaj86/le-store-certbot.js.git) | +| AWS S3 | [paco3346/le-store-awss3](https://github.com/paco3346/le-store-awss3) | +| AWS S3 | [llun/le-store-s3](https://github.com/llun/le-store-s3) | +| Consul | [sebastian-software/le-store-consul](https://github.com/sebastian-software/le-store-consul) | +| json (fs) | [paulgrove/le-store-simple-fs](https://github.com/paulgrove/le-store-simple-fs) +| Redis | [digitalbazaar/le-store-redis](https://github.com/digitalbazaar/le-store-redis) | +| - | Build Your Own
[le-store-SPEC](https://git.coolaj86.com/coolaj86/le-store-SPEC.js.git) | +| Full List | Search [le-store-](https://www.npmjs.com/search?q=le-store-) on npm | Bugs: Please report bugs with the community plugins to the appropriate owner first, then here if you don't get a response. diff --git a/lex.js b/lex.js index c749dc3..751e2dc 100644 --- a/lex.js +++ b/lex.js @@ -3,11 +3,11 @@ // opts.approveDomains(options, certs, cb) module.exports.create = function (opts) { // accept all defaults for le.challenges, le.store, le.middleware - opts._communityPackage = 'greenlock-express.js'; + opts._communityPackage = opts._communityPackage || 'greenlock-express.js'; var le = require('greenlock').create(opts); opts.app = opts.app || function (req, res) { - res.end("Hello, World!\nWith Love,\nLet's Encrypt Express"); + res.end("Hello, World!\nWith Love,\nGreenlock for Express.js"); }; opts.listen = function (plainPort, port) { @@ -24,6 +24,21 @@ module.exports.create = function (opts) { var ports = port; var servers = []; + function explainError(e) { + console.error('Error:' + e.message); + if ('EACCES' === e.errno) { + console.error("You don't have prmission to access '" + e.address + ":" + e.port + "'."); + console.error("You probably need to use \"sudo\" or \"sudo setcap 'cap_net_bind_service=+ep' $(which node)\""); + return; + } + if ('EADDRINUSE' === e.errno) { + console.error("'" + e.address + ":" + e.port + "' is already being used by some other program."); + console.error("You probably need to stop that program or restart your computer."); + return; + } + console.error(e.code + ": '" + e.address + ":" + e.port + "'"); + } + if (!plainPorts) { plainPorts = 80; } @@ -37,20 +52,30 @@ module.exports.create = function (opts) { } plainPorts.forEach(function (p) { - promises.push(new PromiseA(function (resolve, reject) { + if (!(parseInt(p, 10) >= 0)) { console.warn("'" + p + "' doesn't seem to be a valid port number for http"); } + promises.push(new PromiseA(function (resolve) { require('http').createServer(le.middleware(require('redirect-https')())).listen(p, function () { - console.log("Handling ACME challenges and redirecting to https on plain port " + p); + console.log("Success! Bound to port '" + p + "' to handle ACME challenges and redirect to https"); resolve(); - }).on('error', reject); + }).on('error', function (e) { + console.log("Did not successfully create http server and bind to port '" + p + "':"); + explainError(e); + process.exit(0); + }); })); }); ports.forEach(function (p) { - promises.push(new PromiseA(function (resolve, reject) { + if (!(parseInt(p, 10) >= 0)) { console.warn("'" + p + "' doesn't seem to be a valid port number for https"); } + promises.push(new PromiseA(function (resolve) { var server = require('https').createServer(le.httpsOptions, le.middleware(le.app)).listen(p, function () { - console.log("Handling ACME challenges and serving https " + p); + console.log("Success! Serving https on port '" + p + "'"); resolve(); - }).on('error', reject); + }).on('error', function (e) { + console.log("Did not successfully create https server and bind to port '" + p + "':"); + explainError(e); + process.exit(0); + }); servers.push(server); })); }); diff --git a/package.json b/package.json index 5a0491b..5ea741b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "greenlock-express", - "version": "2.1.2", + "version": "2.1.4", "description": "Free SSL and managed or automatic HTTPS for node.js with Express, Koa, Connect, Hapi, and all other middleware systems.", "main": "lex.js", "homepage": "https://git.coolaj86.com/coolaj86/greenlock-express.js",