Compare commits
12 Commits
Author | SHA1 | Date |
---|---|---|
AJ ONeal | 03fdbe157a | |
AJ ONeal | 0393b1ae3a | |
AJ ONeal | 16637c4f67 | |
AJ ONeal | c834d1603d | |
AJ ONeal | a19685734d | |
AJ ONeal | bba58351e4 | |
AJ ONeal | fa845c4e18 | |
ceecko | 791cb03910 | |
AJ ONeal | d7313d932a | |
AJ ONeal | cf9890e387 | |
AJ ONeal | dc1920e68a | |
Peter Kaske | 7b4089ecb9 |
35
README.md
35
README.md
|
@ -1,5 +1,36 @@
|
|||
le-store-certbot
|
||||
================
|
||||
# Deprecated
|
||||
|
||||
`le-store-certbot` has been replaced with [`le-store-fs`](https://git.coolaj86.com/coolaj86/le-store-fs.js).
|
||||
|
||||
The new storage strategy **keeps file system compatibility**, but **drops support** for Python config files.
|
||||
|
||||
Unless you're running `certbot` and Greenlock side-by-side, or interchangeably, you switch to `le-store-fs`.
|
||||
|
||||
## Migrating to `le-store-fs`
|
||||
|
||||
It's **painless** and all of your existing certificates will be **preserved**
|
||||
(assuming you use the same `configDir` as before).
|
||||
|
||||
```js
|
||||
Greenlock.create({
|
||||
|
||||
// Leave configDir as it, if you've been setting it yourself.
|
||||
// Otherwise you should explicitly set it to the previous default:
|
||||
configDir: '~/letsencrypt/etc'
|
||||
|
||||
// le-store-fs takes the same options as le-store-certbot,
|
||||
// but ignores some of the ones that aren't important.
|
||||
, store: require('le-store-fs').create({})
|
||||
|
||||
...
|
||||
})
|
||||
```
|
||||
|
||||
## Alternatives
|
||||
|
||||
* Search npm for ["le-store-"](https://www.npmjs.com/search?q=le-store-) to find many alternatives.
|
||||
|
||||
# le-store-certbot
|
||||
|
||||
The "certbot" storage strategy for
|
||||
[Greenlock.js](https://git.coolaj86.com/coolaj86/le-store-certbot.js).
|
||||
|
|
39
index.js
39
index.js
|
@ -8,6 +8,9 @@ try {
|
|||
PromiseA = Promise;
|
||||
}
|
||||
var util = require('util');
|
||||
if (!util.promisify) {
|
||||
util.promisify = PromiseA.promisify;
|
||||
}
|
||||
function promisifyAll(obj) {
|
||||
var aobj = {};
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
|
@ -15,7 +18,7 @@ function promisifyAll(obj) {
|
|||
});
|
||||
return aobj;
|
||||
}
|
||||
var mkdirpAsync = util.promisify(require('mkdirp'));
|
||||
var mkdirpAsync = util.promisify(require('@root/mkdirp'));
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var readFileAsync = util.promisify(fs.readFile);
|
||||
|
@ -24,7 +27,6 @@ var writeFileAsync = util.promisify(fs.writeFile);
|
|||
var statAsync = util.promisify(fs.stat);
|
||||
var sfs = require('safe-replace');
|
||||
var os = require('os');
|
||||
var symlink = require('fs-symlink');
|
||||
|
||||
function log(debug) {
|
||||
if (debug) {
|
||||
|
@ -137,6 +139,7 @@ var defaults = {
|
|||
, fullchainPath: [ ':configDir', 'live', ':hostname', 'fullchain.pem' ].join(path.sep)
|
||||
, certPath: [ ':configDir', 'live', ':hostname', 'cert.pem' ].join(path.sep)
|
||||
, chainPath: [ ':configDir', 'live', ':hostname', 'chain.pem' ].join(path.sep)
|
||||
, bundlePath: [ ':configDir', 'live', ':hostname', 'bundle.pem' ].join(path.sep)
|
||||
|
||||
, rsaKeySize: 2048
|
||||
};
|
||||
|
@ -246,8 +249,8 @@ module.exports.create = function (configs) {
|
|||
};
|
||||
}, function (err) {
|
||||
if (args.debug) {
|
||||
console.error("[le-store-certbot] certificates.check");
|
||||
console.error(err.stack);
|
||||
log("certificates.check");
|
||||
log(err.stack);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
@ -264,9 +267,8 @@ module.exports.create = function (configs) {
|
|||
var certPath = args.certPath || pyobj.cert || path.join(liveDir, 'cert.pem');
|
||||
var fullchainPath = args.fullchainPath || pyobj.fullchain || path.join(liveDir, 'fullchain.pem');
|
||||
var chainPath = args.chainPath || pyobj.chain || path.join(liveDir, 'chain.pem');
|
||||
var privkeyPath = args.privkeyPath || pyobj.privkey
|
||||
|| args.domainKeyPath
|
||||
|| path.join(liveDir, 'privkey.pem');
|
||||
var privkeyPath = args.privkeyPath || pyobj.privkey || args.domainKeyPath || path.join(liveDir, 'privkey.pem');
|
||||
var bundlePath = args.bundlePath || pyobj.bundle || path.join(liveDir, 'bundle.pem');
|
||||
|
||||
var archiveDir = args.archiveDir || path.join(args.configDir, 'archive', args.domains[0]);
|
||||
|
||||
|
@ -275,22 +277,31 @@ module.exports.create = function (configs) {
|
|||
var fullchainArchive = path.join(archiveDir, 'fullchain' + checkpoints + '.pem');
|
||||
var chainArchive = path.join(archiveDir, 'chain'+ checkpoints + '.pem');
|
||||
var privkeyArchive = path.join(archiveDir, 'privkey' + checkpoints + '.pem');
|
||||
var bundleArchive = path.join(archiveDir, 'bundle' + checkpoints + '.pem');
|
||||
|
||||
return mkdirpAsync(archiveDir).then(function () {
|
||||
return PromiseA.all([
|
||||
var ps = [
|
||||
sfs.writeFileAsync(certArchive, pems.cert, 'ascii')
|
||||
, sfs.writeFileAsync(chainArchive, pems.chain, 'ascii')
|
||||
, sfs.writeFileAsync(fullchainArchive, [ pems.cert, pems.chain ].join('\n'), 'ascii')
|
||||
, sfs.writeFileAsync(privkeyArchive, pems.privkey, 'ascii')
|
||||
]);
|
||||
];
|
||||
if (pems.bundle) {
|
||||
var bundleP = sfs.writeFileAsync(bundleArchive, pems.bundle, 'ascii');
|
||||
ps.push(bundleP);
|
||||
}
|
||||
return PromiseA.all(ps);
|
||||
}).then(function () {
|
||||
return mkdirpAsync(liveDir);
|
||||
}).then(function () {
|
||||
return PromiseA.all([
|
||||
symlink(certArchive, certPath)
|
||||
, symlink(chainArchive, chainPath)
|
||||
, symlink(fullchainArchive, fullchainPath)
|
||||
, symlink(privkeyArchive, privkeyPath)
|
||||
sfs.writeFileAsync(certPath, pems.cert, 'ascii')
|
||||
, sfs.writeFileAsync(chainPath, pems.chain, 'ascii')
|
||||
// Most platforms need these two
|
||||
, sfs.writeFileAsync(fullchainPath, [ pems.cert, pems.chain ].join('\n'), 'ascii')
|
||||
, sfs.writeFileAsync(privkeyPath, pems.privkey, 'ascii')
|
||||
// HAProxy needs "bundle.pem" aka "combined.pem"
|
||||
, sfs.writeFileAsync(bundlePath, [ pems.privkey, pems.cert, pems.chain ].join('\n'), 'ascii')
|
||||
]);
|
||||
}).then(function () {
|
||||
pyobj.checkpoints += 1;
|
||||
|
@ -304,6 +315,8 @@ module.exports.create = function (configs) {
|
|||
privkey: pems.privkey
|
||||
, cert: pems.cert
|
||||
, chain: pems.chain
|
||||
, expires: pems.expires
|
||||
, identifiers: pems.identifiers
|
||||
|
||||
/*
|
||||
// TODO populate these only if they are actually known
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "le-store-certbot",
|
||||
"version": "2.2.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@root/mkdirp": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@root/mkdirp/-/mkdirp-1.0.0.tgz",
|
||||
"integrity": "sha512-hxGAYUx5029VggfG+U9naAhQkoMSXtOeXtbql97m3Hi6/sQSRL/4khKZPyOF6w11glyCOU38WCNLu9nUcSjOfA=="
|
||||
},
|
||||
"pyconf": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/pyconf/-/pyconf-1.1.7.tgz",
|
||||
"integrity": "sha512-v4clh33m68sjtMsh8XMpjhGWb/MQODAYZ1y7ORG5Qv58UK25OddoB+oXyexgDkK8ttFui/lZm2sQDgA2Ftjfkw==",
|
||||
"requires": {
|
||||
"safe-replace": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"safe-replace": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-replace/-/safe-replace-1.1.0.tgz",
|
||||
"integrity": "sha512-9/V2E0CDsKs9DWOOwJH7jYpSl9S3N05uyevNjvsnDauBqRowBPOyot1fIvV5N2IuZAbYyvrTXrYFVG0RZInfFw=="
|
||||
}
|
||||
}
|
||||
}
|
10
package.json
10
package.json
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
"name": "le-store-certbot",
|
||||
"version": "2.1.8",
|
||||
"version": "2.2.4",
|
||||
"description": "The \"certbot\" storage strategy for Greenlock.js",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"bump": "npm version -m \"chore(release): bump to v%s\"",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -27,9 +28,8 @@
|
|||
"bluebird": "^3.5.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"fs-symlink": "^1.2.1",
|
||||
"mkdirp": "^0.5.1",
|
||||
"pyconf": "^1.1.2",
|
||||
"safe-replace": "^1.0.2"
|
||||
"@root/mkdirp": "^1.0.0",
|
||||
"pyconf": "^1.1.7",
|
||||
"safe-replace": "^1.1.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue