v3.0.1: Doc and code updates
This commit is contained in:
parent
bda3a62e28
commit
ef562d2984
24
README.md
24
README.md
|
@ -1,18 +1,20 @@
|
||||||
| [Greenlock](https://git.coolaj86.com/coolaj86/greenlock.js) (library)
|
# [le-challenge-manual](https://git.coolaj86.com/coolaj86/le-challenge-manual.js.git)
|
||||||
| [Greenlock CLI](https://git.coolaj86.com/coolaj86/greenlock-cli.js)
|
|
||||||
| [greenlock-express](https://git.coolaj86.com/coolaj86/greenlock-express.js)
|
|
||||||
| [greenlock-koa](https://git.coolaj86.com/coolaj86/greenlock-koa.js)
|
|
||||||
| [greenlock-hapi](https://git.coolaj86.com/coolaj86/greenlock-hapi.js)
|
|
||||||
|
|
|
||||||
|
|
||||||
le-challenge-manual
|
| A [Root](https://rootprojects.org) Project |
|
||||||
===================
|
|
||||||
|
|
||||||
A [Root](https://rootprojects.org) Project
|
An extremely simple reference implementation
|
||||||
|
of an ACME (Let's Encrypt) challenge strategy
|
||||||
|
for [Greenlock](https://git.coolaj86.com/coolaj86/greenlock-express.js) v2.7+ (and v3).
|
||||||
|
|
||||||
A manual cli-based strategy for [Greenlock](https://git.coolaj86.com/coolaj86/greenlock-express.js) v2.7+ (and v3).
|
* Prints the ACME challenge details to the terminal (and waits for you to hit enter before continuing)
|
||||||
|
* Asks you to enter the change response.
|
||||||
|
* Let's you know it's safeto remove the challenge.
|
||||||
|
|
||||||
Prints the ACME challenge Token and Key and then waits for you to hit enter before continuing.
|
Other ACME Challenge Reference Implementations:
|
||||||
|
|
||||||
|
* [le-challenge-manual](https://git.coolaj86.com/coolaj86/le-challenge-manual.js.git)
|
||||||
|
* [le-challenge-http](https://git.coolaj86.com/coolaj86/le-challenge-http.js.git)
|
||||||
|
* [le-challenge-dns](https://git.coolaj86.com/coolaj86/le-challenge-dns.js.git)
|
||||||
|
|
||||||
Install
|
Install
|
||||||
-------
|
-------
|
||||||
|
|
62
index.js
62
index.js
|
@ -49,11 +49,11 @@ Challenge.create = function (config) {
|
||||||
challenger.get = function (opts) {
|
challenger.get = function (opts) {
|
||||||
var ch = opts.challenge;
|
var ch = opts.challenge;
|
||||||
if ('http-01' === ch.type) {
|
if ('http-01' === ch.type) {
|
||||||
return Challenge._getHttp(opts);
|
return Challenge._get(opts);
|
||||||
} else if ('dns-01' === ch.type) {
|
} else if ('dns-01' === ch.type) {
|
||||||
return Challenge._getDns(opts);
|
return Challenge._get(opts);
|
||||||
} else {
|
} else {
|
||||||
return Challenge._getAny(opts);
|
return Challenge._get(opts);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,18 +79,19 @@ Challenge._setHttp = function (args, cb) {
|
||||||
// TODO let acme-v2 handle generating this url
|
// TODO let acme-v2 handle generating this url
|
||||||
console.info('\tURL: http://' + ch.altname + '/.well-known/acme-challenge/' + ch.token);
|
console.info('\tURL: http://' + ch.altname + '/.well-known/acme-challenge/' + ch.token);
|
||||||
console.info("");
|
console.info("");
|
||||||
console.info("And, if you need additional information for debugging:");
|
if (args.debug) {
|
||||||
console.info("");
|
console.info("And, if you need additional information for debugging:");
|
||||||
console.info(JSON.stringify(httpChallengeToJson(ch), null, 2).replace(/^/gm, '\t'));
|
console.info("");
|
||||||
console.info("");
|
console.info(JSON.stringify(httpChallengeToJson(ch), null, 2).replace(/^/gm, '\t'));
|
||||||
|
console.info("");
|
||||||
|
}
|
||||||
console.info("This message won't self-destruct, but you may press hit the any as soon as you're ready to continue...");
|
console.info("This message won't self-destruct, but you may press hit the any as soon as you're ready to continue...");
|
||||||
console.info("");
|
|
||||||
console.info("[Press the ANY key to continue...]");
|
console.info("[Press the ANY key to continue...]");
|
||||||
|
|
||||||
process.stdin.resume();
|
process.stdin.resume();
|
||||||
process.stdin.once('data', function () {
|
process.stdin.once('data', function () {
|
||||||
process.stdin.pause();
|
process.stdin.pause();
|
||||||
cb(null);
|
cb(null, null);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -104,16 +105,19 @@ Challenge._setDns = function (args, cb) {
|
||||||
console.info("");
|
console.info("");
|
||||||
console.info(ch.dnsHost + "\tTXT\t" + ch.dnsKeyAuthorization + "\tTTL 60");
|
console.info(ch.dnsHost + "\tTXT\t" + ch.dnsKeyAuthorization + "\tTTL 60");
|
||||||
console.info("");
|
console.info("");
|
||||||
console.info("Next, wait, no... there is no next. That's it - but here's some stuff anyway:");
|
console.info("Next, wait, no... there is no next.");
|
||||||
console.info("");
|
if (args.debug) {
|
||||||
console.info(JSON.stringify(dnsChallengeToJson(ch), null, 2).replace(/^/gm, '\t'));
|
console.log("Oh, did you want this?");
|
||||||
console.info("");
|
console.info("");
|
||||||
|
console.info(JSON.stringify(dnsChallengeToJson(ch), null, 2).replace(/^/gm, '\t'));
|
||||||
|
console.info("");
|
||||||
|
}
|
||||||
console.info("[Press the ANY key to continue...]");
|
console.info("[Press the ANY key to continue...]");
|
||||||
|
|
||||||
process.stdin.resume();
|
process.stdin.resume();
|
||||||
process.stdin.once('data', function () {
|
process.stdin.once('data', function () {
|
||||||
process.stdin.pause();
|
process.stdin.pause();
|
||||||
cb(null);
|
cb(null, null);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,9 +132,9 @@ Challenge._setAny = function (args, cb) {
|
||||||
console.info("[Press the ANY key to continue...]");
|
console.info("[Press the ANY key to continue...]");
|
||||||
|
|
||||||
process.stdin.resume();
|
process.stdin.resume();
|
||||||
process.stdin.on('data', function () {
|
process.stdin.once('data', function () {
|
||||||
process.stdin.pause();
|
process.stdin.pause();
|
||||||
cb(null);
|
cb(null, null);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -169,29 +173,37 @@ Challenge._removeAny = function (args) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// nothing to do here, that's why it's manual
|
// nothing to do here, that's why it's manual
|
||||||
Challenge._get = function (args, cb) {
|
Challenge._get = function (args) {
|
||||||
console.info("");
|
var ch = args.challenge;
|
||||||
console.info("Woah! Hey, guess what!? That's right you guessed it:");
|
|
||||||
console.info("It's time to painstakingly type out the ACME challenge response with your bear hands. Yes. Your bear hands.");
|
if (!Challenge._getCache[ch.altname + ':' + ch.token]) {
|
||||||
process.stdout.write("> ");
|
Challenge._getCache[ch.altname + ':' + ch.token] = true;
|
||||||
|
console.info("");
|
||||||
|
console.info('GET http://' + ch.altname + '/.well-known/acme-challenge/' + ch.token);
|
||||||
|
console.info("It's time to painstakingly type out the ACME challenge response with your bear hands. Yes. Your bear hands.");
|
||||||
|
process.stdout.write("> ");
|
||||||
|
}
|
||||||
|
|
||||||
// Using a promise here just to show that Promises are support
|
// Using a promise here just to show that Promises are support
|
||||||
// (in fact, they're the default)
|
// (in fact, they're the default)
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
process.stdin.resume();
|
process.stdin.resume();
|
||||||
process.stdin.on('error', reject);
|
process.stdin.once('error', reject);
|
||||||
process.stdin.on('data', function (chunk) {
|
process.stdin.once('data', function (chunk) {
|
||||||
process.stdin.pause();
|
process.stdin.pause();
|
||||||
var result = chunk.toString();
|
var result = chunk.toString();
|
||||||
try {
|
try {
|
||||||
result = JSON.parse(result);
|
result = JSON.parse(result);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
args.keyAuthorization = result;
|
args.challenge.keyAuthorization = result;
|
||||||
|
result = args.challenge;
|
||||||
}
|
}
|
||||||
cb(null);
|
resolve(result);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
// Because the ACME server will hammer us with requests, and that's confusing during a manual test:
|
||||||
|
Challenge._getCache = {};
|
||||||
|
|
||||||
function httpChallengeToJson(ch) {
|
function httpChallengeToJson(ch) {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "le-challenge-manual",
|
"name": "le-challenge-manual",
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"description": "A cli-based strategy for node-letsencrypt. Prints the ACME challenge Token and Key and then waits for you to hit enter before continuing.",
|
"description": "A cli-based strategy for node-letsencrypt. Prints the ACME challenge Token and Key and then waits for you to hit enter before continuing.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"homepage": "https://git.coolaj86.com/coolaj86/le-challenge-manual.js",
|
"homepage": "https://git.coolaj86.com/coolaj86/le-challenge-manual.js",
|
||||||
|
|
Loading…
Reference in New Issue