mirror of
				https://github.com/therootcompany/greenlock-express.js.git
				synced 2024-11-16 17:28:59 +00:00 
			
		
		
		
	Merge branch 'master' of https://git.coolaj86.com/coolaj86/greenlock-express.js
This commit is contained in:
		
						commit
						6d2d02b1d6
					
				
							
								
								
									
										57
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								README.md
									
									
									
									
									
								
							| @ -29,6 +29,14 @@ Features | |||||||
|     - [x] Express.js |     - [x] Express.js | ||||||
|     - [x] [Koa](https://git.coolaj86.com/coolaj86/greenlock-koa.js) |     - [x] [Koa](https://git.coolaj86.com/coolaj86/greenlock-koa.js) | ||||||
|     - [x] [hapi](https://git.coolaj86.com/coolaj86/greenlock-hapi.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 | 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. | **IMPORTANT**: Community plugins may or may not be maintained and working. Please try with the defaults before switching to community plugins. | ||||||
| 
 | 
 | ||||||
| |                | challenge | store | | HTTP-01 Challenges | ||||||
| |:--------------:|:---------:|:-----:| | ----------- | ||||||
| | 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) | | |                | Plugin    | | ||||||
| | 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) | - | | | **Default (fs)** | [le-challenge-fs](https://git.coolaj86.com/coolaj86/le-challenge-fs.js.git) | | ||||||
| | 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) | | ||||||
| | AWS S3         | [llun/le-challenge-s3](https://github.com/llun/le-challenge-s3) | [llun/le-store-s3](https://github.com/llun/le-store-s3) | | | Azure          | [kolarcz/node-le-challenge-azure-storage](https://github.com/kolarcz/node-le-challenge-azure-storage) | | ||||||
| | json           | - | [paulgrove/le-store-simple-fs](https://github.com/paulgrove/le-store-simple-fs) | | - | Build Your Own <br> [le-challenge-http-SPEC](https://git.coolaj86.com/coolaj86/le-challenge-manual.js.git) | | ||||||
| | Redis          | - | [digitalbazaar/le-store-redis](https://github.com/digitalbazaar/le-store-redis) | | | 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 <br> [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 <br> [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. | Bugs: Please report bugs with the community plugins to the appropriate owner first, then here if you don't get a response. | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										41
									
								
								lex.js
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								lex.js
									
									
									
									
									
								
							| @ -3,11 +3,11 @@ | |||||||
| // opts.approveDomains(options, certs, cb)
 | // opts.approveDomains(options, certs, cb)
 | ||||||
| module.exports.create = function (opts) { | module.exports.create = function (opts) { | ||||||
|   // accept all defaults for le.challenges, le.store, le.middleware
 |   // 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); |   var le = require('greenlock').create(opts); | ||||||
| 
 | 
 | ||||||
|   opts.app = opts.app || function (req, res) { |   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) { |   opts.listen = function (plainPort, port) { | ||||||
| @ -24,6 +24,21 @@ module.exports.create = function (opts) { | |||||||
|     var ports = port; |     var ports = port; | ||||||
|     var servers = []; |     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) { |     if (!plainPorts) { | ||||||
|       plainPorts = 80; |       plainPorts = 80; | ||||||
|     } |     } | ||||||
| @ -37,20 +52,30 @@ module.exports.create = function (opts) { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     plainPorts.forEach(function (p) { |     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 () { |         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(); |           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) { |     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 () { |         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(); |           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); |         servers.push(server); | ||||||
|       })); |       })); | ||||||
|     }); |     }); | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "greenlock-express", |   "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.", |   "description": "Free SSL and managed or automatic HTTPS for node.js with Express, Koa, Connect, Hapi, and all other middleware systems.", | ||||||
|   "main": "lex.js", |   "main": "lex.js", | ||||||
|   "homepage": "https://git.coolaj86.com/coolaj86/greenlock-express.js", |   "homepage": "https://git.coolaj86.com/coolaj86/greenlock-express.js", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user