v2.0.0
This commit is contained in:
parent
b7a7780136
commit
10b107d5d5
56
README.md
56
README.md
|
@ -1,2 +1,54 @@
|
|||
# le-challenge-manual
|
||||
A cli-based strategy for node-letsencrypt. Prints the ACME challenge Token and Key and then waits for you to hit enter before continuing.
|
||||
[![Join the chat at https://gitter.im/Daplie/letsencrypt-express](https://badges.gitter.im/Daplie/letsencrypt-express.svg)](https://gitter.im/Daplie/letsencrypt-express?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
| [letsencrypt](https://github.com/Daplie/node-letsencrypt) (library)
|
||||
| [letsencrypt-cli](https://github.com/Daplie/letsencrypt-cli)
|
||||
| [letsencrypt-express](https://github.com/Daplie/letsencrypt-express)
|
||||
| [letsencrypt-koa](https://github.com/Daplie/letsencrypt-koa)
|
||||
| [letsencrypt-hapi](https://github.com/Daplie/letsencrypt-hapi)
|
||||
|
|
||||
|
||||
le-challenge-manual
|
||||
===================
|
||||
|
||||
A manual cli-based strategy for node-letsencrypt.
|
||||
|
||||
Prints the ACME challenge Token and Key and then waits for you to hit enter before continuing.
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
```bash
|
||||
npm install --save le-challenge-manual@2.x
|
||||
```
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```bash
|
||||
var leChallenge = require('le-challenge-manual').create({
|
||||
, debug: false
|
||||
});
|
||||
|
||||
var LE = require('letsencrypt');
|
||||
|
||||
LE.create({
|
||||
server: LE.stagingServerUrl
|
||||
, challenge: leChallenge
|
||||
});
|
||||
```
|
||||
|
||||
NOTE: If you request a certificate with 6 domains listed,
|
||||
it will require 6 individual challenges.
|
||||
|
||||
Exposed Methods
|
||||
---------------
|
||||
|
||||
For ACME Challenge:
|
||||
|
||||
* `set(opts, domain, key, val, done)`
|
||||
* `get(defaults, domain, key, done)`
|
||||
* `remove(defaults, domain, key, done)`
|
||||
|
||||
For node-letsencrypt internals:
|
||||
|
||||
* `getOptions()` returns the internal defaults merged with the user-supplied options
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
'use strict';
|
||||
|
||||
var Challenge = module.exports;
|
||||
|
||||
Challenge.create = function (defaults) {
|
||||
return {
|
||||
getOptions: function () {
|
||||
return defaults;
|
||||
}
|
||||
, set: Challenge.set
|
||||
, get: Challenge.get
|
||||
, remove: Challenge.remove
|
||||
};
|
||||
};
|
||||
|
||||
// Show the user the token and key and wait for them to be ready to continue
|
||||
Challenge.set = function (args, domain, token, secret, cb) {
|
||||
console.info("");
|
||||
console.info("Challenge for '" + domain + "'");
|
||||
console.info("");
|
||||
console.info("We now present (for you copy-and-paste pleasure) your ACME Challenge");
|
||||
console.info("public Token and secret Key, in that order, respectively:");
|
||||
console.info(token);
|
||||
console.info(secret);
|
||||
console.info("");
|
||||
console.info(JSON.stringify({
|
||||
domain: domain
|
||||
, token: token
|
||||
, key: secret
|
||||
}, null, ' ').replace(/^/gm, '\t'));
|
||||
console.info("");
|
||||
console.info("hit enter to continue...");
|
||||
process.stdin.resume();
|
||||
process.stdin.on('data', function () {
|
||||
process.stdin.pause();
|
||||
cb(null);
|
||||
});
|
||||
};
|
||||
|
||||
// nothing to do here, that's why it's manual
|
||||
Challenge.get = function (args, domain, token, cb) {
|
||||
cb(null);
|
||||
};
|
||||
|
||||
// might as well tell the user that whatever they were setting up has been checked
|
||||
Challenge.remove = function (args, domain, token, cb) {
|
||||
console.info("Challenge for '" + domain + "' complete.");
|
||||
console.info("");
|
||||
cb(null);
|
||||
};
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "le-challenge-manual",
|
||||
"version": "2.0.0",
|
||||
"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",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Daplie/le-challenge-manual.git"
|
||||
},
|
||||
"keywords": [
|
||||
"le-challenge",
|
||||
"le-challenge-",
|
||||
"manual",
|
||||
"acme",
|
||||
"letsencrypt",
|
||||
"certbot",
|
||||
"cli",
|
||||
"commandline"
|
||||
],
|
||||
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
|
||||
"license": "(MIT OR Apache-2.0)",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Daplie/le-challenge-manual/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Daplie/le-challenge-manual#readme"
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
var challenge = require('./').create({});
|
||||
|
||||
var opts = challenge.getOptions();
|
||||
var domain = 'example.com';
|
||||
var token = 'token-id';
|
||||
var key = 'secret-key';
|
||||
|
||||
// this will cause the prompt to appear
|
||||
challenge.set(opts, domain, token, key, function (err) {
|
||||
// if there's an error, there's a problem
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
// this will cause the final completion message to appear
|
||||
challenge.remove(opts, domain, token, function () {
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue