Email Login
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
///////////////////
|
||||
@ -21,25 +22,32 @@ var serveStatic = require('serve-static');
|
||||
//var glx = require('greenlock-express')
|
||||
var glx = require('../').create({
|
||||
|
||||
version: 'draft-11' // Let's Encrypt v2 is ACME draft 11
|
||||
version: 'draft-11' // Let's Encrypt v2 is ACME draft 11
|
||||
|
||||
, server: 'https://acme-v02.api.letsencrypt.org/directory' // If at first you don't succeed, stop and switch to staging
|
||||
// https://acme-staging-v02.api.letsencrypt.org/directory
|
||||
,
|
||||
server: 'https://acme-v02.api.letsencrypt.org/directory' // If at first you don't succeed, stop and switch to staging
|
||||
// https://acme-staging-v02.api.letsencrypt.org/directory
|
||||
|
||||
, configDir: '~/.config/acme/' // You MUST have access to write to directory where certs
|
||||
// are saved. ex: /home/foouser/.config/acme
|
||||
,
|
||||
configDir: '~/.config/acme/' // You MUST have access to write to directory where certs
|
||||
// are saved. ex: /home/foouser/.config/acme
|
||||
|
||||
, approveDomains: myApproveDomains // Greenlock's wraps around tls.SNICallback. Check the
|
||||
// domain name here and reject invalid ones
|
||||
,
|
||||
approveDomains: myApproveDomains // Greenlock's wraps around tls.SNICallback. Check the
|
||||
// domain name here and reject invalid ones
|
||||
|
||||
, app: myVhostApp // Any node-style http app (i.e. express, koa, hapi, rill)
|
||||
,
|
||||
app: myVhostApp // Any node-style http app (i.e. express, koa, hapi, rill)
|
||||
|
||||
/* CHANGE TO A VALID EMAIL */
|
||||
, email:'jon@example.com' // Email for Let's Encrypt account and Greenlock Security
|
||||
, agreeTos: true // Accept Let's Encrypt ToS
|
||||
, communityMember: true // Join Greenlock to get important updates, no spam
|
||||
/* CHANGE TO A VALID EMAIL */
|
||||
,
|
||||
email: 'jon@example.com' // Email for Let's Encrypt account and Greenlock Security
|
||||
,
|
||||
agreeTos: true // Accept Let's Encrypt ToS
|
||||
,
|
||||
communityMember: true // Join Greenlock to get important updates, no spam
|
||||
|
||||
//, debug: true
|
||||
//, debug: true
|
||||
|
||||
});
|
||||
|
||||
@ -84,7 +92,10 @@ function myApproveDomains(opts, certs, cb) {
|
||||
// opts.agreeTos = true;
|
||||
// opts.challengeType = 'http-01';
|
||||
// opts.challenge = require('le-challenge-fs').create({});
|
||||
cb(null, { options: opts, certs: certs });
|
||||
cb(null, {
|
||||
options: opts,
|
||||
certs: certs
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
@ -96,6 +107,7 @@ function myApproveDomains(opts, certs, cb) {
|
||||
// It will also make them lowercase and protect against "domain fronting".
|
||||
// However, it's up to you to make sure you actually have a domain to serve :)
|
||||
var servers = {};
|
||||
|
||||
function myVhostApp(req, res) {
|
||||
var hostname = req.headers.host;
|
||||
var srvpath = path.join(srv, hostname);
|
||||
@ -104,11 +116,13 @@ function myVhostApp(req, res) {
|
||||
if (!servers[hostname]) {
|
||||
try {
|
||||
fs.accessSync(srvpath);
|
||||
servers[hostname] = serveStatic(srvpath, { redirect: true });
|
||||
} catch(e) {
|
||||
servers[hostname] = serveStatic(srvpath, {
|
||||
redirect: true
|
||||
});
|
||||
} catch (e) {
|
||||
finalhandler(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
servers[hostname](req, res, finalhandler(req, res));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user