making way for forge and ursa backends

This commit is contained in:
AJ ONeal 2015-12-14 21:21:59 -08:00
parent efcc2b3bac
commit 050ec1f1f3
7 changed files with 46 additions and 19 deletions

View File

@ -3,11 +3,12 @@
var PromiseA = require('bluebird');
var fs = PromiseA.promisifyAll(require('fs'));
module.exports.create = function (leBinPath, defaults, opts) {
module.exports.create = function (defaults, opts) {
defaults.webroot = true;
defaults.renewByDefault = true;
defaults.text = true;
var leBinPath = defaults.pythonClientPath;
var LEP = require('letsencrypt-python');
var lep = PromiseA.promisifyAll(LEP.create(leBinPath, opts));
var wrapped = {

View File

@ -23,27 +23,28 @@ var bkDefaults = {
, fullchainTpl: '/live/:hostname/fullchain.pem'
, privkeyTpl: '/live/:hostname/privkey.pem'
, configDir: path.join(__dirname, '..', 'tests', 'letsencrypt.config')
, server: LE.stagingServer
// backend-specific
, logsDir: path.join(__dirname, '..', 'tests', 'letsencrypt.logs')
, workDir: path.join(__dirname, '..', 'tests', 'letsencrypt.work')
, server: LE.stagingServer
, text: true
, pythonClientPath: require('os').homedir() + '/.local/share/letsencrypt/bin/letsencrypt'
};
var leBinPath = require('os').homedir() + '/.local/share/letsencrypt/bin/letsencrypt';
var LEB = require('../backends-python');
var backend = LEB.create(leBinPath, bkDefaults, { debug: true });
var LEP = require('../backends/python');
var le = LE.create(backend, bkDefaults, {
var le = LE.create(LEP, bkDefaults, {
/*
setChallenge: function (hostnames, key, value, cb) {
// the python backend needs fs.watch implemented
// before this would work (and even then it would be difficult)
}
, getChallenge: function (hostnames, key, cb) {
//
//
}
, sniRegisterCallback: function (args, certInfo, cb) {
}
, registrationFailureCallback: function (args, certInfo, cb) {
what do to when a backgrounded registration fails

View File

@ -21,11 +21,12 @@ var config = {
// these are specific to the python client and won't be needed with the purejs library
, logsDir: path.join(__dirname, '..', 'tests', 'letsencrypt.logs')
, workDir: path.join(__dirname, '..', 'tests', 'letsencrypt.work')
, pythonClientPath: binpath
}
};
//config.backend = require('letsencrypt/backends-python').create(binpath, config.le);
config.backend = require('../backends-python').create(binpath, config.le);
//config.backend = require('letsencrypt/backends/python').create(binpath, config.le);
config.backend = require('../backends/python');
module.exports = config;

View File

@ -23,16 +23,17 @@ var bkDefaults = {
, fullchainTpl: '/live/:hostname/fullchain.pem'
, privkeyTpl: '/live/:hostname/privkey.pem'
, configDir: path.join(__dirname, '..', 'tests', 'letsencrypt.config')
, server: LE.stagingServer
// python-specific
, logsDir: path.join(__dirname, '..', 'tests', 'letsencrypt.logs')
, workDir: path.join(__dirname, '..', 'tests', 'letsencrypt.work')
, server: LE.stagingServer
, pythonClientPath: require('os').homedir() + '/.local/share/letsencrypt/bin/letsencrypt'
};
var leBinPath = require('os').homedir() + '/.local/share/letsencrypt/bin/letsencrypt';
var LEB = require('../backends-python');
var backend = LEB.create(leBinPath, bkDefaults, { debug: true });
var LEP = require('../backends/python');
var le = LE.create(backend, bkDefaults, {
var le = LE.create(LEP, bkDefaults, {
sniRegisterCallback: function (args, certInfo, cb) {
var allowedDomains = conf.domains; // require('../tests/config').allowedDomains;
@ -62,7 +63,7 @@ var le = LE.create(backend, bkDefaults, {
// before this would work (and even then it would be difficult)
}
, getChallenge: function (hostnames, key, cb) {
//
//
}
, registrationFailureCallback: function (args, certInfo, cb) {
what do to when a backgrounded registration fails

View File

@ -5,11 +5,15 @@
var PromiseA = require('bluebird');
var crypto = require('crypto');
var tls = require('tls');
var path = require('path');
var LE = module.exports;
LE.liveServer = "https://acme-v01.api.letsencrypt.org/directory";
LE.stagingServer = "https://acme-staging.api.letsencrypt.org/directory";
LE.configDir = "/etc/letsencrypt/";
LE.logsDir = "/var/log/letsencrypt/";
LE.workDir = "/var/lib/letsencrypt/";
LE.merge = function merge(defaults, args) {
var copy = {};
@ -25,6 +29,18 @@ LE.merge = function merge(defaults, args) {
};
LE.create = function (backend, defaults, handlers) {
if ('function' === typeof backend.create) {
backend.create(defaults, handlers);
}
else if ('string' === typeof backend) {
// TODO I'll probably regret this
// I don't like dynamic requires because they cause build / minification issues.
backend = require(path.join('backends', backend)).create(defaults, handlers);
}
else {
// ignore
// this backend was created the v1.0.0 way
}
if (!handlers) { handlers = {}; }
if (!handlers.lifetime) { handlers.lifetime = 90 * 24 * 60 * 60 * 1000; }
if (!handlers.renewWithin) { handlers.renewWithin = 3 * 24 * 60 * 60 * 1000; }
@ -73,7 +89,7 @@ LE.create = function (backend, defaults, handlers) {
//, ciphers // node's defaults are great
});
}
cb(null, cache.context);
}

View File

@ -33,9 +33,16 @@
"express": "^4.13.3",
"localhost.daplie.com-certificates": "^1.1.2"
},
"optionalDependencies": {
"letsencrypt-python": "^1.0.3",
"letsencrypt-forge": "file:letsencrypt-forge",
"letsencrypt-ursa": "file:letsencrypt-ursa",
"node-forge": "^0.6.38",
"ursa": "^0.9.1"
"letiny": "0.0.4-beta",
},
"dependencies": {
"bluebird": "^3.0.6",
"letsencrypt-python": "^1.0.3",
"serve-static": "^1.10.0"
"serve-static": "^1.10.0",
}
}